Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of HEPMC3 and GENIE Reweight to docker image #105

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
93 changes: 73 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,39 @@ RUN mkdir src && \
echo "${__prefix}/pythia${PYTHIA_MAJOR_VERSION}/" > /etc/ld.so.conf.d/pythia${PYTHIA_MAJOR_VERSION}.conf

SHELL ["/bin/sh", "-c"]
###############################################################################
# LHAPDF
#
# Needed for GENIE
#
# - We disable the python subpackage because it is based on Python2 whose
# executable has been removed from Ubuntu 22.04.
###############################################################################
LABEL lhapdf.version="6.5.4"
RUN mkdir src &&\
${__wget} https://lhapdf.hepforge.org/downloads/?f=LHAPDF-6.5.4.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.310"
RUN mkdir src && \
${__wget} https://pythia.org/download/pythia83/pythia8310.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
Expand Down Expand Up @@ -214,6 +247,7 @@ RUN mkdir src &&\
-Dxrootd=OFF \
-Dgsl_shared=ON \
-Dmathmore=ON \
-Dpythia8=ON \
-Dpythia6=ON \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove Pythia6? Is it still necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately still necessary :/ I know the GENIE team is working on it, but I think the Pythia6 dependency is buried deep, and they've not fully extricated it yet. I will double-check to be sure, but unfortunately it's a case where it looks like we need both.

-DPYTHIA6_LIBRARY=${__prefix}/pythia6/libPythia6.so \
-B build \
Expand Down Expand Up @@ -295,24 +329,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
#
Expand Down Expand Up @@ -344,32 +385,44 @@ 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.00
ENV GENIE_VERSION=3_04_00-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_GET_VERSION}.tar.gz |\
${__untar_to} ${GENIE} &&\
cd ${GENIE} &&\
./configure \
--enable-lhapdf6 \
--disable-lhapdf5 \
--enable-gfortran \
--with-gfortran-lib=/usr/x86_64-linux-gnu/ \
--disable-pythia8 \
--with-pythia6-lib=${__prefix}/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

ENV GENIE_REWEIGHT_VERSION=1_02_04
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_GET_VERSION}.tar.gz |\
# ${__wget} https://github.com/wesketchum/Reweight/archive/refs/tags/R-${GENIE_REWEIGHT_GET_VERSION}.tar.gz |\
${__untar_to} ${GENIE_REWEIGHT} &&\
cd ${GENIE_REWEIGHT} &&\
make -j$NPROC && \
make -j$NPROC install

SHELL ["/bin/sh", "-c"]

###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions ldmx-env-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions python_packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ uhi==0.3.2
uproot==4.3.7
wheel==0.37.1
xgboost==1.7.1
pyhepmc==2.13.4
Loading