Commit 5eeb24b3 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

add finer control of slurm script

we're using clusters that require different slurm configs, hence the
need for fine grained control.
parent c14be9dc
......@@ -678,9 +678,12 @@ class _code(_base):
script_file.write('#SBATCH -o ' + out_file + '\n')
# set up environment
script_file.write('#SBATCH --get-user-env\n')
script_file.write('#SBATCH --partition={0}\n'.format(
self.host_info['environment']))
if 'extra_slurm_lines' in self.host_info.keys():
for line in self.host_info['extra_slurm_lines']:
script_file.write(line + '\n')
if self.host_info['explicit_slurm_environment']:
script_file.write('#SBATCH --partition={0}\n'.format(
self.host_info['environment']))
if 'account' in self.host_info.keys():
script_file.write('#SBATCH --account={0}\n'.format(
self.host_info['account']))
......@@ -718,10 +721,11 @@ class _code(_base):
script_file.write('#SBATCH --mail-type=none\n')
script_file.write('#SBATCH --time={0}:{1:0>2d}:00\n'.format(hours, minutes))
## following cleans up environment for job.
## put these in the 'extra_slurm_lines' list if you need them
## make sure that "~/.config/TurTLE/bashrc" exists and builds desired job environment
script_file.write('#SBATCH --export=NONE\n')
script_file.write('#SBATCH --get-user-env\n')
script_file.write('source ~/.config/TurTLE/bashrc\n')
#script_file.write('#SBATCH --export=NONE\n')
#script_file.write('#SBATCH --get-user-env\n')
#script_file.write('source ~/.config/TurTLE/bashrc\n')
if nb_threads_per_process > 1:
script_file.write('export OMP_NUM_THREADS={0}\n'.format(nb_threads_per_process))
script_file.write('export OMP_PLACES=cores\n')
......
......@@ -32,7 +32,9 @@ host_info = {'type' : 'pc'}
# 'deltanprocs' : info_template_deltanprocs,
# 'mail_address': info_template_mail_address,
# 'account' : info_template_account,
# 'executable_launcher': info_template_executable_launcher}
# 'executable_launcher' : info_template_executable_launcher,
# 'extra_slurm_lines' : info_template_extra_slurm_lines,
# 'explicit_slurm_environment' : info_template_explicit_slurm_environment}
# info_template_type can be one of:
# 'pc' --- jobs run interactively
......@@ -59,3 +61,13 @@ host_info = {'type' : 'pc'}
# info_template_executable_launcher, relevant for 'SLURM' clusters,
# is the binary that should be called to execute the hybrid MPI/OpenMP code.
# by default it is 'srun', but it may be 'mpiexec' for some machines.
# info_template_extra_slurm_lines, relevant for 'SLURM' clusters,
# is a list of strings, written as extra options within the SLURM file.
# for example something like `#SBATCH --get-user-env`
# info_template_explicit_slurm_environment, relevant for `SLURM` clusters,
# is a bool specifying whether the environment must be mentioned explicitly
# in the submission script, or whether the cluster chooses it based on the
# resources requested
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment