forked from llnl/pynamic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsbatch_pynamic
More file actions
46 lines (36 loc) · 1.6 KB
/
sbatch_pynamic
File metadata and controls
46 lines (36 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
#SBATCH --job-name=pynamic_scaling
#SBATCH --account=csc266
#SBATCH --time=30:00
#SBATCH --nodes=19
#SBATCH --exclude=defiant19
#SBATCH --output=%j_pynamic_scaling.out
#SBATCH --error=%j_pynamic_scaling.err
RESULTS="pynamic_results_${SLURM_JOB_ID}.txt"
# Expand the job's node allocation into an ordered array
ALLNODES=($(scontrol show hostnames "$SLURM_JOB_NODELIST"))
printf "%-8s %-25s %-25s\n" "Nodes" "Import Time (s)" "Visit Time (s)" > "$RESULTS"
printf "%-8s %-25s %-25s\n" "-----" "---------------" "--------------" >> "$RESULTS"
for N in {1..19}; do
# Deterministically select the first N nodes from the allocation
SUBSET_ARR=("${ALLNODES[@]:0:$N}")
SUBSET=$(IFS=,; echo "${SUBSET_ARR[*]}")
SUM_IMPORT=0
SUM_VISIT=0
for RUN in 1 2 3 4 5; do
OUTPUT=$(srun --nodelist="$SUBSET" -N "$N" --ntasks-per-node 1 \
build/pynamic-mpi4py $(date +%s) 2>&1)
IMPORT_TIME=$(echo "$OUTPUT" | grep "module import time" | awk '{print $6}')
VISIT_TIME=$(echo "$OUTPUT" | grep "module visit time" | awk '{print $6}')
SUM_IMPORT=$(awk "BEGIN {print $SUM_IMPORT + $IMPORT_TIME}")
SUM_VISIT=$(awk "BEGIN {print $SUM_VISIT + $VISIT_TIME}")
echo " Run $RUN/5: N=$N | import=$IMPORT_TIME | visit=$VISIT_TIME"
done
AVG_IMPORT=$(awk "BEGIN {printf \"%.6f\", $SUM_IMPORT / 5}")
AVG_VISIT=$(awk "BEGIN {printf \"%.6f\", $SUM_VISIT / 5}")
printf "%-8s %-25s %-25s\n" "$N" "$AVG_IMPORT" "$AVG_VISIT" >> "$RESULTS"
echo "Done: N=$N | avg_import=$AVG_IMPORT | avg_visit=$AVG_VISIT"
done
echo ""
echo "=== Results ==="
cat "$RESULTS"