diff --git a/wetb/prepost/Simulations.py b/wetb/prepost/Simulations.py index eac23b85cf3fa07372372958719d92a3e41e122d..57b9c8479352c1adbe490724c3aaec0cc4248619 100755 --- a/wetb/prepost/Simulations.py +++ b/wetb/prepost/Simulations.py @@ -1797,10 +1797,14 @@ class PBS(object): # run in 32-bit or 64-bit mode. Note this uses the same assumptions # on how to configure wine in toolbox/pbsutils/config-wine-hawc2.sh wineparam = (wine_arch, wine_prefix) - self.winebase = 'time WINEARCH=%s WINEPREFIX=%s ' % wineparam - - self.wine = self.winebase + 'wine' - self.winenumactl = self.winebase + 'numactl --physcpubind=$CPU_NR wine' + if wine_arch==None or wine_prefix==None: + self.winebase = 'time ' + self.wine = self.winebase + self.winenumactl = self.winebase + 'numactl --physcpubind=$CPU_NR' + else: + self.winebase = 'time WINEARCH=%s WINEPREFIX=%s ' % wineparam + self.wine = self.winebase + 'wine' + self.winenumactl = self.winebase + 'numactl --physcpubind=$CPU_NR wine' # in case you want to redirect stdout to /dev/nul, append as follows: # '> /dev/null 2>&1' @@ -1819,10 +1823,12 @@ class PBS(object): self.secperiter = 0.012 # determine at runtime if winefix has to be ran - self.winefix = ' _HOSTNAME_=`hostname`\n' - self.winefix += ' if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then\n' - self.winefix += ' WINEARCH=%s WINEPREFIX=%s winefix\n' % wineparam - self.winefix += ' fi\n' + self.winefix = '' + if wine_arch!=None or wine_prefix!=None: + self.winefix = ' _HOSTNAME_=`hostname`\n' + self.winefix += ' if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then\n' + self.winefix += ' WINEARCH=%s WINEPREFIX=%s winefix\n' % wineparam + self.winefix += ' fi\n' # the output channels comes with a price tag. Each time step # will have a penelty depending on the number of output channels diff --git a/wetb/prepost/dlctemplate.py b/wetb/prepost/dlctemplate.py index 56cb207fa10801dcc93d6a370a656c2269ce0e4f..25a9ddde4e295ef64cd6f9e41c48524830068da4 100644 --- a/wetb/prepost/dlctemplate.py +++ b/wetb/prepost/dlctemplate.py @@ -268,7 +268,7 @@ def launch_dlcs_excel(sim_id, silent=False, verbose=False, pbs_turb=False, walltime='04:00:00', postpro_node=False, compress=False, dlcs_dir='htc/DLCs', postpro_node_zipchunks=True, wine_arch='win32', wine_prefix='~/.wine32', - m=[3,4,6,8,9,10,12]): + m=[3,4,6,8,9,10,12], module='', linux=False): """ Launch load cases defined in Excel files """ @@ -282,6 +282,12 @@ def launch_dlcs_excel(sim_id, silent=False, verbose=False, pbs_turb=False, else: pyenv = None + # FIXME: THIS IS VERY MESSY, we have wine_prefix/arch and exesingle/chunks + if linux: + wine_arch = None + wine_prefix = None + module = 'module load mpi/openmpi_1.6.5_intelv14.0.0\n' + # if linux: # pyenv = 'wetb_py3' # pyenv_cmd = 'source /home/python/miniconda3/bin/activate' @@ -367,11 +373,12 @@ def launch_dlcs_excel(sim_id, silent=False, verbose=False, pbs_turb=False, create_chunks_htc_pbs(cases, sort_by_values=sorts_on, queue='workq', ppn=20, nr_procs_series=3, walltime='20:00:00', chunks_dir='zip-chunks-jess', compress=compress, - wine_arch=wine_arch, wine_prefix=wine_prefix) - create_chunks_htc_pbs(cases, sort_by_values=sorts_on, queue='workq', - ppn=12, nr_procs_series=3, walltime='20:00:00', - chunks_dir='zip-chunks-gorm', compress=compress, - wine_arch=wine_arch, wine_prefix=wine_prefix) + wine_arch=wine_arch, wine_prefix=wine_prefix, + prelude=module) +# create_chunks_htc_pbs(cases, sort_by_values=sorts_on, queue='workq', +# ppn=12, nr_procs_series=3, walltime='20:00:00', +# chunks_dir='zip-chunks-gorm', compress=compress, +# wine_arch=wine_arch, wine_prefix=wine_prefix) df = sim.Cases(cases).cases2df() df.to_excel(os.path.join(POST_DIR, sim_id + '.xls')) @@ -706,6 +713,9 @@ if __name__ == '__main__': parser.add_argument('--wine_prefix', action='store', default='~/.wine32', type=str, dest='wine_prefix', help='WINEPREFIX: ' 'Directory used by wineserver. Default ~/.wine32') + parser.add_argument('--linux', action='store_true', default=False, + dest='linux', help='Do not use wine. Implies that ' + 'wine_prefix and wine_arch to None.') opt = parser.parse_args() # Wholer coefficients to be considered for the fatigue analysis diff --git a/wetb/prepost/simchunks.py b/wetb/prepost/simchunks.py index 47c27d5f21af511e4305b7e1ea934c12a4f83301..a6498c63ca8c6ab71da880e92729c4b14507fad3 100644 --- a/wetb/prepost/simchunks.py +++ b/wetb/prepost/simchunks.py @@ -39,7 +39,7 @@ def create_chunks_htc_pbs(cases, sort_by_values=['[Windspeed]'], ppn=20, i0=0, walltime='24:00:00', chunks_dir='zip-chunks-jess', wine_arch='win32', wine_prefix='~/.wine32', pyenv_cmd='source /home/python/miniconda3/bin/activate', - pyenv='wetb_py3'): + pyenv='wetb_py3', prelude=''): """Group a large number of simulations htc and pbs launch scripts into different zip files so we can run them with find+xargs on various nodes. """ @@ -214,6 +214,10 @@ def create_chunks_htc_pbs(cases, sort_by_values=['[Windspeed]'], ppn=20, i0=0, pbs = pbs.replace('[queue]', queue) pbs += '\necho "%s"\n' % ('-'*70) + # run prelude code + # ===================================================================== + pbs += prelude + # ===================================================================== # activate the python environment if pyenv is not None: @@ -224,13 +228,14 @@ def create_chunks_htc_pbs(cases, sort_by_values=['[Windspeed]'], ppn=20, i0=0, # is this because it is activated at the same time on another node? # check twice if the environment got activated for real, # but only do so for /home/python/miniconda - pbs += 'echo "CHECK 2x IF %s IS ACTIVE, IF NOT TRY AGAIN"\n' % pyenv - pbs += 'CMD=\"from distutils.sysconfig import get_python_lib;' - pbs += 'print (get_python_lib().find(\'/usr/lib/python\'))"\n' - pbs += 'ACTIVATED=`python -c "$CMD"`\n' - pbs += 'if [ $ACTIVATED -eq 0 ]; then %s %s;fi\n' % rpl - pbs += 'ACTIVATED=`python -c "$CMD"`\n' - pbs += 'if [ $ACTIVATED -eq 0 ]; then %s %s;fi\n' % rpl + if pyenv_cmd.find('miniconda') > -1: + pbs += 'echo "CHECK 2x IF %s IS ACTIVE, IF NOT TRY AGAIN"\n' % pyenv + pbs += 'CMD=\"from distutils.sysconfig import get_python_lib;' + pbs += 'print (get_python_lib().find(\'/usr/lib/python\'))"\n' + pbs += 'ACTIVATED=`python -c "$CMD"`\n' + pbs += 'if [ $ACTIVATED -eq 0 ]; then %s %s;fi\n' % rpl + pbs += 'ACTIVATED=`python -c "$CMD"`\n' + pbs += 'if [ $ACTIVATED -eq 0 ]; then %s %s;fi\n' % rpl # ===================================================================== # create all necessary directories at CPU_NR dirs @@ -397,7 +402,8 @@ def create_chunks_htc_pbs(cases, sort_by_values=['[Windspeed]'], ppn=20, i0=0, pbs += "echo 'current working directory:'\n" pbs += 'pwd\n' pbs += 'echo "START RUNNING JOBS IN find+xargs MODE"\n' - pbs += 'WINEARCH=%s WINEPREFIX=%s winefix\n' % wineparam + if wine_arch!=None or wine_prefix!=None: + pbs += 'WINEARCH=%s WINEPREFIX=%s winefix\n' % wineparam pbs += '# run all the PBS *.p files in find+xargs mode\n' pbs += 'echo "following cases will be run from following path:"\n' pbs += 'echo "%s"\n' % (os.path.join(sim_id, pbs_in_base)) @@ -479,11 +485,12 @@ def create_chunks_htc_pbs(cases, sort_by_values=['[Windspeed]'], ppn=20, i0=0, pbs += 'source deactivate\n' pbs += 'echo "DONE !!"\n' pbs += '\necho "%s"\n' % ('-'*70) - pbs += '# in case wine has crashed, kill any remaining wine servers\n' - pbs += '# caution: ALL the users wineservers will die on this node!\n' - pbs += 'echo "following wineservers are still running:"\n' - pbs += 'ps -u $USER -U $USER | grep wineserver\n' - pbs += 'killall -u $USER wineserver\n' + if wine_arch!=None or wine_prefix!=None: + pbs += '# in case wine has crashed, kill any remaining wine servers\n' + pbs += '# caution: ALL the users wineservers will die on this node!\n' + pbs += 'echo "following wineservers are still running:"\n' + pbs += 'ps -u $USER -U $USER | grep wineserver\n' + pbs += 'killall -u $USER wineserver\n' pbs += 'exit\n' rpl = (sim_id, ii)