Skip to content

Commit

Permalink
Merge pull request #407 from dkuegler/fix/slurm/memory-limits
Browse files Browse the repository at this point in the history
Fix memory limitation and subject/case globbing on slurm script
  • Loading branch information
dkuegler committed Dec 14, 2023
2 parents c015316 + 217251d commit aa70983
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Tutorial
Docker/Dockerfile*
*.txt
venv
/srun_fastsurfer.sh
28 changes: 23 additions & 5 deletions srun_fastsurfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ EOF
# voxel size of the image, here we use values proven to work for 0.7mm (and also 0.8 and 1m)
mem_seg_cpu=10 # in GB, seg on cpu, actually required: 9G
mem_seg_gpu=7 # in GB, seg on gpu, actually required: 6G
mem_surf_parallel=16 # in GB, hemi in parallel
mem_surf_noparallel=14 # in GB, hemi in series
num_cpus_surf=2 # base number of cpus to use for surfaces (doubled if --parallel)
mem_surf_parallel=20 # in GB, hemi in parallel
mem_surf_noparallel=18 # in GB, hemi in series
num_cpus_surf=1 # base number of cpus to use for surfaces (doubled if --parallel)

do_parallel="false"

Expand Down Expand Up @@ -376,8 +376,8 @@ then
if [[ "$do_parallel" == "true" ]]; then echo "--parallel"; fi
for p in "${POSITIONAL_FASTSURFER[@]}"
do
if [[ "$p" = --* ]]; then printf "\n%s" "$p";
else printf " %s" '$p';
if [[ "$p" == --* ]]; then printf "\n%s" "$p";
else printf " %s" "$p";
fi
done
echo ""
Expand Down Expand Up @@ -450,6 +450,24 @@ else
fi
num_cases=$(echo "$cases" | wc -l)

if [[ "$num_cases" -lt 1 ]] || [[ -z "$cases" ]]
then
wait
echo "WARNING: No cases found using the parameters provided. Aborting job submission!"
if [[ "$submit_jobs" == "true" ]] && [[ "$do_cleanup" == "true" ]]
then
echo "Cleaning temporary work directory!"
rm -R "$hpc_work/images"
rm -R "$hpc_work/scripts"
if [[ "$delete_hpc_work" == "false" ]]
then
rm -R "$hpc_work"
fi
fi
exit 0
fi


if [[ "$submit_jobs" != "true" ]]
then
echo "Copying singularity image and scripts..."
Expand Down
2 changes: 1 addition & 1 deletion stools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function read_cases ()
{ pushd "$1" > /dev/null || (echo "Could not go to $1" && exit 1)} >&2
# pattern without fixed postfixes, e.g. */mri/orig.mgz -> *
no_fixed_postfix="${2/%\/[^*{[]*}"
for file_match in ./$2; do
for file_match in $(eval echo "./$2"); do
if [[ -e "$file_match" ]]
then
file_match="${file_match/#.\/}"
Expand Down

0 comments on commit aa70983

Please sign in to comment.