Download hmc/reference/scripts/launch-qsiprep.sh from neurodeskorg/webapps: direct link, hf CLI and curl.
- Browser
- Download file 871 Bytes
-
https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/launch-qsiprep.sh
- Command line
-
hf download hf://datasets/neurodeskorg/webapps/hmc/reference/scripts/launch-qsiprep.sh
-
curl -L -o launch-qsiprep.sh https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/launch-qsiprep.sh
871 Bytes
| # Launch run-qsiprep.sh NAME [args] in a memory-capped scope, in the background. | |
| # Cap = min(12G, MemAvailable - 4G), read just before the launch. Refuse below 6G. | |
| set -euo pipefail | |
| NAME=$1 | |
| AVAIL_KB=$(awk '/MemAvailable/ {print $2}' /proc/meminfo) | |
| AVAIL_G=$((AVAIL_KB / 1024 / 1024)) | |
| CAP=$((AVAIL_G - 4)) | |
| if [ "$CAP" -gt 12 ]; then CAP=12; fi | |
| if [ "$CAP" -lt 6 ]; then | |
| echo "MemAvailable ${AVAIL_G}G is too low (cap ${CAP}G); not launching" >&2 | |
| exit 1 | |
| fi | |
| LOG=/var/tmp/dwi-hmc/runs/qsiprep-$NAME.driver.log | |
| echo "MemAvailable_kB=$AVAIL_KB cap=${CAP}G" > "$LOG" | |
| export MEMCAP="${CAP}G (MemAvailable ${AVAIL_KB} kB)" | |
| export TMPDIR=/var/tmp/dwi-tmp | |
| nohup systemd-run --user --scope -q --unit="qsiprep-$NAME" -p MemoryMax="${CAP}G" -p MemorySwapMax=0 \ | |
| /var/tmp/dwi-hmc/scripts/run-qsiprep.sh "$@" >> "$LOG" 2>&1 & | |
| echo "pid=$! cap=${CAP}G log=$LOG" | |