Skip to content

Commit

Permalink
Merge pull request #182 from casparvl/throw_warning_request_mem
Browse files Browse the repository at this point in the history
Make hook print a warning
  • Loading branch information
satishskamath authored Sep 18, 2024
2 parents b373708 + 39f4035 commit 45808ba
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions eessi/testsuite/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,24 @@ def req_memory_per_node(test: rfm.RegressionTest, app_mem_req: float):
msg += f" but {app_mem_req} MiB is needed"
test.skip_if(test.current_partition.extras['mem_per_node'] < app_mem_req, msg)

# Check if a resource with the name 'memory' was set in the ReFrame config file. If not, warn the user
# and return from this hook (as setting test.extra_resources will be ignored in that case according to
# https://reframe-hpc.readthedocs.io/en/stable/regression_test_api.html#reframe.core.pipeline.RegressionTest.extra_resources
if 'memory' not in test.current_partition.resources:
logger = rflog.getlogger()
msg = "Your ReFrame configuration file does not specify any resource called 'memory' for this partition "
msg += f" ({test.current_partition.name})."
msg += " Without this, an explicit memory request cannot be made from the scheduler. This test will run,"
msg += " but it may result in an out of memory error."
msg += " Please specify how to requst memory (per node) from your resource scheduler by defining a resource"
msg += " 'memory' in your ReFrame configuration file for this partition."
msg += " For a SLURM system, one would e.g. define:"
msg += " 'resources': [{'name': 'memory', 'options': ['--mem={size}']}]"
logger.warning(msg)
# We return, as setting a test.extra_resources is pointless - it would be ignored anyway
# This way, we also don't add any lines to the log that a specific amount of memory was requested
return

# Compute what is higher: the requested memory, or the memory available proportional to requested CPUs
# Fraction of CPU cores requested
check_proc_attribute_defined(test, 'num_cpus')
Expand Down

0 comments on commit 45808ba

Please sign in to comment.