Software Archive
Read-only legacy content
17061 Discussions

Offloading By a Single Thread In An OpenMP Region

Amlesh_K_
Beginner
243 Views

Hi,

Let's assume we have 2 code sections, all of which have a do loop inside them. Let these sections be sectA and sectB. Please consider the following code - 

!$omp parallel do clause_set_1 num_threads(16)
  sect A

!dir$ offload target(mic:0) clause_set_2
  !$omp parallel do clause_set_3 num_threads(240)
    sectB
!dir$ end offload

The above code works as we would like it to work.

My intention is to have a 16-thread openMP parallel region which would contain the offload directives. Inside the parallel region, only the master thread takes care of the offload, with the rest 15 threads waiting at the end of the parallel region. Like this -

!$omp parallel do clause_set_1 num_threads(16)
  sect A

!$omp parallel clause_set_4 num_threads(16)

 !$omp master
   !dir$ offload target(mic:0) clause_set_2
      !$omp parallel do clause_set_3 num_threads(240)   //Comment 1
        sectB
   !dir$ end offload
 !$omp end master

!$omp end parallel

 

Now this clause_set_4 has only the following - default(firstprivate).

Ideally it should've worked fine, as everything is firstprivate, and hence the master thread will have a initialized copy of all the required variables for sending to the Xeon Phi. And since the 1st code fragment works correctly, second should have also worked. But I am getting segmentation fault. Please note that I get segmentation fault after the threads on the Xeon Phi are spawned (ie, Till Comment 1, it's working). What can be the possible issue? Do I need to add something from clause_set_3 to the clause_set_4? Or is there something else which I've missed?

Also, please note that when the clause_set_4 has only the following - default(shared), then the code stops running (but doesn't get killed) after the offloading process has started.

Thanks.

0 Kudos
2 Replies
Steven_L_Intel1
Employee
243 Views

I'm going to move this to the Xeon Phi forum, as it seems more related to that topic than Fortran.

0 Kudos
Kevin_D_Intel
Employee
243 Views

We need more details about what appears in the clause_set(s) and variables used in the program. As a start, could you enable OFFLOAD_REPORT=3 and capture the output for the SegV case and post that in a reply, or if needed send privately to me via the Send Author A Message link.

0 Kudos
Reply