Skip to content

A high performance framework for radiation therapy simulation and numerical solutions for kinetic equations.

License

Notifications You must be signed in to change notification settings

KiT-RT/kitrt_code

Repository files navigation

CI Coverage Status Documentation Status License: MIT

KiT-RT - an HPC Radio Therapy simulation framework

The KiT-RT (Kinetic Transport Solver for Radiation Therapy) framework is a high-performance open source platform for radiation transport. Its main focus is on radiotherapy planning in cancer treatment. To enable problem-specific method selection, the framework provides different deterministic solver types. This not only facilitates treatment planning, but also provides tools to investigate various research questions in the field of radiative transfer. This goal is supported by an easily extendable code structure that allows for straightforward implementation of additional methods and techniques.

The documentation can be found here. The preprint for the KiT-RT journal paper is available here.

Contents

What KiT-RT is capable of

Theory

A short description of kinetic theory can be found here.

Build

Required dependencies

  • Compiler with C++17 support
  • cmake >= v3.16
  • LAPACK
  • OpenMP
  • MPI
  • python3
  • VTK
  • git

Tensorflow installation

If you choose to enable the machine learning tools via the BUILD_ML option, you need to install the tensorflow C-API:

FILENAME=libtensorflow-cpu-linux-x86_64-2.7.0.tar.gz
wget -q --no-check-certificate https://storage.googleapis.com/tensorflow/libtensorflow/${FILENAME}
tar -C /usr/local -xzf ${FILENAME}
ldconfig /usr/local/lib

Python dependencies

  • pydicom
  • numpy
  • pygmsh version 6.1.1
  pip install pygmsh==6.1.1

(note that newer versions are not yet supported)

Obtain submodules

Note that an active internet connection is required for the first build in order to download the suitable versions of the required submodules! For the first build only, download all submodules:

git submodule update --init --recursive

Compile the code

In case of the make build system (available on most systems) run:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ../
make -j

Run

Execute the compiled binary by handing over a valid config file, e.g.:

./KiT-RT ../examples/linesource_SN.cfg

In order to run the code in parallel execute:

OMP_NUM_THREADS=N mpirun -np J ./KiT-RT ../examples/linesource_SN.cfg

with N equal to the number of shared memory threads and J equal to the number of distrubuted memory threads.


Unit Tests

After compiling the framework with:

cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON ../
make -j

Unit test can be run with:

make test

Docker

A preconfigured docker container can also be used to run the code. By running

docker run --rm -ti -v $(pwd):/home kitrt/test:latest

To use the tensorflow backend for neural network based entropy closures, please use the tensorflow equippend containter by running

docker run --rm -ti -v $(pwd):/home kitrt/test_ml:latest

from the current folder will be mounted to the docker container and the code can be executed without any of the required dependencies.

Bash scripts are provided in the folder tools/CI to get started with the docker environments. To start an interactive docker environment, execute

docker run -i -t --rm -v $(pwd)/../..:/mnt kitrt/test:latest /bin/bash

Tensorflow

To use the neural network based entropy closure, one needs to install the tensorflow C++ backend. Just use the following commands:

FILENAME=libtensorflow-cpu-linux-x86_64-2.7.0.tar.gz
wget -q --no-check-certificate https://storage.googleapis.com/tensorflow/libtensorflow/${FILENAME}
tar -C /usr/local -xzf ${FILENAME}
ldconfig /usr/local/lib

and for a gpu based version (you need supported hardware and gpu drivers, see here ):

FILENAME=libtensorflow-gpu-linux-x86_64-2.7.0.tar.gz
wget -q --no-check-certificate https://storage.googleapis.com/tensorflow/libtensorflow/${FILENAME}
tar -C /usr/local -xzf ${FILENAME}
ldconfig /usr/local/lib

Cite

@article{kitrt2023,
    title={KiT-RT: An extendable framework for radiative transfer and therapy},
    author={Kusch, Jonas and Schotth{\"o}fer, Steffen and Stammer, Pia and Wolters, Jannick and Xiao, Tianbai},
    journal={ACM Transactions on Mathematical Software},
    volume={49},
    number={4},
    pages={1--24},
    year={2023},
    publisher={ACM New York, NY}
}