How to ensure a dynamically allocated array is private in openmp

前端 未结 2 764
北荒
北荒 2020-12-05 05:31

I\'m working in C with openMP using gcc on a linux machine. In an openmp parallel for loop, I can declare a statically allocated array as private. Consider the code fragme

2条回答
  •  青春惊慌失措
    2020-12-05 06:17

    You told OpenMP that the pointer a is private, i.e. replicated in each thread. Your array is just some arbitrary data a points to, and OpenMP will not replicate it (perhaps because this would make it necessary to allocate and deallocate the replicated arrays).

提交回复
热议问题