Buliding g4bench2: unable to find G4tasking

Geant4 Version: 11.2.0
Operating System: Ubuntu 22.04 on WSL2
Compiler/Version: gcc 11.4.0
CMake Version: cmake 3.22.1

I would like to run a Geant4 app that I can use to get a feel for what performance can be achieved on the computer it is running on. To that end, I found the g4bench (for geant4 < 11.0.0), and g4bench2 (for geant4 ≥ 11.0.0) projects. I downloaded it and tried to build it. I ran into an error that it could not find G4tasking though I did compile Geant4 with the multi-threading feature turned on. I must have done something silly like point the compiler to a wrong directory. Though, if so, I am not sure where or what location would be correct. Please advise.

# Download the source code for the G4Bench2 application
user@machine:~$ cd downloads
user@machine:~/downloads$ git clone --depth=1 https://github.com/koichi-murakami/g4bench2.git
user@machine:~/downloads$ cd g4bench2
user@machine:~/downloads/g4bench2$ mkdir build
user@machine:~/downloads/g4bench2$ mkdir install

# Configure the build (aka compilation) files
user@machine:~/downloads/g4bench2$ ./configure --prefix=/home/ali/downloads/g4bench2/install --with-geant4-dir=/usr/local/include/Geant4 --with-build-dir=/home/ali/downloads/g4bench2/build --disable-vis --enable-opt --disable-debug

# make (aka compile) the build files
user@machine:~/downloads/g4bench2$ make

# This is where I got the following message.
# I am awaiting approval for my geant4 forum application so I can ask about advise to proceed.
# I am sure it is something simple/stupid on my part.
[  2%] Building CXX object ecal/CMakeFiles/ecal.dir/appbuilder.cc.o
[  4%] Building CXX object ecal/CMakeFiles/ecal.dir/ecalgeom.cc.o
[  7%] Building CXX object ecal/CMakeFiles/ecal.dir/main.cc.o
[  9%] Building CXX object ecal/CMakeFiles/ecal.dir/__/common/calscorer.cc.o
[ 12%] Building CXX object ecal/CMakeFiles/ecal.dir/__/common/eventaction.cc.o
[ 14%] Building CXX object ecal/CMakeFiles/ecal.dir/__/common/g4environment.cc.o
[ 17%] Building CXX object ecal/CMakeFiles/ecal.dir/__/common/particlegun.cc.o
[ 19%] Building CXX object ecal/CMakeFiles/ecal.dir/__/common/runaction.cc.o
[ 21%] Building CXX object ecal/CMakeFiles/ecal.dir/__/common/stepaction.cc.o
[ 24%] Building CXX object ecal/CMakeFiles/ecal.dir/__/util/jsonparser.cc.o
[ 26%] Building CXX object ecal/CMakeFiles/ecal.dir/__/util/stopwatch.cc.o
[ 29%] Building CXX object ecal/CMakeFiles/ecal.dir/__/util/timehistory.cc.o
[ 31%] Linking CXX executable ecal
/usr/bin/ld: cannot find -lG4tasking: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [ecal/CMakeFiles/ecal.dir/build.make:273: ecal/ecal] Error 1
make[1]: *** [CMakeFiles/Makefile2:152: ecal/CMakeFiles/ecal.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Here is the output of geant4-config --features to show the setup options.

Known Features:
 staticlibs[no]
 multithreading[yes]
 smartstack[no]
 php_as_hp[no]
 clhep[yes]
 expat[no]
 zlib[yes]
 gdml[no]
 ptl[yes]
 usolids[no]
 freetype[no]
 hdf5[no]
 g3tog4[no]
 qt[yes]
 qt3d[yes]
 motif[no]
 raytracer-x11[yes]
 opengl-x11[yes]
 openinventor[no]
 vtk[no]

As this is an external project, it would be best to raise an Issue on the project’s GitHub to report the problem there. From a quick look, I’d guess it’s to do with the use of a custom FindGeant4.cmake module instead of using Geant4’s installed Geant4Config.cmake system. In the former, the library names are hardcoded in and probably hasn’t been updated to account for G4tasking being merged into other libraries in 11.1.

Apologies for the delay! I did not want to leave this thread hanging.

I was able to find the following note via a search on Github. So, like you say, it is an issue of the G4tasking being merged into other libraries.

https://github.com/Geant4/geant4/blob/860a…63b2/cmake/History#L250

249 ## 2022-03-28 Ben Morgan (cmake-V11-00-18)
250 - Remove retired G4tasking library from configuration files

Turns out that removing that reference was not enough of a fix. The program would compile and start to run the simulations. Then it would suddenly error out because it could not find the data files. It turns out that GEANT4 installs the data files into folders with version numbers at the end while this benchmarking program assumes no version numbers at the end, eg G4ABLA3.3 vs G4ABLA. So one can just copy or symlink the folders.

With that issue fixed, I was able to compile, install, and run the benchmarking program!

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