diff --git a/Dockerfile b/Dockerfile index b312d6b..edd51ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ - -FROM ubuntu:22.04 -LABEL ubuntu.version="22.04" -MAINTAINER Tom Eichlersmith +FROM ubuntu:24.04 +LABEL maintainer="Tom Eichlersmith , Tamas Almos Vami " +LABEL ubuntu.version="24.04" ARG NPROC=1 @@ -50,7 +49,10 @@ RUN install-ubuntu-packages \ sudo \ time \ util-linux \ - zsh + zsh \ + libx11-dev \ + libxmu-dev \ + && rm -rf /var/lib/apt/lists/* # Basic python support, necessary for the build steps. # @@ -68,10 +70,10 @@ RUN install-ubuntu-packages \ # # Adapted from acts-project/machines ############################################################################### -ENV __wget wget -q -O - +ENV __wget="wget -q -O -" ENV __untar_to="tar -xz --strip-components=1 --directory" ENV __untar="${__untar_to} src" -ENV __prefix /usr/local +ENV __prefix="/usr/local" # this directory is where folks should "install" code compiled with the container # i.e. folks should mount a local install directory to /externals so that the @@ -86,9 +88,8 @@ ENV CMAKE_PREFIX_PATH="${EXTERNAL_INSTALL_DIR}:${__prefix}" # Xerces-C # Used by Geant4 to parse GDML ################################################################################ -ENV XERCESC_VERSION="3.2.4" +ENV XERCESC_VERSION="3.3.0" LABEL xercesc.version=${XERCESC_VERSION} -#LABEL xercesc.version="3.2.4" RUN mkdir src &&\ ${__wget} http://archive.apache.org/dist/xerces/c/3/sources/xerces-c-${XERCESC_VERSION}.tar.gz |\ ${__untar} &&\ @@ -97,55 +98,38 @@ RUN mkdir src &&\ rm -rf src ############################################################################### -# PYTHIA6 -# -# Needed for GENIE. Needs to be linked with ROOT. +# LHAPDF # -# Looks complicated? Tell me about it. -# Core of what's done follows from here: -# https://root-forum.cern.ch/t/root-with-pythia6-and-pythia8/19211 -# (1) Download pythia6 build tarball from ROOT. Known to lead to a build that can work with ROOT. -# (2) Download the latest Pythia6 (6.4.2.8) from Pythia. Yes, it's still ancient. -# (3) Declare extern some definitions that need to be extern via sed. -# Compiler/linker warns. Hard-won solution. -# (4) Build with C and FORTRAN the various pieces. -# (5) Put everything in a directory in the install area, and cleanup. +# Needed for GENIE # -# (Ideally GENIE works with Pythia8? But not sure that works yet despite the adverts that it does.) -# +# - We disable the python subpackage because it is based on Python2 whose +# executable has been removed from Ubuntu 22.04. ############################################################################### -ENV PYTHIA_VERSION="6.428" -ENV PREVIOUS_PYTHIA_VERSION="6.416" -ENV PYTHIA_MAJOR_VERSION=6 -LABEL pythia.version=${PYTHIA_VERSION} -#"6.428" -# Pythia uses an un-dotted version file naming convention. To deal with that -# we need some string manipulation and exports that work best with bash -SHELL ["/bin/bash", "-c"] -#ENV PYTHIA_MAJOR_VERSION=$(awk '{print int($1) }' <<< ${PYTHIA_VERSION} ) -# export PYTHIA_MAJOR_VERSION=$(awk '{print int($1) }' <<< ${PYTHIA_VERSION} ) &&\ +LABEL lhapdf.version="6.5.5" +RUN mkdir src &&\ + ${__wget} https://lhapdf.hepforge.org/downloads/?f=LHAPDF-6.5.5.tar.gz |\ + ${__untar} &&\ + cd src &&\ + ./configure --disable-python --prefix=${__prefix} &&\ + make -j$NPROC install &&\ + cd ../ &&\ + rm -rf src + +############################################################################### +# PYTHIA8 +############################################################################### +RUN install-ubuntu-packages \ + rsync +LABEL pythia.version="8.313" RUN mkdir src && \ - export PYTHIA_VERSION_INTEGER=$(awk '{print $1*1000}' <<< ${PYTHIA_VERSION} ) &&\ - export PREVIOUS_PYTHIA_VERSION_INTEGER=$(awk '{print $1*1000}' <<< ${PREVIOUS_PYTHIA_VERSION} ) &&\ - ${__wget} https://root.cern.ch/download/pythia${PYTHIA_MAJOR_VERSION}.tar.gz | ${__untar} &&\ - wget --no-check-certificate https://pythia.org/download/pythia${PYTHIA_MAJOR_VERSION}/pythia${PYTHIA_VERSION_INTEGER}.f &&\ - mv pythia${PYTHIA_VERSION_INTEGER}.f src/pythia${PYTHIA_VERSION_INTEGER}.f && rm -rf src/pythia${PREVIOUS_PYTHIA_VERSION_INTEGER}.f &&\ - cd src/ &&\ - sed -i 's/int py/extern int py/g' pythia${PYTHIA_MAJOR_VERSION}_common_address.c && \ - sed -i 's/extern int pyuppr/int pyuppr/g' pythia${PYTHIA_MAJOR_VERSION}_common_address.c && \ - sed -i 's/char py/extern char py/g' pythia${PYTHIA_MAJOR_VERSION}_common_address.c && \ - echo 'void MAIN__() {}' >main.c && \ - gcc -c -fPIC -shared main.c -lgfortran && \ - gcc -c -fPIC -shared pythia${PYTHIA_MAJOR_VERSION}_common_address.c -lgfortran && \ - gfortran -c -fPIC -shared pythia*.f && \ - gfortran -c -fPIC -shared -fno-second-underscore tpythia${PYTHIA_MAJOR_VERSION}_called_from_cc.F && \ - gfortran -shared -Wl,-soname,libPythia${PYTHIA_MAJOR_VERSION}.so -o libPythia${PYTHIA_MAJOR_VERSION}.so main.o pythia*.o tpythia*.o &&\ - mkdir -p ${__prefix}/pythia${PYTHIA_MAJOR_VERSION} && cp -r * ${__prefix}/pythia${PYTHIA_MAJOR_VERSION}/ &&\ - cd ../ && rm -rf src &&\ - echo "${__prefix}/pythia${PYTHIA_MAJOR_VERSION}/" > /etc/ld.so.conf.d/pythia${PYTHIA_MAJOR_VERSION}.conf - -SHELL ["/bin/sh", "-c"] + ${__wget} https://pythia.org/download/pythia83/pythia8313.tgz | ${__untar} &&\ + cd src &&\ + ./configure --with-lhapdf6 --prefix=${__prefix} &&\ + make -j$NPROC install &&\ + cd ../ &&\ + rm -rf src + ############################################################################### # CERN's ROOT # Needed for GENIE and serialization within the Framework @@ -182,7 +166,6 @@ RUN install-ubuntu-packages \ libjpeg-dev \ liblz4-dev \ liblzma-dev \ - libpcre++-dev \ libpng-dev \ libx11-dev \ libxext-dev \ @@ -195,27 +178,26 @@ RUN install-ubuntu-packages \ srm-ifce-dev \ libgsl-dev # Necessary for GENIE -ENV ROOT_VERSION="6.22.08" +ENV ROOT_VERSION="6.34.04" LABEL root.version=${ROOT_VERSION} RUN mkdir src &&\ ${__wget} https://root.cern/download/root_v${ROOT_VERSION}.source.tar.gz |\ ${__untar} &&\ cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_INSTALL_PREFIX=${__prefix} \ -DCMAKE_INSTALL_LIBDIR=lib \ -Dgnuinstall=ON \ -Dgminimal=ON \ -Dasimage=ON \ + -Dgeom=ON \ -Dgdml=ON \ -Dopengl=ON \ -Dpyroot=ON \ -Dxrootd=OFF \ - -Dgsl_shared=ON \ -Dmathmore=ON \ - -Dpythia6=ON \ - -DPYTHIA6_LIBRARY=${__prefix}/pythia6/libPythia6.so \ + -Dpythia8=ON \ -B build \ -S src \ && cmake --build build --target install -j$NPROC &&\ @@ -223,8 +205,6 @@ RUN mkdir src &&\ ldconfig ENV ROOTSYS=${__prefix} ENV PYTHONPATH=${ROOTSYS}/lib:${PYTHONPATH} -ENV JUPYTER_PATH=${ROOTSYS}/etc/notebook:${JUPYTER_PATH} -ENV JUPYTER_CONFIG_DIR=${ROOTSYS}/etc/notebook:${JUPYTER_CONFIG_DIR} ENV CLING_STANDARD_PCH=none ############################################################################### @@ -271,6 +251,7 @@ ENV G4ABLADATA="${G4DATADIR}/G4ABLA3.0" ENV G4INCLDATA="${G4DATADIR}/G4INCL1.0" ENV G4ENSDFSTATEDATA="${G4DATADIR}/G4ENSDFSTATE1.2.3" ENV G4NEUTRONXSDATA="${G4DATADIR}/G4NEUTRONXS1.4" + ################################################################################ # Install Eigen headers into container # @@ -295,24 +276,31 @@ RUN mkdir src &&\ rm -rf src ############################################################################### -# LHAPDF +# Install HEPMC for use as in interface with GENIE # -# Needed for GENIE -# -# - We disable the python subpackage because it is based on Python2 whose -# executable has been removed from Ubuntu 22.04. ############################################################################### -ENV LHAPDF_VERSION="6.5.3" -LABEL lhapdf.version=${LHAPDF_VERSION} +ENV HEPMC3=3.3.0 +LABEL hepmc3.version="${HEPMC3}" RUN mkdir src &&\ - ${__wget} https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${LHAPDF_VERSION}.tar.gz |\ + ${__wget} http://hepmc.web.cern.ch/hepmc/releases/HepMC3-${HEPMC3}.tar.gz |\ ${__untar} &&\ - cd src &&\ - ./configure --disable-python --prefix=${__prefix} &&\ - make -j$NPROC install &&\ - cd ../ &&\ + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DHEPMC3_ENABLE_ROOTIO:BOOL=ON \ +# -DHEPMC3_ENABLE_PROTOBUFIO:BOOL=ON \ + -DHEPMC3_ENABLE_TEST:BOOL=OFF \ + -DHEPMC3_INSTALL_INTERFACES:BOOL=ON \ + -DHEPMC3_BUILD_STATIC_LIBS:BOOL=ON \ + -DHEPMC3_BUILD_DOCS:BOOL=OFF \ + -DHEPMC3_ENABLE_PYTHON:BOOL=ON \ + -DHEPMC3_PYTHON_VERSIONS=3.10 \ + -B src/build \ + -S src \ + &&\ + cmake --build src/build --target install -j$NPROC && \ rm -rf src + ############################################################################### # GENIE # @@ -344,18 +332,16 @@ RUN install-ubuntu-packages \ liblog4cpp5-dev \ libtool - -ENV GENIE_VERSION=3.02.00 -#ENV GENIE_REWEIGHT_VERSION=1_02_00 +LABEL genie.version=3.04.02 +ENV GENIE_VERSION=3_04_02-ldmx ENV GENIE=/usr/local/src/GENIE/Generator -#ENV GENIE_DOT_VERSION="$(sed 's,_,\.,g' <<< $GENIE_VERSION )" LABEL genie.version=${GENIE_VERSION} SHELL ["/bin/bash", "-c"] RUN mkdir -p ${GENIE} &&\ - export ENV GENIE_GET_VERSION="$(sed 's,\.,_,g' <<< $GENIE_VERSION )" &&\ - ${__wget} https://github.com/GENIE-MC/Generator/archive/refs/tags/R-${GENIE_GET_VERSION}.tar.gz |\ + #export ENV GENIE_GET_VERSION="$(sed 's,\.,_,g' <<< $GENIE_VERSION )" &&\ + ${__wget} https://github.com/wesketchum/Generator/archive/refs/tags/R-${GENIE_VERSION}.tar.gz |\ ${__untar_to} ${GENIE} &&\ cd ${GENIE} &&\ ./configure \ @@ -363,14 +349,26 @@ RUN mkdir -p ${GENIE} &&\ --disable-lhapdf5 \ --enable-gfortran \ --with-gfortran-lib=/usr/x86_64-linux-gnu/ \ - --disable-pythia8 \ - --with-pythia6-lib=${__prefix}/pythia6 \ + --disable-pythia6 \ + --enable-pythia8 \ + --with-pythia8-lib=${__prefix}/lib \ --enable-test \ + --enable-hepmc3 \ + --with-hepmc3-lib=/usr/local/lib \ + --with-hepmc3-inc=/usr/local/include \ && \ make -j$NPROC && \ make -j$NPROC install -SHELL ["/bin/sh", "-c"] +ENV GENIE_REWEIGHT_VERSION=1_04_00 +ENV GENIE_REWEIGHT=/usr/local/src/GENIE/Reweight +RUN mkdir -p ${GENIE_REWEIGHT} &&\ + #export ENV GENIE_REWEIGHT_GET_VERSION="$(sed 's,\.,_,g' <<< $GENIE_REWEIGHT_VERSION )" &&\ + ${__wget} https://github.com/GENIE-MC/Reweight/archive/refs/tags/R-${GENIE_REWEIGHT_VERSION}.tar.gz |\ + ${__untar_to} ${GENIE_REWEIGHT} &&\ + cd ${GENIE_REWEIGHT} &&\ + make -j$NPROC && \ + make -j$NPROC install ############################################################################### # Catch2 @@ -444,7 +442,7 @@ RUN ldconfig -v # Extra python packages for analysis ############################################################################### COPY ./python_packages.txt /etc/python_packages.txt -RUN python3 -m pip install --no-cache-dir --requirement /etc/python_packages.txt +RUN python3 -m pip install --no-cache-dir --break-system-packages --requirement /etc/python_packages.txt # Dependencies for LDMX-sw and/or the container environment RUN install-ubuntu-packages \ diff --git a/ldmx-env-init.sh b/ldmx-env-init.sh index 9ed9ef4..8c6f2ca 100644 --- a/ldmx-env-init.sh +++ b/ldmx-env-init.sh @@ -21,8 +21,8 @@ export PYTHONPATH="${LDMX_SW_INSTALL}/python:${LDMX_SW_INSTALL}/lib:${PYTHONPATH export PATH="${LDMX_SW_INSTALL}/bin:${PATH}" #add what we need for GENIE -export LD_LIBRARY_PATH="${GENIE}/lib:/usr/local/pythia6:${LD_LIBRARY_PATH}" -export PATH="${GENIE}/bin:${PATH}" +export LD_LIBRARY_PATH="${GENIE}/lib:${GENIE_REWEIGHT}/lib:/usr/local/pythia6:${LD_LIBRARY_PATH}" +export PATH="${GENIE}/bin:${GENIE_REWEIGHT}/bin:${PATH}" # Developer option: If a custom geant4 install is to be used, source the # environment script from that install diff --git a/python_packages.txt b/python_packages.txt index e71f538..1998e4c 100644 --- a/python_packages.txt +++ b/python_packages.txt @@ -1,28 +1,29 @@ -contourpy==1.0.6 -cycler==0.11.0 -Cython==0.29.32 -fonttools==4.38.0 -joblib==1.2.0 -kiwisolver==1.4.4 -llvmlite==0.39.1 -matplotlib==3.6.2 -mplhep==0.3.26 -mplhep-data==0.0.3 -numba==0.56.4 -numpy==1.21.5 -packaging==21.3 -pandas==1.5.2 -Pillow==9.3.0 -pip==22.0.2 -pyparsing==3.0.9 -python-dateutil==2.8.2 -pytz==2022.6 -scikit-learn==1.1.3 -scipy==1.9.3 -setuptools==59.6.0 -six==1.16.0 -threadpoolctl==3.1.0 -uhi==0.3.2 -uproot==4.3.7 -wheel==0.37.1 -xgboost==1.7.1 +contourpy +cycler +Cython +fonttools +joblib +kiwisolver +llvmlite +matplotlib +mplhep +mplhep-data +numba +numpy +packaging +pandas +Pillow +pip +pyparsing +python-dateutil +pytz +scikit-learn +scipy +setuptools +six +threadpoolctl +uhi +uproot +wheel +xgboost +pyhepmc