Hello, I’m new to using OpenACC for parallelizing Fortran code. I’m using the following command to compile my code with parallel support: pgfortran -acc -Minfo 12.f9 -o 12.out
, where 12.f9
is the name of my code file. When I don’t need to parallelize my code, I remove the -acc
flag and compile with pgfortran -Minfo 12.f9 -o 12.out
. Strangely, I’m noticing a significant difference in computational efficiency between the two methods, with the -acc
version typically being faster. Even for simple do
loops, the computational rate is the same as when parallelized. I’m curious if -acc
might be performing some simple parallelization on its own, even without explicit parallel directives in my code.
“-acc” implies “-O2” so your getting more optimization applied to your code. By default, “-O” is used which doesn’t include auto-vectorization and likely why the runtime is slower.
To fix, add “-O2” to both compilations, or better yet, “-Ofast”.
Hope this helps,
Mat
I understand, thank you very much for your response.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.