Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xavier Garrido
CAMEL
Commits
226fd059
Commit
226fd059
authored
Jun 08, 2018
by
Matthieu Tristram
Browse files
Interation best-fit
parent
07468a61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
140 additions
and
0 deletions
+140
-0
work/batch/cc/MinimizeIter.sh
work/batch/cc/MinimizeIter.sh
+140
-0
No files found.
work/batch/cc/MinimizeIter.sh
0 → 100755
View file @
226fd059
#!/bin/bash
##Parameters
nargs
=
$#
if
!
[
$nargs
-eq
2
-o
$nargs
-eq
3
]
;
then
echo
"usage: MinimizeIter.sh parFile Niter (range) "
echo
"the optional
\"
range
\"
parameter can be used to specify different starting points "
echo
"It must be given in the form: begin-end (eg. 1-5 for jobs 1 to 5)"
echo
"Job 1 corresponding to not changing the parFile starting values, while other values"
echo
"will send jobs shuffling the parameters randomly within the min-max bounds of the parFile"
exit
fi
parFile
=
$1
Niter
=
$2
range
=
"1-1"
if
[
$#
-eq
3
]
;
then
range
=
$3
fi
##some checks
if
[
-z
"
${
CAMELROOT
}
"
]
;
then
echo
"CAMELROOT undefined: did you sourced camel_setup.sh?"
exit
fi
if
[
-z
"
$CLIKDIR
"
]
;
then
echo
"miss CLIKDIR"
exit
fi
if
!
[
-f
$CAMELROOT
/
$CMTCONFIG
/Minimize
]
;
then
echo
"missing Minimize executable: rum make exec in cmt/"
fi
file
=
$(
readlink
-e
$parFile
)
parbase
=
$(
basename
$file
)
if
[
!
-f
"
$file
"
]
;
then
echo
"no parfile=
$file
"
exit
fi
dirout
=
${
parbase
%
".par"
}
_
"minit"
OUTDIR
=
$PWD
/
$dirout
if
[
-d
"
$dirout
"
]
;
then
echo
"Output directory
$dirout
already exists: still want to run? (y/n)"
read
answer
if
[
$answer
!=
'y'
]
;
then
echo
"exiting"
exit
1
fi
else
mkdir
$dirout
fi
cd
$OUTDIR
###################################################
cat
>
camelrun
<<
EOBATCH
#!/bin/bash
#
$
-N
$(
basename
$dirout
)
#
$
-R y
#
$
-j y
#
$
-o
$PWD
#
$
-e
$PWD
#
$
-P P_
$GROUP
#
$
-l sps=1
cd
\$
TMPDIR
export OMP_NUM_THREADS=8
export PYTHONPATH=
${
PICO_CODE
}
# copies localeS
cp
$CAMELROOT
/
$CMTCONFIG
/Minimize .
cp
$CAMELROOT
/work/tools/awk/genrand.awk .
cp
$CAMELROOT
/work/tools/python/changepars.py .
chmod u+x changepars.py
cp
$file
parfile_in
#================================
#randomize si id ne 1
#================================
echo "***************************************************************"
if [
\$
{SGE_TASK_ID} -eq 1 ] ; then
cp parfile_in parfile
else
RANDOM=
\$
{SGE_TASK_ID}
zerand=
\$
RANDOM
awk -v seed=
\$
zerand -f genrand.awk parfile_in > parfile
fi
echo "***************************************************************"
for((N=1; N<=
$Niter
; N++)); do
cp parfile
$OUTDIR
/camel
\$
{SGE_TASK_ID}_min
\$
{N}.par
#================================
# Camel run
#================================
./Minimize parfile bestfit covmat
#MODIFY par BESTFIT
python ./changepars.py parfile bestfit > newparfile
mv bestfit
$OUTDIR
/best
\$
{N}_fit
\$
{SGE_TASK_ID}
mv covmat
$OUTDIR
/covmat
\$
{N}_
\$
{SGE_TASK_ID}.dat
mv newparfile parfile
done
EOBATCH
##############################################################################################
if
[
-z
"
${
QSUB_CMD
}
"
]
;
then
QSUB_CMD
=
"qsub -pe multicores 8 -q mc_long"
fi
jobsub
=
"
${
QSUB_CMD
}
-t
$range
camelrun"
echo
"about to run :
$jobsub
"
echo
"OK? [y/n]"
read
answer
if
[
$answer
!=
'y'
]
;
then
echo
"exiting"
exit
1
fi
eval
$jobsub
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment