mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 22:38:48 +08:00
fixed logic for finding/distributing across GPUS
This commit is contained in:
1 parent
71454a80b9
commit
1bf6d02900
1 file changed
+29
-5
@@ -1,14 +1,39 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DATASETS=("mic" "ficus" "chair" "hotdog" "materials" "drums" "ship" "lego")
|
# Deal with gpu's. If passed in, use those.
|
||||||
GPU_IDX=1
|
GPU_IDX=("$@")
|
||||||
|
if [ -z "$GPU_IDX" ]; then
|
||||||
|
echo "no gpus set... finding available gpus"
|
||||||
|
# Find available devices
|
||||||
|
num_device=$(nvidia-smi --query-gpu=name --format=csv,noheader | wc -l)
|
||||||
|
START=0
|
||||||
|
END=${num_device}-1
|
||||||
|
GPU_IDX=()
|
||||||
|
|
||||||
|
for (( id=$START; id<$END; id++ )); do
|
||||||
|
free_mem=$(nvidia-smi --query-gpu=memory.free --format=csv -i $id | grep -Eo [0-9]+)
|
||||||
|
if [[ $free_mem -gt 10000 ]]; then
|
||||||
|
GPU_IDX+=( $id )
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
echo available gpus... ${GPU_IDX[@]}
|
||||||
|
|
||||||
|
DATASETS=("mic" "ficus" "chair" "hotdog" "materials" "drums" "ship" "lego")
|
||||||
date
|
date
|
||||||
now=$(date)
|
now=$(date)
|
||||||
tag=$(date +'%m-%d-%Y')
|
tag=$(date +'%m-%d-%Y')
|
||||||
|
idx=0
|
||||||
|
len=${#GPU_IDX[@]}
|
||||||
|
((len=len-1))
|
||||||
|
|
||||||
for dataset in ${DATASETS[@]}; do
|
for dataset in ${DATASETS[@]}; do
|
||||||
export CUDA_VISIBLE_DEVICES=${!GPU_IDX}
|
export CUDA_VISIBLE_DEVICES=${GPU_IDX[$idx]}
|
||||||
|
if [ $idx == $len ]; then
|
||||||
|
idx=0
|
||||||
|
else
|
||||||
|
((idx=idx+1))
|
||||||
|
fi
|
||||||
python scripts/run_train.py \
|
python scripts/run_train.py \
|
||||||
'~logging.writer.LocalWriter' \
|
'~logging.writer.LocalWriter' \
|
||||||
data.dataset.data_directory=data/blender/${dataset} \
|
data.dataset.data_directory=data/blender/${dataset} \
|
||||||
@@ -18,6 +43,5 @@ for dataset in ${DATASETS[@]}; do
|
|||||||
graph.steps_per_save=25000 \
|
graph.steps_per_save=25000 \
|
||||||
graph.max_num_iterations=2000000 \
|
graph.max_num_iterations=2000000 \
|
||||||
logging.enable_profiler=False &
|
logging.enable_profiler=False &
|
||||||
echo "Launched ${dataset} on gpu ${!GPU_IDX}, ${tag}"
|
echo "Launched ${dataset} on gpu ${GPU_IDX[$idx]}, ${tag}"
|
||||||
GPU_IDX=$((GPU_IDX+1))
|
|
||||||
done
|
done
|
||||||
Reference in new issue
Block a user