diff --git a/aiida/schedulers/plugins/direct.py b/aiida/schedulers/plugins/direct.py index f353f10c0e..2f7b4cd4df 100644 --- a/aiida/schedulers/plugins/direct.py +++ b/aiida/schedulers/plugins/direct.py @@ -142,17 +142,8 @@ def _get_submit_script_header(self, job_tmpl): lines.append('exec 2>&1') if job_tmpl.max_memory_kb: - try: - virtual_memory_kb = int(job_tmpl.max_memory_kb) - if virtual_memory_kb <= 0: - raise ValueError - except ValueError: - raise ValueError( - 'max_memory_kb must be ' - "a positive integer (in kB)! It is instead '{}'" - ''.format((job_tmpl.max_memory_kb)) - ) - lines.append(f'ulimit -v {virtual_memory_kb}') + self.logger.warning('Physical memory limiting is not supported by the direct scheduler.') + if not job_tmpl.import_sys_environment: lines.append('env --ignore-environment \\') diff --git a/aiida/schedulers/plugins/lsf.py b/aiida/schedulers/plugins/lsf.py index 1240c5e0b1..361accb8bb 100644 --- a/aiida/schedulers/plugins/lsf.py +++ b/aiida/schedulers/plugins/lsf.py @@ -401,18 +401,18 @@ def _get_submit_script_header(self, job_tmpl): # TODO: check if this is the memory per node # pylint: disable=fixme if job_tmpl.max_memory_kb: try: - virtual_memory_kb = int(job_tmpl.max_memory_kb) - if virtual_memory_kb <= 0: + physical_memory_kb = int(job_tmpl.max_memory_kb) + if physical_memory_kb <= 0: raise ValueError except ValueError: raise ValueError( 'max_memory_kb must be ' "a positive integer (in kB)! It is instead '{}'" - ''.format((job_tmpl.MaxMemoryKb)) + ''.format((job_tmpl.max_memory_kb)) ) # The -M option sets a per-process (soft) memory limit for all the # processes that belong to this job - lines.append(f'#BSUB -M {virtual_memory_kb}') + lines.append(f'#BSUB -M {physical_memory_kb}') if job_tmpl.custom_scheduler_commands: lines.append(job_tmpl.custom_scheduler_commands) diff --git a/aiida/schedulers/plugins/pbspro.py b/aiida/schedulers/plugins/pbspro.py index fc03e48cac..0d0eb7aa78 100644 --- a/aiida/schedulers/plugins/pbspro.py +++ b/aiida/schedulers/plugins/pbspro.py @@ -86,8 +86,8 @@ def _get_resource_lines( if max_memory_kb: try: - virtual_memory_kb = int(max_memory_kb) - if virtual_memory_kb <= 0: + physical_memory_kb = int(max_memory_kb) + if physical_memory_kb <= 0: raise ValueError except ValueError: raise ValueError( @@ -95,7 +95,7 @@ def _get_resource_lines( "a positive integer (in kB)! It is instead '{}'" ''.format((max_memory_kb)) ) - select_string += f':mem={virtual_memory_kb}kb' + select_string += f':mem={physical_memory_kb}kb' return_lines.append(f'#PBS -l {select_string}') return return_lines diff --git a/aiida/schedulers/plugins/slurm.py b/aiida/schedulers/plugins/slurm.py index 51f04305bb..fdfaf30a4b 100644 --- a/aiida/schedulers/plugins/slurm.py +++ b/aiida/schedulers/plugins/slurm.py @@ -382,18 +382,18 @@ def _get_submit_script_header(self, job_tmpl): # It is the memory per node, not per cpu! if job_tmpl.max_memory_kb: try: - virtual_memory_kb = int(job_tmpl.max_memory_kb) - if virtual_memory_kb <= 0: + physical_memory_kb = int(job_tmpl.max_memory_kb) + if physical_memory_kb <= 0: raise ValueError except ValueError: raise ValueError( 'max_memory_kb must be ' "a positive integer (in kB)! It is instead '{}'" - ''.format((job_tmpl.MaxMemoryKb)) + ''.format((job_tmpl.max_memory_kb)) ) # --mem: Specify the real memory required per node in MegaBytes. # --mem and --mem-per-cpu are mutually exclusive. - lines.append(f'#SBATCH --mem={virtual_memory_kb // 1024}') + lines.append(f'#SBATCH --mem={physical_memory_kb // 1024}') if job_tmpl.custom_scheduler_commands: lines.append(job_tmpl.custom_scheduler_commands) diff --git a/aiida/schedulers/plugins/torque.py b/aiida/schedulers/plugins/torque.py index 5d6ff49566..527174ea06 100644 --- a/aiida/schedulers/plugins/torque.py +++ b/aiida/schedulers/plugins/torque.py @@ -81,8 +81,8 @@ def _get_resource_lines( if max_memory_kb: try: - virtual_memory_kb = int(max_memory_kb) - if virtual_memory_kb <= 0: + physical_memory_kb = int(max_memory_kb) + if physical_memory_kb <= 0: raise ValueError except ValueError: raise ValueError( @@ -92,7 +92,7 @@ def _get_resource_lines( ) # There is always something before, at least the total # # of nodes - select_string += f',mem={virtual_memory_kb}kb' + select_string += f',mem={physical_memory_kb}kb' return_lines.append(f'#PBS -l {select_string}') return return_lines