Ubuntu 18.04 LTS (used under Windows WSL) Geant4-10.6.p02 gcc 7.5.0 GNU Make 4.1 cmake version 3.10.2
Hello,
I used to use Geant4 v10.6.2 in Ubuntu under WSL and but now changed PC and I can’t get to build it even though I follow the same process as before.
Once running
cd geant4.10.06.p02-build/
cmake -DCMAKE_INSTALL_PREFIX=../geant4.10.06.p02-install -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_QT=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON ../geant4.10.06.p02-source
I get
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_TLS
-- Performing Test HAVE_TLS - Success
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version "2.2.5")
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Configuring download of missing dataset G4NDL (4.6)
-- Configuring download of missing dataset G4EMLOW (7.9.1)
-- Configuring download of missing dataset PhotonEvaporation (5.5)
-- Configuring download of missing dataset RadioactiveDecay (5.4)
-- Configuring download of missing dataset G4PARTICLEXS (2.1)
-- Configuring download of missing dataset G4PII (1.3)
-- Configuring download of missing dataset RealSurface (2.1.1)
-- Configuring download of missing dataset G4SAIDDATA (2.0)
-- Configuring download of missing dataset G4ABLA (3.1)
-- Configuring download of missing dataset G4INCL (1.0)
-- Configuring download of missing dataset G4ENSDFSTATE (2.2)
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- The following Geant4 features are enabled:
GEANT4_BUILD_CXXSTD: Compiling against C++ Standard '11'
GEANT4_BUILD_MULTITHREADED: Build multithread enabled libraries
GEANT4_BUILD_TLS_MODEL: Building with TLS model 'initial-exec'
GEANT4_USE_SYSTEM_EXPAT: Using system EXPAT library
GEANT4_USE_QT: Build Geant4 with Qt support
GEANT4_USE_OPENGL_X11: Build Geant4 OpenGL driver with X11 support
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/d/Linux_Software/GEANT4/geant4.10.06.p02-build
which seems OK to me.
Now, when going for sudo make -j4 install all goes well until G4Processes. Every time make reaches G4Processes, it seems to hang and not progress at all
[ 27%] Building CXX object source/digits_hits/CMakeFiles/G4digits_hits.dir/utils/src/G4VScoreWriter.cc.o
[ 27%] Building CXX object source/digits_hits/CMakeFiles/G4digits_hits.dir/utils/src/G4VScoringMesh.cc.o
[ 27%] Linking CXX shared library ../../BuildProducts/lib/libG4digits_hits.so
[ 27%] Built target G4digits_hits
Scanning dependencies of target G4processes
To understand what’s going on, I then try sudo strace -p <makepid> which shows me that make is trapped inside an infinite loop of not finding specific files. Below I have attached part of the output i get strace_output.txt (709.1 KB)
It seems that make is looking for files that are not included inside the source folder, which seems strange. Does anyone have an idea what is going on or could give me a tip on what to try?
Thank you very much,
Alex
Could you try and isolate where the infinite loop is happening please? I think there’s a lot of “correct” lookup in the report as the compiler goes through a list of things needed to be included, and it then goes through the paths configured to search for them. So isolating the actual file causing the loop will be needed (if that indeed is what’s causing things).
Do you have any additional environment settings for CMake, GCC etc?
Hi @bmorgan and thank you for taking a look at this.
Apologies for the term “infinite loop” and “hanging”. It is clear, as you observed, that this is not what’s happening here. The compiler is looking up things it is supposed to be.
After your response, I started building v10.7.02 and let my machine to see if Scanning dependencies of target G4processes will ever complete and it did after 4 hours and then it started building the target. The same searches took place for the rest targets as well but these were smaller directories so did not take such a long time.
I ran make in single-threaded mode.
I am not sure why that happens. Maybe my machine is making redundant searches? or it is slow (intel i5 2.4GhZ)?
Regarding my gcc configuration, gcc -v -E -x c++ - < /dev/null outputs
I changed the building directory from /mnt/ to $HOME and building is fast as a lightning! Built it in 20 mins.
It seems all these recursive accesses were very time-consuming for WSL.
That is interesting since in my previous machine I had an AMD CPU (roughly speaking equivalent to my current i5 CPU) and working with a Geant4 installation in /mnt/ was sufficiently fast.
I am aware that the Geant4 Collaboration is not officially supporting WSL systems but thank you for the help.
Maybe we can change the title of this post to something more representative of the problem I described.
Hi @AlexAerPhys, many thanks for the detailed info - whilst we don’t officially support WSL as you say, feedback like this is valuable both for us and other users of this system!
I don’t see anything amiss in your environment settings, so I think that’s fine. I don’t have recent WSL experience, but a very quick search suggested there may be some I/O performance issues with /mnt (e.g. this post on StackOverflow). That might offer some ways to mitigate things. G4processes is the largest component of Geant4, so file lookups for #includes will expose any I/O issues.
Good idea on changing the title - would “Slow Geant4 build on WSL due to I/O issues” be o.k. for you?
The G4processes library is the largest library in all of Geant4. It can take well over half the total time required to build the package. On my MacBook, it’s typically about an hour. If I do the build on our compute cluster with a single thread, it can be three to four hours (because of contention for the networked filesystem).