Environment:
- SU2 8.5.0
- GCC 14.2
- CUDA 13.1
- Ubuntu 24.04
Describe the bug
When compiling with -Denable-cuda=true I received the following error:
../Common/src/linear_algebra/../../include/linear_algebra/../parallelization/../basic_types/../parallelization/omp_structure.hpp:292:45: error: invalid form of ?#pragma omp atomic? before ?;? token
292 | shared = shared < local ? local : shared;
I assume when CUDA is enabled, NVCC preprocesses and parses code before handing it to GCC. CUDA 13.1 appears not to fully support this OpenMP construct, even though the compiler (GCC 14.2) does.
It was fixed by changing in Common/include/parallelization/omp_structure.hpp from:
274 #define ATOMIC_COMPARE_SINCE 202011
275 #ifdef __GNUC__
276 #if __GNUC__ > 11
277 #undef ATOMIC_COMPARE_SINCE
278 #define ATOMIC_COMPARE_SINCE 201511
279 #endif
280 #endif
to:
274 #define ATOMIC_COMPARE_SINCE 202011
275 #if defined(__GNUC__) && !defined(__CUDACC__)
276 #if __GNUC__ > 11
277 #undef ATOMIC_COMPARE_SINCE
278 #define ATOMIC_COMPARE_SINCE 201511
279 #endif
280 #endif
thus disabling the GCC-specific atomic compare optimization under __CUDACC__.
Environment:
Describe the bug
When compiling with
-Denable-cuda=trueI received the following error:I assume when CUDA is enabled, NVCC preprocesses and parses code before handing it to GCC. CUDA 13.1 appears not to fully support this OpenMP construct, even though the compiler (GCC 14.2) does.
It was fixed by changing in
Common/include/parallelization/omp_structure.hppfrom:to:
thus disabling the GCC-specific
atomic compareoptimization under__CUDACC__.