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

feat: update opticks installation procedure #110

Merged
merged 6 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ jobs:
- name: Set up docker
uses: docker/setup-buildx-action@v3

- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ env.IMAGE_NAME }}:${{ env.TAG }}
load: true
push: true
cache-from: |
type=local,src=/home/runner/.buildx-cache
type=registry,ref=${{ env.IMAGE_NAME }}:latest
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "opticks"]
path = opticks
url = https://github.com/psilib/opticks.git
url = https://github.com/bnlnpps/esi-opticks.git
70 changes: 58 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ARG DEBIAN_FRONTEND=noninteractive
# Install Spack package manager
RUN apt update \
&& apt install -y build-essential ca-certificates coreutils curl environment-modules gfortran git gpg lsb-release python3 python3-distutils python3-venv unzip zip \
libglm-dev libglfw3-dev libimgui-dev libglew-dev libglu1-mesa-dev \
libssl-dev python-is-python3 \
cuda-nvcc-11-8 libcurand-dev-11-8 \
libxinerama-dev libxcursor-dev libxi-dev \
Expand All @@ -23,14 +22,21 @@ RUN echo "source /opt/spack/share/spack/setup-env.sh" > /etc/profile.d/z09_sourc

SHELL ["/bin/bash", "-l", "-c"]

RUN <<EOF
spack install geant4
spack install boost+system+program_options+regex+filesystem
spack install cmake
spack install nlohmann-json
spack uninstall -f -y g4ndl
spack clean -a
EOF
RUN spack install geant4 \
&& spack uninstall -f -y g4ndl \
&& spack clean -a

RUN spack install boost+system+program_options+regex+filesystem \
&& spack install cmake \
&& spack install nlohmann-json \
&& spack clean -a

RUN spack install mesa ~llvm \
&& spack install glew \
&& spack install glfw \
&& spack install glm \
&& spack install glu \
&& spack clean -a

# Strip all the binaries
#RUN find -L /spack/opt/spack -type f -exec readlink -f '{}' \; | xargs file -i | grep 'charset=binary' | grep 'x-executable\|x-archive\|x-sharedlib' | awk -F: '{print $1}' | xargs strip -S
Expand All @@ -54,9 +60,15 @@ RUN sed -i 's/ autoload: direct/ autoload: none/g' /opt/spack/etc/s
RUN spack module tcl refresh -y
RUN cp -r /opt/spack/share/spack/modules/linux-ubuntu22.04-x86_64_v3 /opt/modules
RUN echo "module use --append /opt/modules" >> /etc/profile.d/z10_load_spack_modules.sh
RUN spack module tcl loads geant4 xerces-c clhep boost cmake nlohmann-json >> /etc/profile.d/z10_load_spack_modules.sh
RUN spack module tcl loads geant4 xerces-c clhep boost cmake mesa glew glfw glm glu nlohmann-json >> /etc/profile.d/z10_load_spack_modules.sh
RUN rm -fr /opt/spack/share/spack/modules/$linux-ubuntu22.04-x86_64_v3

RUN mkdir -p /opt/bcm && curl -sL https://github.com/boost-cmake/bcm/archive/refs/heads/master.tar.gz | tar -xz --strip-components 1 -C /opt/bcm \
&& cmake -B /tmp/build/bcm -S /opt/bcm && cmake --build /tmp/build/bcm --target install

RUN mkdir -p /opt/plog && curl -sL https://github.com/SergiusTheBest/plog/archive/refs/tags/1.1.10.tar.gz | tar -xz --strip-components 1 -C /opt/plog \
&& cmake -B /tmp/build/plog -S /opt/plog && cmake --build /tmp/build/plog --target install

# Set up non-interactive shells by sourcing all of the scripts in /et/profile.d/
RUN cat <<"EOF" > /etc/bash.nonint
if [ -d /etc/profile.d ]; then
Expand All @@ -81,10 +93,11 @@ ENV OPTICKS_CUDA_PREFIX=/usr/local/cuda
ENV OPTICKS_OPTIX_PREFIX=${OPTIX_DIR}
ENV OPTICKS_COMPUTE_CAPABILITY=89
ENV LD_LIBRARY_PATH=${OPTICKS_PREFIX}/lib:${LD_LIBRARY_PATH}
ENV PATH=${OPTICKS_PREFIX}/lib:${PATH}
ENV PATH=${OPTICKS_PREFIX}/bin:${OPTICKS_PREFIX}/lib:${PATH}
ENV NVIDIA_DRIVER_CAPABILITIES=graphics,compute,utility
ENV VIRTUAL_ENV_DISABLE_PROMPT=1
ENV TMP=/tmp
ENV CMAKE_PREFIX_PATH=${OPTICKS_PREFIX}

WORKDIR $ESI_DIR

Expand All @@ -105,5 +118,38 @@ COPY <<-"EOF" /etc/profile.d/z20_opticks.sh
EOF

RUN mkdir -p $OPTIX_DIR && ./NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64.sh --skip-license --prefix=$OPTIX_DIR
RUN opticks-full

RUN cmake -S opticks/okconf -B $OPTICKS_PREFIX/build/okconf -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/okconf --parallel $(nproc) --target install

RUN cmake -S opticks/sysrap -B $OPTICKS_PREFIX/build/sysrap -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/sysrap --parallel $(nproc) --target install

RUN cmake -S opticks/ana -B $OPTICKS_PREFIX/build/ana -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/ana --parallel $(nproc) --target install

RUN cmake -S opticks/analytic -B $OPTICKS_PREFIX/build/analytic -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/analytic --parallel $(nproc) --target install

RUN cmake -S opticks/bin -B $OPTICKS_PREFIX/build/bin -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/bin --parallel $(nproc) --target install

RUN cmake -S opticks/CSG -B $OPTICKS_PREFIX/build/CSG -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/CSG --parallel $(nproc) --target install

RUN cmake -S opticks/qudarap -B $OPTICKS_PREFIX/build/qudarap -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/qudarap --parallel $(nproc) --target install

RUN cmake -S opticks/CSGOptiX -B $OPTICKS_PREFIX/build/CSGOptiX -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX -DCMAKE_BUILD_TYPE=Debug \
&& cmake --build $OPTICKS_PREFIX/build/CSGOptiX --parallel $(nproc) --target install

RUN cmake -S opticks/gdxml -B $OPTICKS_PREFIX/build/gdxml -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/gdxml --parallel $(nproc) --target install

RUN cmake -S opticks/u4 -B $OPTICKS_PREFIX/build/u4 -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/u4 --parallel $(nproc) --target install

RUN cmake -S opticks/g4cx -B $OPTICKS_PREFIX/build/g4cx -DCMAKE_MODULE_PATH=$OPTICKS_HOME/cmake/Modules -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX \
&& cmake --build $OPTICKS_PREFIX/build/g4cx --parallel $(nproc) --target install

RUN rm -fr $OPTIX_DIR/* $ESI_DIR/NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64.sh
16 changes: 14 additions & 2 deletions tests/test_opticks.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#!/usr/bin/env -S bash -l
#!/usr/bin/env bash

set -e

HOME=${HOME/\/root/$ESI_DIR}

opticks-full-prepare
opticks-t
ctest --test-dir $OPTICKS_PREFIX/build/okconf
ctest --test-dir $OPTICKS_PREFIX/build/sysrap -E STTFTest
ctest --test-dir $OPTICKS_PREFIX/build/ana
ctest --test-dir $OPTICKS_PREFIX/build/analytic
ctest --test-dir $OPTICKS_PREFIX/build/bin
ctest --test-dir $OPTICKS_PREFIX/build/CSG -E "CSGNodeTest|CSGPrimSpecTest|CSGPrimTest|CSGFoundryTest|CSGFoundry_getCenterExtent_Test|CSGFoundry_findSolidIdx_Test|CSGNameTest|CSGTargetTest|CSGTargetGlobalTest|CSGFoundry_MakeCenterExtentGensteps_Test|CSGFoundry_getFrame_Test|CSGFoundry_getFrameE_Test|CSGFoundry_getMeshName_Test|CSGFoundryLoadTest|CSGQueryTest|CSGSimtraceTest|CSGSimtraceRerunTest|CSGSimtraceSampleTest|CSGCopyTest"
ctest --test-dir $OPTICKS_PREFIX/build/qudarap -E "QSimTest|QOpticalTest|QSim_Lifecycle_Test|QSimWithEventTest"
ctest --test-dir $OPTICKS_PREFIX/build/CSGOptiX -E CSGOptiXRenderTest
ctest --test-dir $OPTICKS_PREFIX/build/gdxml
ctest --test-dir $OPTICKS_PREFIX/build/u4 -E "U4GDMLReadTest|U4RandomTest|U4TraverseTest"
ctest --test-dir $OPTICKS_PREFIX/build/g4cx -E G4CXRenderTest