Skip to content

Commit

Permalink
build Geant4 or DD if enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnaf-tahmid-chowdhury committed Dec 11, 2023
1 parent 13efae6 commit ff3ea55
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/actions/upstream-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ runs:
password: ${{ inputs.token }}

- name: Configure docker image tag
shell: bash
shell: bash -l {0}
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ inputs.ubuntu_version }}-${{ inputs.compiler}}-hdf5_${{ inputs.hdf5_version}}-moab_${{ inputs.moab_version }}
if ${{ inputs.geant4_version }} ; then
if [ ${{ inputs.geant4_version }} != "OFF" ] ; then
image_base_tag=${image_base_tag}-geant4_${{ inputs.geant4_version }}
GEANT4=ON
else
GEANT4=OFF
fi
if ${{ inputs.double_down_version }} ; then
if [ ${{ inputs.double_down_version }} != "OFF" ] ; then
image_base_tag=${image_base_tag}-double_down_${{ inputs.double_down_version }}
DOUBLE_DOWN=ON
else
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ jobs:
- name: Configure docker image tag and build arguments
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ matrix.ubuntu_version }}-${{ matrix.compiler}}-hdf5_${{ matrix.hdf5_version}}-moab_${{ matrix.moab_version }}
if ${{ matrix.geant4_version }}; then
if [ ${{ matrix.geant4_version }} != "OFF" ] ; then
image_base_tag=${image_base_tag}-geant4_${{ matrix.geant4_version }}
GEANT4=ON
else
GEANT4=OFF
fi
if ${{ matrix.double_down_version }}
if [ ${{ matrix.double_down_version }} != "OFF" ] ; then
image_base_tag=${image_base_tag}-double_down_${{ matrix.double_down_version }}
DOUBLE_DOWN=ON
else
Expand Down Expand Up @@ -131,10 +131,10 @@ jobs:
if: ${{ github.repository_owner == 'svalinn' }}
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ matrix.ubuntu_version }}-${{ matrix.compiler}}-hdf5_${{ matrix.hdf5_version}}-moab_${{ matrix.moab_version }}
if ${{ matrix.geant4_version }} ; then
if [ ${{ matrix.geant4_version }} != "OFF" ] ; then
image_base_tag=${image_base_tag}-geant4_${{ matrix.geant4_version }}
fi
if ${{ matrix.double_down_version }} ; then
if [ ${{ matrix.double_down_version }} != "OFF" ] ; then
image_base_tag=${image_base_tag}-double_down_${{ matrix.double_down_version }}
fi
echo "image_base_tag=${image_base_tag}" >> "$GITHUB_ENV"
Expand Down
105 changes: 58 additions & 47 deletions CI/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ ENV CXX=clang++
FROM compiler-${COMPILER} as external_deps

# accessing gloabl ARGs in build stage
ARG GEANT4
ARG GEANT4_VERSION
ARG EMBREE_VERSION
ARG install_dir
Expand All @@ -86,42 +87,25 @@ ENV geant4_tarball=${geant4_basename}.tar.gz
ENV geant4_build_dir=${build_dir}/geant4
ENV geant4_install_dir=${install_dir}/geant4

RUN mkdir -p ${geant4_build_dir}/build && \
cd ${geant4_build_dir} && \
wget https://gitlab.cern.ch/geant4/geant4/-/archive/v${GEANT4_VERSION}/${geant4_tarball} --no-check-certificate && \
tar -xzf ${geant4_tarball} && \
cd build && \
cmake ../${geant4_basename} \
-DCMAKE_INSTALL_RPATH=${geant4_install_dir}/lib \
-DCMAKE_INSTALL_PREFIX=${geant4_install_dir} \
-DGEANT4_USE_SYSTEM_EXPAT=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_C_COMPILER=${CC} \
-DBUILD_STATIC_LIBS=ON && \
make -j${CI_JOBS} && \
make install && \
cd && \
rm -rf ${geant4_build_dir}


ENV embree_install_dir=${install_dir}/embree
ENV embree_build_dir=${build_dir}/embree

# Clone and install Embree
RUN mkdir -p ${embree_build_dir}/build && \
cd ${embree_build_dir} && \
git clone -b ${EMBREE_VERSION} https://github.com/embree/embree && \
cd build && \
cmake ../embree -DCMAKE_INSTALL_PREFIX=${embree_install_dir} \
-DEMBREE_TASKING_SYSTEM=INTERNAL \
-DEMBREE_ISPC_SUPPORT=OFF \
-DEMBREE_TUTORIALS=OFF \
-DEMBREE_TBB_ROOT=/usr && \
make -j${CI_JOBS} && \
make -j${CI_JOBS} install && \
cd && \
rm -rf ${embree_build_dir}
RUN if [ "${GEANT4}" = "ON" ]; then \
mkdir -p ${geant4_build_dir}/build && \
cd ${geant4_build_dir} && \
wget https://gitlab.cern.ch/geant4/geant4/-/archive/v${GEANT4_VERSION}/${geant4_tarball} --no-check-certificate && \
tar -xzf ${geant4_tarball} && \
cd build && \
cmake ../${geant4_basename} \
-DCMAKE_INSTALL_RPATH=${geant4_install_dir}/lib \
-DCMAKE_INSTALL_PREFIX=${geant4_install_dir} \
-DGEANT4_USE_SYSTEM_EXPAT=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_C_COMPILER=${CC} \
-DBUILD_STATIC_LIBS=ON && \
make -j${CI_JOBS} && \
make install && \
cd && \
rm -rf ${geant4_build_dir} \
fi


FROM external_deps AS hdf5
Expand Down Expand Up @@ -158,6 +142,7 @@ FROM hdf5 AS moab
# accessing gloabl ARGs in build stage
ARG install_dir
ARG MOAB_VERSION
ARG DOUBLE_DOWN
ARG DOUBLE_DOWN_VERSION
ARG build_dir
ARG CI_JOBS
Expand Down Expand Up @@ -190,21 +175,47 @@ RUN mkdir -p ${moab_build_dir}/build && \
cd && \
rm -rf ${moab_build_dir}

ENV embree_install_dir=${install_dir}/embree
ENV embree_build_dir=${build_dir}/embree

# Clone and install Embree
# Required for Double-Down
RUN if [ "${DOUBLE_DOWN}" = "ON" ]; then \
mkdir -p ${embree_build_dir}/build && \
cd ${embree_build_dir} && \
git clone -b ${EMBREE_VERSION} https://github.com/embree/embree && \
cd build && \
cmake ../embree \
-DCMAKE_INSTALL_PREFIX=${embree_install_dir} \
-DEMBREE_TASKING_SYSTEM=INTERNAL \
-DEMBREE_ISPC_SUPPORT=OFF \
-DEMBREE_TUTORIALS=OFF \
-DEMBREE_TBB_ROOT=/usr && \
make -j${CI_JOBS} && \
make -j${CI_JOBS} install && \
cd && \
rm -rf ${embree_build_dir} \
fi

ENV double_down_build_dir=${build_dir}/double-down
ENV double_down_install_dir=${install_dir}/double-down

# Clone and install Double-Down
# performed after moab install as double-down requires moab
RUN mkdir -p ${double_down_build_dir}/build && \
cd ${double_down_build_dir} && \
git clone -b ${DOUBLE_DOWN_VERSION} --depth 1 https://github.com/pshriwise/double-down.git && \
cd build && \
cmake ../double-down \
-DMOAB_DIR=${moab_install_dir} \
-DCMAKE_INSTALL_PREFIX=${double_down_install_dir} \
-DEMBREE_DIR=${embree_install_dir} && \
make -j${CI_JOBS} && \
make -j${CI_JOBS} install
# Performed after moab and embree install as double-down requires moab and embree
RUN if [ "${DOUBLE_DOWN}" = "ON" ]; then \
mkdir -p ${double_down_build_dir}/build && \
cd ${double_down_build_dir} && \
git clone -b ${DOUBLE_DOWN_VERSION} --depth 1 https://github.com/pshriwise/double-down.git && \
cd build && \
cmake ../double-down \
-DMOAB_DIR=${moab_install_dir} \
-DCMAKE_INSTALL_PREFIX=${double_down_install_dir} \
-DEMBREE_DIR=${embree_install_dir} && \
make -j${CI_JOBS} && \
make -j${CI_JOBS} install && \
cd && \
rm -rf ${double_down_build_dir} \
fi


FROM moab as dagmc
Expand Down

0 comments on commit ff3ea55

Please sign in to comment.