diff --git a/README.md b/README.md index ef4a7fe..f57af73 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![GitHub Stars](https://img.shields.io/github/stars/KiT-RT/CharmKiT)](https://github.com/KiT-RT/CharmKiT/stargazers) -[![Tests](https://github.com/KiT-RT/CharmKiT/actions/workflows/tests.yml/badge.svg)](https://github.com/KiT-RT/CharmKiT/actions/workflows/tests.yml) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![GitHub Stars](https://img.shields.io/github/stars/KiT-RT/charm_kit)](https://github.com/KiT-RT/charm_kit/stargazers) +[![Tests](https://github.com/KiT-RT/charm_kit/actions/workflows/tests.yml/badge.svg)](https://github.com/KiT-RT/charm_kit/actions/workflows/tests.yml) # CharmKiT: A wrapper for KiT-RT to conduct simulation sweeps fast @@ -30,8 +30,8 @@ Preliminaries: 2. Clone the CharmKiT repository: ```bash - git clone git@github.com:KiT-RT/CharmKiT.git - cd CharmKiT + git clone git@github.com:KiT-RT/charm_kit.git + cd charm_kit ``` 3. Install Poetry and create the project environment: diff --git a/update_kitrt.sh b/update_kitrt.sh new file mode 100755 index 0000000..4f0e753 --- /dev/null +++ b/update_kitrt.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -euo pipefail + +KITRT_REPO_URL="${KITRT_REPO_URL:-git@github.com:KiT-RT/kitrt_code.git}" +KITRT_CONTAINER_RUNTIME="${KITRT_CONTAINER_RUNTIME:-singularity}" + +has_cuda_gpu() { + if ! command -v nvidia-smi >/dev/null 2>&1; then + return 1 + fi + nvidia-smi -L >/dev/null 2>&1 +} + +cd kitrt_code +git remote set-url origin "${KITRT_REPO_URL}" +git fetch origin + +default_branch="$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's#^origin/##' || true)" +if [ -z "${default_branch}" ]; then + default_branch="$(git remote show origin | sed -n '/HEAD branch/s/.*: //p' | head -n 1)" +fi +if [ -z "${default_branch}" ]; then + default_branch="$(git rev-parse --abbrev-ref HEAD)" +fi + +git checkout "${default_branch}" +git pull --ff-only origin "${default_branch}" +git submodule update --init --recursive + +cd tools/singularity +chmod +x install_kitrt_singularity.sh install_kitrt_singularity_cuda.sh + +"${KITRT_CONTAINER_RUNTIME}" exec kit_rt.sif ./install_kitrt_singularity.sh + +if has_cuda_gpu && [ -f kit_rt_MPI_cuda.sif ]; then + "${KITRT_CONTAINER_RUNTIME}" exec --nv kit_rt_MPI_cuda.sif ./install_kitrt_singularity_cuda.sh +fi + +cd ../../../