OpenACC with 2 GPU


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)?



Yes, you can assign a specific GPU.

  1. run pgaccelinfo
    to determine the GPU numbers (0,1)
    or call
    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
has an example.