Skip to content

Minimal changes to add clang support#134

Merged
valassi merged 4 commits into
madgraph5:masterfrom
valassi:clang2
Mar 21, 2021
Merged

Minimal changes to add clang support#134
valassi merged 4 commits into
madgraph5:masterfrom
valassi:clang2

Conversation

@valassi
Copy link
Copy Markdown
Member

@valassi valassi commented Mar 21, 2021

This patch fixes two build warnings (unused variables) and especially a link error for runTest.exe.

/cvmfs/sft.cern.ch/lcg/releases/clang/10.0.0-62e61/x86_64-centos7/bin/clang++  -O3  -std=c++11 -I. -I../../src -I../../../../../tools -DUSE_NVTX -Wall -Wshadow -Wextra -fopenmp  -ffast-math  -I/usr/local/cuda-11.0/include/ -c CPPProcess.cc -o CPPProcess.o
In file included from CPPProcess.cc:444:
./CPPProcess.h:89:9: warning: private field 'm_numiterations' is not used [-Wunused-private-field]
    int m_numiterations;
        ^
./CPPProcess.h:103:14: warning: private field 'amp' is not used [-Wunused-private-field]
    cxtype** amp;
             ^
2 warnings generated.
/cvmfs/sft.cern.ch/lcg/releases/clang/10.0.0-62e61/x86_64-centos7/bin/clang++ check.o -o check.exe CPPProcess.o  -O3  -std=c++11 -I. -I../../src -I../../../../../tools -DUSE_NVTX -Wall -Wshadow -Wextra -fopenmp  -ffast-math  -ldl -pthread -L../../lib -lmodel_sm -L/usr/local/cuda-11.0/lib64/ -lcuda -lcurand
/cvmfs/sft.cern.ch/lcg/releases/clang/10.0.0-62e61/x86_64-centos7/bin/clang++  -O3  -std=c++11 -I. -I../../src -I../../../../../tools -I../../../../../test/googletest/googletest/include/ -I../../../../../test/include/ -DUSE_NVTX -Wall -Wshadow -Wextra -fopenmp  -ffast-math  -I/usr/local/cuda-11.0/include/ -c runTest.cc -o runTest.o
/cvmfs/sft.cern.ch/lcg/releases/clang/10.0.0-62e61/x86_64-centos7/bin/clang++  -O3  -std=c++11 -I. -I../../src -I../../../../../tools -I../../../../../test/googletest/googletest/include/ -I../../../../../test/include/ -DUSE_NVTX -Wall -Wshadow -Wextra -fopenmp  -ffast-math  -I/usr/local/cuda-11.0/include/ -c ../../../../../test/src/MadgraphTest.cc -o ../../../../../test/src/MadgraphTest.o
/usr/local/cuda-11.0/bin/nvcc -o runTest_cu.o -c -x cu runTest.cc  -O3  -lineinfo -std=c++14 -I. -I../../src -I../../../../../tools -I../../../../../test/googletest/googletest/include/ -I../../../../../test/include/ -I/usr/local/cuda-11.0/include/ -DUSE_NVTX -arch=compute_70 -use_fast_math 
/usr/local/cuda-11.0/bin/nvcc -o runTest.exe CPPProcess.o runTest.o ../../../../../test/src/MadgraphTest.o gCPPProcess.o runTest_cu.o  -O3  -lineinfo -std=c++14 -I. -I../../src -I../../../../../tools -I../../../../../test/googletest/googletest/include/ -I../../../../../test/include/ -I/usr/local/cuda-11.0/include/ -DUSE_NVTX -arch=compute_70 -use_fast_math  -ldl -L../../lib -lmodel_sm -L../../../../../test/googletest/build/lib// -lgtest -lgtest_main -L/usr/local/cuda-11.0/lib64/ -lcuda -lcurand -lcuda -lgomp
CPPProcess.o: In function `Proc::sigmaKin(double const*, double*, int)':
CPPProcess.cc:(.text+0x29df): undefined reference to `__kmpc_fork_call'
CPPProcess.o: In function `.omp_outlined.':
CPPProcess.cc:(.text+0x2a69): undefined reference to `__kmpc_for_static_init_4'
CPPProcess.cc:(.text+0x2a93): undefined reference to `__kmpc_for_static_fini'
collect2: error: ld returned 1 exit status
make: *** [runTest.exe] Error 1

To solve the link error, the fix is to add the clang library via -L explicitly.

Initially I had also used -lomp instead of -lgomp: later on, however, I realised that -lgomp could be used also for clang, as libgomp.so is a symlink to libomp.so (in all clang installations I found on SFT cvmfs):

ls -l /cvmfs/sft.cern.ch/lcg/releases/clang/10.0.0-62e61/x86_64-centos7/lib/libgomp.so 
lrwxrwxrwx. 1 cvmfs cvmfs 9 Apr  3  2020 /cvmfs/sft.cern.ch/lcg/releases/clang/10.0.0-62e61/x86_64-centos7/lib/libgomp.so -> libomp.so*

valassi added 4 commits March 21, 2021 16:20
…ang++)

Fix cherry-pick conflicts: epoch1/cuda/ee_mumu/SubProcesses/Makefile

Add the clang lib directory to -L explicitly.
Use -lomp instead of -lgomp for clang.
@valassi
Copy link
Copy Markdown
Member Author

valassi commented Mar 21, 2021

Self-merging. The initial version of these fixes were in the klas2 PR #132 but I find it neater to separate the SIMD and clang issues. Note that the clang build errors in fact were already present in master.

@valassi valassi merged commit d2ff80b into madgraph5:master Mar 21, 2021
valassi added a commit to valassi/madgraph4gpu that referenced this pull request Mar 21, 2021
Fix conflicts in epoch1/cuda/ee_mumu/SubProcesses/Makefile

This merge essentially merges the clang PR madgraph5#134
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant