-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.sh
executable file
·30 lines (25 loc) · 885 Bytes
/
runner.sh
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
#!/bin/bash
spack load [email protected]%[email protected]
np=4
device=""
export OMP_NUM_THREADS=$(($(nproc --all) / 2 / $np)) # 2 threads for hyperthreading $(($(nproc --all) / 2 / $np))
# set device
if [ -z "$2" ]; then
device="cpu"
else
device="$2"
fi
# set batch size
if [ -z "$3" ]; then
batch_size=1
else
batch_size=$3
fi
echo "Running $1 with $np processes and $OMP_NUM_THREADS threads per process"
echo "Using device $device"
# print running command
# bind-to none is for mpi to access all cores
echo "mpirun -np $np --bind-to none -x OMP_NUM_THREADS \
python $1 --model ./model/clip-vit-base-patch32 --dataset ./dataset/natural_list_2021 --device $device --batch-size $batch_size"
mpirun -np $np --bind-to none -x OMP_NUM_THREADS python "$1" --model ./model/clip-vit-base-patch32 \
--dataset ./dataset/natural_list_2021 --device $device --batch-size $batch_size