From 8bb9bbd8bd631b387be3566b7b902138d495bc10 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Fri, 29 Mar 2024 12:26:36 +0100 Subject: [PATCH] Fix num_cores_per_numa_node, use it from the current_partition info --- eessi/testsuite/hooks.py | 2 +- .../tests/apps/PyTorch/src/python_get_free_socket.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 eessi/testsuite/tests/apps/PyTorch/src/python_get_free_socket.py diff --git a/eessi/testsuite/hooks.py b/eessi/testsuite/hooks.py index 5956ac61..b9a3dc93 100644 --- a/eessi/testsuite/hooks.py +++ b/eessi/testsuite/hooks.py @@ -232,7 +232,7 @@ def _assign_one_task_per_numa_node(test: rfm.RegressionTest): # neither num_tasks_per_node nor num_cpus_per_task are set if not test.num_tasks_per_node and not test.num_cpus_per_task: check_proc_attribute_defined(test, 'num_cores_per_numa_node') - test.num_tasks_per_node = math.ceil(test.default_num_cpus_per_node / num_cores_per_numa_node) + test.num_tasks_per_node = math.ceil(test.default_num_cpus_per_node / test.current_partition.processor.num_cores_per_numa_node) test.num_cpus_per_task = int(test.default_num_cpus_per_node / test.num_tasks_per_node) # num_tasks_per_node is not set, but num_cpus_per_task is diff --git a/eessi/testsuite/tests/apps/PyTorch/src/python_get_free_socket.py b/eessi/testsuite/tests/apps/PyTorch/src/python_get_free_socket.py new file mode 100644 index 00000000..a2981304 --- /dev/null +++ b/eessi/testsuite/tests/apps/PyTorch/src/python_get_free_socket.py @@ -0,0 +1,8 @@ +# Based on https://unix.stackexchange.com/a/132524 +import socket + +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.bind(('', 0)) +addr = s.getsockname() +print(addr[1]) +s.close()