The goal of this project is to provide a stable containerized environment for reproducible simulation jobs levereging on the Geant4 and NVIDIA OptiX ray tracing capabilities.
Before starting, make sure you have the following prerequisites available and installed:
The installer script for the esi-shell
container is available directly at
bnlnpps.github.io/esi-shell/. It can be downloaded
and then made executable:
curl -Os https://bnlnpps.github.io/esi-shell/esi-shell && chmod u+x esi-shell
The esi-shell
environment can be used interactively by running the script:
./esi-shell
Once the container is up, you can execute the code relying on GPU functionality, e.g. run the available tests:
opticks-full-prepare
opticks-t
It is also possible to run any container command non-interactively:
./esi-shell "opticks-full-prepare && opticks-t"
Use the -h/--help
option to get a quick summary of available options and to learn how to pass
arguments to the underlying container, e.g.:
./esi-shell --help
./esi-shell -- -v $HOME/out:/tmp/results
If you plan to develop the code utilizing GPU capabilities, you will likely need to install NVIDIA OptiX. Place the downloaded file on the same path where you cloned github.com/BNLNPPS/esi-shell:
cd esi-shell
ls
... NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64.sh ...
Now, the esi-shell
image can be built locally
docker build -t esi-shell .
For local development with OptiX, install it on your host system. We recommend installing OptiX in
/usr/local/optix
but any other path will be as good:
export OPTIX_DIR=$HOME/optix
mkdir -p $OPTIX_DIR
./NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64.sh --prefix=$OPTIX_DIR
When running esi-shell
, make sure that the environment variable OPTIX_DIR
is configured to point
to the directory where OptiX is installed. If not set, the default path OPTIX_DIR=/usr/local/optix
will be mounted insdie the container at runtime.
If preferred, you can pull a tagged release from the registry and work with the images directly. The list of all tagged releases can be found here. Run the tagged image with the local NVIDIA OptiX installation, e.g.:
docker run --rm -it --gpus all -v /usr/local/optix:$OPTIX_DIR ghcr.io/bnlnpps/esi-shell:<tag>
One can get familiar with Opticks by running provided tests and examining the produced output. For example, in the properly setup environment do:
opticks/g4cx/tests/G4CXTest_raindrop.sh
python -i opticks/g4cx/tests/G4CXOpticks_setGeometry_Test.py
import plotly.graph_objects as go
tri = cf.sim.stree.mesh.G4_WATER_solid.tri
vtx = cf.sim.stree.mesh.G4_WATER_solid.vtx
m=go.Mesh3d(x=vtx.T[0], y=vtx.T[1], z=vtx.T[2], i=tri.T[0], j=tri.T[1], k=tri.T[2], color='green', opacity=0.2)
fig = go.Figure(data=[m])
fig.show()