BTW. In your makefile, I would set “CXX = $(shell root-config --cxx)” and then use “$(CXX)” instead of “g++”. Also, in the places where it is used, I would temporarily add a line with “$(CXX) --version” (to make sure that it is exactly the same compiler that was used by ROOT).
Actually, I can’t find the real “main” routine of your “OscClass” executable.
Right in its beginning, try to add one line: TApplication a("a", 0, 0); // just to make sure that the autoloading of ROOT libraries works
Well, in the last trial, try to add “-x cu” (which exists in your makefile and it enforces the file type).
Somehow, you need to “reproduce” the error.
The first trial would be to modify the makefile so that it always uses “${CXX}”, also when CUDA is loaded.
If it works, you can try to play with the “nvcc” command line there.
You need to find the “main” routine of your executable:
#include "TApplication.h"
int main(int argc, char **argv) {
TApplication a("a", 0, 0); // just to make sure that the autoloading of ROOT libraries works
// ... the current content of the main comes here ...
}
what do I expect after adding this? I added in the main function below and I still see the same error, there is no obvious change. PrintEventRate.cpp (30.0 KB)
I also need to point out in the very first post of this topic, even though I loaded a cuda module, the executable is not built with nvcc (I didn’t define $CUDAPATH when compile), instead, the executable is built with g++ (so this is not a nvcc problem):
make[1]: Entering directory '/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/OscClass'
g++ -I. -Wall -fPIC -O3 -g -std=c++11 -fopenmp -I/autofs/nccs-svm1_home1/wshi/ProdROOT/v5-34-00-patches/include -L/autofs/nccs-svm1_home1/wshi/ProdROOT/v5-34-00-patches/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -lRooFit -lRooFitCore -lMinuit -lHistPainter -I.. -c OscClass_CUDAProb3.cpp -o OscClass_CUDAProb3.o
In file included from ../manager/manager.h:17,
from OscClass_CUDAProb3.h:15,
from OscClass_CUDAProb3.cpp:1:
../libconfig/lib/libconfig.h++:200:36: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
void assertType(Type type) const throw(SettingTypeException);
^~~~~
In file included from OscClass_CUDAProb3.h:19,
from OscClass_CUDAProb3.cpp:1:
../CUDAProb3/propagator.hpp: In instantiation of 'void cudaprob3::Propagator<FLOAT_T>::setProductionHeightList(const std::vector<FLOAT_T>&, const std::vector<FLOAT_T>&) [with FLOAT_T = double]':
OscClass_CUDAProb3.cpp:1488:93: required from here
../CUDAProb3/propagator.hpp:504:30: warning: comparison of integer expressions of different signedness: 'std::vector<double>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
if (list_prob.size() != this->nProductionHeightBins*2*3*n_energies*n_cosines) {
../CUDAProb3/propagator.hpp:508:32: warning: comparison of integer expressions of different signedness: 'std::vector<double>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
if (list_bins.size()-1 != this->nProductionHeightBins) {
../CUDAProb3/propagator.hpp:514:32: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
for (unsigned int i=0;i<MaxSize;i++) {
~^~~~~~~~
In file included from OscClass_CUDAProb3.h:27,
from OscClass_CUDAProb3.cpp:1:
../CUDAProb3/cpupropagator.hpp: In instantiation of 'void cudaprob3::CpuPropagator<FLOAT_T>::setChemicalComposition(const std::vector<FLOAT_T>&) [with FLOAT_T = double]':
../CUDAProb3/cpupropagator.hpp:117:14: required from here
../CUDAProb3/cpupropagator.hpp:122:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
for (int iyp=0;iyp<list.size();iyp++) {
../CUDAProb3/cpupropagator.hpp: In instantiation of 'void cudaprob3::CpuPropagator<FLOAT_T>::getProbabilityArr(FLOAT_T*, cudaprob3::ProbType) [with FLOAT_T = double]':
../CUDAProb3/cpupropagator.hpp:138:14: required from here
../CUDAProb3/cpupropagator.hpp:141:57: warning: comparison of integer expressions of different signedness: 'uint64_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
for (std::uint64_t index_energy=0;index_energy<this->n_energies;index_energy++) {
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
../CUDAProb3/cpupropagator.hpp:142:59: warning: comparison of integer expressions of different signedness: 'uint64_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
for (std::uint64_t index_cosine=0;index_cosine<this->n_cosines;index_cosine++) {
~~~~~~~~~~~~^~~~~~~~~~~~~~~~
g++ -shared -o libOscillator_1.00.so OscClass_CUDAProb3.o -L/autofs/nccs-svm1_home1/wshi/ProdROOT/v5-34-00-patches/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -lRooFit -lRooFitCore -lMinuit -lHistPainter
mv libOscillator_1.00.so ../lib/.
make[1]: Leaving directory '/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/OscClass'
Use the same g++ rule to compile test.cxx, I got the expected output.
[wshi@login5.summit ~]$ g++ -I. -Wall -fPIC -O3 -g -std=c++11 -fopenmp -I/autofs/nccs-svm1_home1/wshi/ProdROOT/v5-34-00-patches/include -L/autofs/nccs-svm1_home1/wshi/ProdROOT/v5-34-00-patches/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -lRooFit -lRooFitCore -lMinuit -lHistPainter test.cxx
[wshi@login5.summit ~]$ ./a.out
RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
Read Oscillator Template file (InputFileName): /autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/inputs/skatm/OscillogramTemplate.root
Read Oscillator Template file (InputFileName.c_str()): /autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/inputs/skatm/OscillogramTemplate.root
nCoarseCosz: 52