23 lines
418 B
Bash
23 lines
418 B
Bash
|
CONFIG_DIR=$1
|
||
|
MAX_JOBS=${3:-3}
|
||
|
SLEEP=${4:-1}
|
||
|
MAIN=${5:-main}
|
||
|
GPU=${6:-0}
|
||
|
|
||
|
(
|
||
|
trap 'kill 0' SIGINT
|
||
|
CUR_JOBS=0
|
||
|
for CONFIG in "$CONFIG_DIR"/*.yaml; do
|
||
|
if [ "$CONFIG" != "$CONFIG_DIR/*.yaml" ]; then
|
||
|
((CUR_JOBS >= MAX_JOBS)) && wait -n
|
||
|
export CUDA_VISIBLE_DEVICES=$GPU
|
||
|
python3 $MAIN.py --explaining_cfg $CONFIG &
|
||
|
echo $CONFIG
|
||
|
sleep $SLEEP
|
||
|
((++CUR_JOBS))
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
wait
|
||
|
)
|