OpenACC with 2 GPU

Hi,

If I have different 2 different(or same) GPU, which one will be chosen when I compile OpenACC with PGI?Stronger calculation ability or random.

Could I assign the GPU and How(for example)?


best,

Jackie

Yes, you can assign a specific GPU.

  1. run pgaccelinfo
    to determine the GPU numbers (0,1)
    or call
    ierr=cudaGetDeviceCount(numdev)
    from within the program

  2. Use OpenMP (not OpenACC) to run two threads
    simultaneously. each OpenMP thread on the CPU will assign a GPU and
    then run an OpenACC from each thread.

ierr = cudaSetDevice(mydev)


Now you have two GPUs running an OpenACC program
simultaneously.

has an example.