Hallo. There is a source code in GitHub - Agar92/QUESTION. It is a small reproducing example of the full code, so it does not do any useful work, but only reproduces the compile error i have.
I use the compile line:
cmake . -DCMAKE_C_COMPILER=pgcc -DCMAKE_CXX_COMPILER=pgc++
-DCMAKE_C_FLAGS="-acc -Minfo=acc -mcmodel=medium -ta=tesla:cc70
-tp=haswell -Mnollvm -Minline -Mcuda=cuda10.1"
-DCMAKE_CXX_FLAGS="-acc -Minfo=acc -mcmodel=medium -ta=tesla:cc70
-tp=haswell -Mnollvm -Minline -Mcuda=cuda10.1" -DCMAKE_CXX_STANDARD=17
-DACC=ON -DCUDA=ON
But when i try to compile the code for launching it on GPU Nvidia Titan V (installed CUDA driver version 418.74) fixed in Intel KNL 64-core PC (OS: Debian Stable, gcc 7.4.0, PGI 19.4) using PGI 19.4 compiler + OpenAcc standard, the compilation immediately fails with:
/opt/pgi/19/u4/linux86-64-nollvm/19.4/include/mmintrin.h", line 27:
catastrophic error: #error directive: “MMX instruction set not
enabled”
#error “MMX instruction set not enabled”
^1 catastrophic error detected in the compilation of “/data/70-gaa/Desktop/CURRENT_WORK/FIND_COMPILATION_ERROR/nbody.cpp”.
Compilation terminated.
make[2]: *** [CMakeFiles/Test.dir/build.make:63: CMakeFiles/Test.dir/nbody.cpp.o] Error 2
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/Test.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I found that if to comment the lines 6-7 of nbody.cpp file, the compilation fails with:
ptxas /tmp/pgaccOPUd4Lp3OXUd.ptx, line 586; error : Type of argument does not match formal parameter ‘__pgi_fixuk_param_0’
ptxas /tmp/pgaccOPUd4Lp3OXUd.ptx, line 586; error : Alignment of argument does not match formal parameter ‘__pgi_fixuk_param_0’
ptxas fatal : Ptx assembly aborted due to errors
PGCC-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (/data/70-gaa/Desktop/CURRENT_WORK/FIND_COMPILATION_ERROR/management/src/T3ElasticStrongIonIon_DB.cc: 1)
PGCC/x86 Linux 19.4-0: compilation completed with warnings
The same error for the T3Inelasticdd_DB.cc file. And finally:
[100%] Linking CXX executable Test
nvlink error : Undefined reference to ‘_ZNK24T3ElasticStrongIonIon_DB13RandomizeCostERjd’ in ‘CMakeFiles/Test.dir/nbody.cpp.o’
pgacclnk: child process exit status 2: /opt/pgi/19/u4/linux86-64-nollvm/19.4/bin/pgnvd
make[2]: *** [CMakeFiles/Test.dir/build.make:264: Test] Error 2
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/Test.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
What causes these errors and how to fix them?