Error on TBufferFile::ReadVersion

I added it like this:

#include "OscClass_CUDAProb3.h"

Oscillator::Oscillator(std::string ConfigName) {

TApplication a(“a”, 0, 0);

  //####################################################################################
  //Set definite values
  
  nOscpars = 6;

Here is what it says

make[1]: Entering directory '/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/OscClass'
rm -f OscClass_CUDAProb3.o
nvcc -g -O3 -x cu  -lineinfo -std=c++11 -Xcompiler="-fopenmp -Wall -I/autofs/nccs-svm1_home1/wshi/ROOT/v5-34-00-patches/include -L/autofs/nccs-svm1_home1/wshi/ROOT/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. -Wall -fPIC -O3 -g -std=c++11 -fopenmp -pthread -std=c++11 -Wno-deprecated-declarations -m64 -fsigned-char -I/autofs/nccs-svm1_home1/wshi/ROOT/v5-34-00-patches/include -DUSE_GPU" -I.. -c OscClass_CUDAProb3.cpp -o OscClass_CUDAProb3.o
OscClass_CUDAProb3.cpp(5): error: identifier "TApplication" is undefined

1 error detected in the compilation of "OscClass_CUDAProb3.cpp".
make[1]: *** [Makefile:58: OscClass_CUDAProb3.o] Error 1
make[1]: Leaving directory '/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/OscClass'
make: *** [Makefile:52: all] Error 2

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

Do you still get the same errors when running it?

If yes, try NOT to load the CUDA module and build everything from scratch again (maybe even if you do not explicitly use “nvcc”, the CUDA environment still injects something lethal into the environment).

Another trial could be to run “root” and then:

.L ../lib/libOscillator_1.00.so
Oscillator *Oscill = new Oscillator("/autofs/.../inputs/skatm/OscillogramTemplate.root")

Also, check the “Read Oscillator Template file” (are these two exactly the same file?):
ls -al /autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/inputs/skatm/OscillogramTemplate.root
ls -al inputs/skatm/OscillogramTemplate.root # such a path appears in your "analysis_log.txt"

BTW. In your “Makefile.txt”, I cannot find any reference to the “PrintEventRate.cpp” file. When it builds the “OscClass” target / executable, can it be that a different “main” routine is actually used there?

There are several make files:

One that’s in the same folder with PrintEventRate.cpp:
Makefile_PrintEventRate.txt (2.5 KB)

PrintEventRate calls the OscClass, which has its own makefile I attached above, reattach again here to be clear:
Makefile_OscClass.txt (2.0 KB)

Yes, they are the same file.

The cluster is going through rebooting and I lost access for now. Will post results of other trials later.

So I tried this, it’s complaining the Oscillator class not defined:

root [0] .L lib/libOscillator_1.00.so 

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

Error in <TGClient::TGClient>: can't open display "localhost:20.0", switching to batch mode...
 In case you run from a remote ssh session, reconnect with ssh -Y
root [1] Oscillator* Oscill = new Oscillator("/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/configs/AtmosphericConfigs/Oscillator.cfg")
Error: Symbol Oscillator is not defined in current scope  (tmpfile):1:
Error: Symbol Oscillator is not defined in current scope  (tmpfile):1:
Error: type Oscillator not defined FILE:(tmpfile) LINE:1
Error: Invalid type 'Oscillator*' in declaration of 'Oscill' (tmpfile):1:
*** Interpreter error recovered ***

I also tried not loading CUDA, it’s not helping.

[wshi@login2.summit MaCh3]$ nvcc --version
-bash: nvcc: command not found
[wshi@login2.summit MaCh3]$ which cuda
/usr/bin/which: no cuda in (/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psycheSteering/v3r33/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psycheSystematics/v3r37/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psycheSelections/v3r41/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psycheIO/v3r25/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psycheND280Utils/v3r47/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psycheUtils/v3r29/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psycheEventModel/v3r33/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psycheCore/v3r35/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/psyche/psychePolicy/v3r3/scripts:/autofs/nccs-svm1_home1/wshi/ROOT/v5-34-00-patches/bin:/autofs/nccs-svm1_home1/wshi/MaCh3/CMT/v1r20p20081118/Linux-ppc64le:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/bin:/autofs/nccs-svm1_home1/wshi/MaCh3/procmail-3.22/new:/autofs/nccs-svm1_home1/wshi/MaCh3/gsl-1.16/Linux/bin:/autofs/nccs-svm1_home1/wshi/MaCh3/MaCh3/NIWGReWeight/app:/sw/summit/xalt/1.2.1/bin:/sw/sources/lsf-tools/2.0/summit/bin:/sw/summit/spack-envs/base/opt/linux-rhel8-ppc64le/gcc-8.3.1/python-2.7.15-6u3drknv3x3ocyhzgcqzrxjdaccpuxcp/bin:/sw/summit/spack-envs/base/opt/linux-rhel8-ppc64le/gcc-8.3.1/cmake-3.18.4-zfbfcsa2u3m3a6x3pgm26jornwce6b6c/bin:/sw/summit/spack-envs/base/opt/linux-rhel8-ppc64le/gcc-8.3.1/darshan-runtime-3.3.0-mu6tnxlhxfplrq3srkkgi5dvly6wenwy/bin:/sw/sources/hpss/bin:/sw/summit/spack-envs/base/opt/linux-rhel8-ppc64le/xl-16.1.1-10/spectrum-mpi-10.4.0.3-20210112-dzedzfvocsuzkm4jkqe7o64x53yhq7nm/bin:/sw/summit/xl/16.1.1-10/xlC/16.1.1/bin:/sw/summit/xl/16.1.1-10/xlf/16.1.1/bin:/opt/ibm/spectrumcomputing/lsf/10.1.0.11/linux3.10-glibc2.17-ppc64le-csm/etc:/opt/ibm/spectrumcomputing/lsf/10.1.0.11/linux3.10-glibc2.17-ppc64le-csm/bin:/opt/ibm/csm/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibm/flightlog/bin:/opt/ibm/jsm/bin:/sw/sources/cgroup_tool/bin:/opt/puppetlabs/bin:/usr/lpp/mmfs/bin:procmail-3.22/new)

Again, same compile rule on test.cxx works fine, but not for the class

[wshi@login2.summit ~]$ g++ -I. -Wall -fPIC -O3 -g -std=c++11 -fopenmp -I/autofs/nccs-svm1_home1/wshi/ROOT/v5-34-00-patches/include -L/autofs/nccs-svm1_home1/wshi/ROOT/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@login2.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

On second glance, I can see now that you do not create a ROOT dictionary for the “Oscillator” class, so it would be very difficult to test it in an interactive ROOT session.

It seems that, in the end, I can only give you some “general recommendations”.

  • Make sure you compile everything (all involved libraries and executables) with the same compiler (GCC 8.3.1) and with the same C++ standard (“-std=c++11”).

  • Do not load any additional “environment modules” that were built with other compilers (your “nvcc” should be fine as it internally calls GCC 8.3.1, which you tested in one of the previous posts).

  • At the beginning of your “main”, if you do not already have a TApplication there, add:
    TApplication a("a", 0, 0); // just to make sure that the autoloading of ROOT libraries works

Actually, I am a bit surprised that your standalone “test.cxx” executable works without the TApplication.
I get (Ubuntu 22.04 / x86_64 / GCC 11.3 and ROOT 5.34 with the “cxx11” feature enabled):

[...]$ `root-config --cxx --cflags` test.C `root-config --libs` ; ./a.out
Warning in <TClass::TClass>: no dictionary for class TH1 is available
Warning in <TClass::TClass>: no dictionary for class TAxis is available
Warning in <TClass::TClass>: no dictionary for class TH2D is available
Warning in <TClass::TClass>: no dictionary for class TH2 is available
Read Oscillator Template file (InputFileName): OscillogramTemplate.root
Read Oscillator Template file (InputFileName.c_str()): OscillogramTemplate.root
Error in <TBufferFile::ReadClassBuffer>: Could not find the StreamerInfo for version 3 of the class TNamed, object skipped at offset 65
Error in <TBufferFile::CheckByteCount>: object of class TNamed read too few bytes: 2 instead of 28733
nCoarseCosz: 0

Adding the simple line shown above immediately solves it:

[...]$ `root-config --cxx --cflags` test.C `root-config --libs` ; ./a.out
Read Oscillator Template file (InputFileName): OscillogramTemplate.root
Read Oscillator Template file (InputFileName.c_str()): OscillogramTemplate.root
nCoarseCosz: 52

Hi @Wile_E_Coyote @pcanal
I did more tests with the help of a colleague who has T2K software access (he also communicated our findings to you as I understand):

We concluded these three changes on the ROOT5 source code make everything work on the machine:

  • We need to replace the file config/Makefile.linuxppc64gcc with this new one attached (I put it as text file to upload here):
    Makefile.linuxppc64gcc.txt (2.9 KB)

  • In “cint/cint/inc/G__ci.h” file, right before line 368 which contains “/* added by Fons Radamakers in 2000 Oct 2 */”, we need to add these to define __linux:

#if defined(__linux__) && defined(__GNUC__) && defined(__STRICT_ANSI__)
#   ifndef __linux
#      define __linux
#   endif
#endif
  • In “core/base/inc/RConfig.h” file, right before the line 61 which contains “#ifdef __linux”, we need to add the same __linux definition above.

Let me know if you will have a formal patch and I can test.

Wei

Life-sustaining patches have been pushed to the v5-34-00-patches branch. Please try to build and test everything from scratch again.

It builds fine and tests fine. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.