Skip to content
Snippets Groups Projects
Commit 3d3dbe70 authored by Samuel  HANOT's avatar Samuel HANOT
Browse files

make recursive_gmconvert.sh get the number of gaussians from an array. This...

make recursive_gmconvert.sh get the number of gaussians from an array. This opens the door to reading num of gaussians lists from a file
parent df07057e
No related branches found
No related tags found
No related merge requests found
......@@ -18,8 +18,8 @@ Optional arguments:
#defaults
map_name=
threshold=
n_gaussians=
n_gaussians0=
ng=
ng0=
N=
i0=1
serial=0
......@@ -29,8 +29,8 @@ do
case "$opt" in
f) map_name="$OPTARG";;
t) threshold="$OPTARG";;
n) n_gaussians="$OPTARG";;
0) n_gaussians0="$OPTARG";;
n) ng="$OPTARG";;
0) ng0="$OPTARG";;
N) N="$OPTARG";;
i) i0="$OPTARG";;
s) serial=1;;
......@@ -44,17 +44,29 @@ do
done
#check that necessary options were set
if [[ ! -e "$map_name" ]] || [[ -z "$threshold" ]] || [[ -z "$n_gaussians" ]] || [[ -z "$N" ]]
if [[ ! -e "$map_name" ]] || [[ -z "$threshold" ]] || [[ -z "$ng" ]] || [[ -z "$N" ]]
then
usage
exit 1
fi
if [[ -z "$n_gaussians0" ]]
if [[ -z "$ng0" ]]
then
n_gaussians0=$n_gaussians
ng0=$ng
fi
num_gaussians=()
for ((i=$i0 ; i<=N ; i++))
do
if ((i==1))
then
num_gaussians+=$ng0
else
num_gaussians+=$ng
fi
done
MaxArraySize=100000
get_max_jobs(){
echo ${MaxArraySize}
......@@ -71,12 +83,10 @@ map_name=$(basename $map_name)
cd $map_root_dir
mkdir -p converged
for ((i=$i0 ; i<=N ; i++))
for ((i=$i0 ; i<=${#num_gaussians} ; i++))
do
echo "i=$i"
n=$((i))
n=${num_gaussians[$i]}
jobname=${map_name}_${n}
n_jobs=1
......@@ -86,7 +96,7 @@ do
then
${gmconvert} -imap ${map_name} -zth ${threshold} -oimap threshold.map -ogmm /dev/null -ng 0
fi
echo ${profile_cmd} ${gmconvert} -imap ${map_name} -ogmm $n/${n}_0.gmm -ng ${n_gaussians0} -zth ${threshold}
echo ${profile_cmd} ${gmconvert} -imap ${map_name} -ogmm $n/${n}_0.gmm -ng ${ng0} -zth ${threshold}
echo ${gmconvert} -igmm $n/${n}_0.gmm -imap ${map_name} -omap /dev/null
else
n_prev=$((i-1))
......@@ -97,7 +107,7 @@ do
n_jobs=$((n_jobs + $(awk '/NGAUSS/{s+=$3}END{print s}' ${gmm_file}) ))
done
echo echo ${gmm_name} '$((SLURM_ARRAY_TASK_ID-1+offset))' \> 'tmp_$((SLURM_ARRAY_TASK_ID+offset)).txt'
echo ${profile_cmd} ${gmconvert} -imap ${map_name} -gmml 'tmp_$((SLURM_ARRAY_TASK_ID+offset)).txt' -ogmm $n/${n}_'$((SLURM_ARRAY_TASK_ID-1+offset))'.gmm -ng ${n_gaussians} -zth ${threshold}
echo ${profile_cmd} ${gmconvert} -imap ${map_name} -gmml 'tmp_$((SLURM_ARRAY_TASK_ID+offset)).txt' -ogmm $n/${n}_'$((SLURM_ARRAY_TASK_ID-1+offset))'.gmm -ng ${ng} -zth ${threshold}
echo ${gmconvert} -igmm $n/${n}_'$((SLURM_ARRAY_TASK_ID-1+offset)).gmm' -imap ${map_name} -gmml 'tmp_$((SLURM_ARRAY_TASK_ID+offset)).txt' -omap /dev/null
fi > commands_$i.sh
mkdir -p $n
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment