Software Archive
Read-only legacy content
17061 Discussions

Run a function on mic0 and mic1 concurrently (OpenMP)

Mahendra_S_
Beginner
364 Views

Hi,

I am implementing openMP offload program currently running on single Phi device.
My computing node has 2 Phi devices named mic0 and mic1.
Could you please let me know how I can extend the following code section to run on both devices simultaneously.

Assume the code sections can be run independently to each other where all data (input and output) are independent.
I need to know the structure of code and the directives to do it properly in openMP. Further, compilation method also required.

__________________________ Code ___________________________

#pragma offload target(mic) \
in(reHoaIn, imHoaIn : length(dimDM*nObs))
{
    omp_set_num_threads(nT);
    kernelSolver( reXn, imXn, reHoaIn, imHoaIn);
}

memcpy( pwdReMatrix, reXn, nT*dimDN*sizeof(float) );
memcpy( pwdImMatrix, imXn, nT*dimDN*sizeof(float) );
__________________________________________________________

Note : kernelSolver function should be run on mic0 and mic1 concurrently.

Thank you.

 

0 Kudos
1 Reply
Mahendra_S_
Beginner
364 Views

Hi,

The two devices can be used as follow: http://wiki.rac.manchester.ac.uk/community/XeonPhi/GettingStarted/Programming

------------------------------------------------------------------------------
#pragma offload target (mic:0)
{
  // Offload code to first Xeon Phi.
}
#pragma offload target (mic:1)
{
  // Offload code to second Xeon Phi.
}

------------------------------------------------------------------------------

By using the : export OFFLOAD_REPORT=2

it can be seen which devices the program uses in run-time.

Use,

#pragma offload_wait target(mic:0) wait(&signal_mic0)
#pragma offload_wait target(mic:1) wait(&signal_mic1)

to block the CPU program until the MIC operations are finished.

 

0 Kudos
Reply