Files
nerfstudio/scripts/benchmarking/launch_eval_blender.sh
T
Ethan Weberandevonneng 7e9a56fac4 Config restructure (#283)
* starting docs for pipelines

* working on an example

* clearing output

* starting to implement config changes and add documentation

* wip: removed cicular imports; porting basic config into python; todo: get python setups workin

* circular imports again

* wip: pausing at dataloader sort of working

* break for today

* running vanilla

* wip need to get all the config docs working

* laptop about to die

* instant ngp working

* added all configs for all methods; not tested yet: [mipnerf360, nerfw, semantic_nerf]

* unpacking later

* done with pylinting

* mostly done. just need to do docs and one test

* added import order to docs

* fixing near/far plane and other config things

* making loggers also instantiable via configs

* docs

* lint

* making --help work with dcargs

* moving configs back into flat

* convert list to tuples; fixed post init function with mutable params

* lint

* made run_eval and benchmarking scripts compatible with new config/dcargs

* lint

* added option to load configs from presaved config

Co-authored-by: evonneng <evonne_ng@berkeley.edu>
2022-08-26 17:25:10 -07:00

74 lines
2.4 KiB
Bash
Executable File

helpFunction_launch_eval()
{
echo "Usage: $0 -c config_name -g gpu_list"
echo -e "\t-c name of method to benchmark (e.g. graph_mipnerf, graph_instant_ngp)"
echo -o "\t-o base directory for where all the benchmarks are stored (e.g. outputs/)"
echo -e "\t-m month of the benchmark of format xx (e.g. 08)"
echo -e "\t-d date of the benchmark of format xx (e.g. 01)"
echo -e "\t-y year of the benchmark of format xxxx (e.g. 2022)"
echo -e "\t-s second timestamp of the benchmark of format xxxxxx (e.g. 003603)"
echo -e "\t-g list of space-separated gpu numbers to launch train on (e.g. 0 2 4 5)"
exit 1 # Exit program after printing help
}
while getopts "c:o:m:d:y:s:g" opt; do
case "$opt" in
c ) config_name="$OPTARG" ;;
o ) output_dir="$OPTARG" ;;
m ) month="$OPTARG" ;;
d ) date="$OPTARG" ;;
y ) year="$OPTARG" ;;
s ) seconds="$OPTARG" ;;
g ) gpu_list="$OPTARG" ;;
? ) helpFunction_launch_eval ;;
esac
done
if [ -z "$config_name" ]; then
echo "Missing method name"
helpFunction_launch_train
fi
shift $((OPTIND-1))
# Deal with gpu's. If passed in, use those.
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")
idx=0
len=${#GPU_IDX[@]}
((len=len-1))
for dataset in ${DATASETS[@]}; do
export CUDA_VISIBLE_DEVICES=${GPU_IDX[$idx]}
base_config_name=${config_name/"graph_"/""}
checkpoint_dir="${output_dir}/blender_${dataset}_${month}-${date}-${year}/${base_config_name}/${year}-${month}-${date}_${seconds}/nerfactory_models/"
python scripts/run_eval.py ${config_name} \
--eval.checkpoint-dir=${checkpoint_dir} \
--eval.output-filename=${output_dir}/${base_config_name}/blender_${dataset}_${month}-${date}-${year}_${seconds}.json &
echo "Launched ${checkpoint_dir} on gpu ${GPU_IDX[$idx]}"
# update gpu
if [ $idx == $len ]; then
idx=0
else
((idx=idx+1))
fi
done