Setting Cores in OpenACC

OpenACC and CUDA Fortran
Post Reply
Posts: 1
Joined: Dec 04 2019

Setting Cores in OpenACC

Post by prushir » Wed Dec 04, 2019 2:17 pm

I am trying to use OpenAcc to parallelize my Monte Carlo code and I am trying to run it with a different number of cores but I keep getting the same results. I have attached my code and make file.
Code on Github under MonteCarlo folder and ACC folder:

Posts: 171
Joined: Jun 11 2018

Re: Setting Cores in OpenACC

Post by aglobus » Wed Dec 04, 2019 2:44 pm

Hi prushir,

What do you mean by cores? I'm guessing you're meaning gangs.

Vector is always implied. If you look at the -Minfo=accel messages, you'll see that vector(128) is added. Therefore each vector within a gang is using the same seed value. You'll only get different values across the gang. One suggestion is to set the vector length to 1 by putting vector_length(1) on the parallel loop, but you'll lose some performance. Alternatively, create a seed per vector.

Code: Select all

         43, #pragma acc loop gang(gangs), vector(128) /* blockIdx.x threadIdx.x */

Post Reply