diff --git a/TurTLE/_code.py b/TurTLE/_code.py index 7550a40772916a32b62db6fa31450fbfb99cb9a4..24481fbca5913a103f762b042e8076c744fe672c 100644 --- a/TurTLE/_code.py +++ b/TurTLE/_code.py @@ -760,12 +760,15 @@ class _code(_base): script_file.write('export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}\n') # explicit binding options that can be used further on if needed - core_masks = TurTLE.tools.distribute_cores_evenly( - nprocesses = nb_processes_per_node, - nthreads_per_process = nb_threads_per_process, - total_number_of_cores = nb_cpus_per_node) - script_file.write('export SLURM_CPU_BIND_OPTION="--cpu-bind=verbose,mask_cpu:' + - ','.join(['0x{0:x}'.format(mm) for mm in core_masks]) + '"\n') + if 'use_TurTLE_core_distribution' not in host_info.keys(): + host_info['use_TurTLE_core_distribution'] = False + if host_info['use_TurTLE_core_distribution']: + core_masks = TurTLE.tools.distribute_cores_evenly( + nprocesses = nb_processes_per_node, + nthreads_per_process = nb_threads_per_process, + total_number_of_cores = nb_cpus_per_node) + script_file.write('export SLURM_CPU_BIND_OPTION="--cpu-bind=verbose,mask_cpu:' + + ','.join(['0x{0:x}'.format(mm) for mm in core_masks]) + '"\n') script_file.write('echo "Start time is `date`"\n') script_file.write('cd ' + self.work_dir + '\n') @@ -783,7 +786,9 @@ class _code(_base): if 'executable_launcher' in self.host_info.keys(): executable_launcher = self.host_info['executable_launcher'] else: - executable_launcher = 'srun ${SLURM_CPU_BIND_OPTION}' + executable_launcher = 'srun' + if host_info['use_TurTLE_core_distribution']: + executable_launcher += ' ${SLURM_CPU_BIND_OPTION}' if host_info['use_vtune']: if 'vtune_executable' not in host_info.keys(): host_info['vtune_executable'] = 'vtune' diff --git a/pc_host_info.py b/pc_host_info.py index e955be0c6adb0807083b895333e300c719a16786..44ff1c5da7bd456206b350fdd7a906b66322c715 100644 --- a/pc_host_info.py +++ b/pc_host_info.py @@ -32,9 +32,10 @@ host_info = {'type' : 'pc'} # 'deltanprocs' : info_template_deltanprocs, # 'mail_address': info_template_mail_address, # 'account' : info_template_account, -# 'executable_launcher' : info_template_executable_launcher, -# 'extra_slurm_lines' : info_template_extra_slurm_lines, -# 'explicit_slurm_environment' : info_template_explicit_slurm_environment} +# 'executable_launcher' : info_template_executable_launcher, +# 'extra_slurm_lines' : info_template_extra_slurm_lines, +# 'explicit_slurm_environment' : info_template_explicit_slurm_environment, +# 'use_TurTLE_core_distribution' : info_use_TurTLE_core_distribution} # info_template_type can be one of: # 'pc' --- jobs run interactively @@ -73,3 +74,7 @@ host_info = {'type' : 'pc'} # in the submission script, or whether the cluster chooses it based on the # resources requested +# info_use_TurTLE_core_distribution, relevant for `SLURM` clusters, +# is a bool specifying whether TurTLE should request explicit core +# masks for the individual MPI processes. +