diff --git a/brian2cuda/tests/features/cuda_configuration.py b/brian2cuda/tests/features/cuda_configuration.py index a16139ef..95023319 100644 --- a/brian2cuda/tests/features/cuda_configuration.py +++ b/brian2cuda/tests/features/cuda_configuration.py @@ -1,6 +1,5 @@ import os import shutil -import sys import socket import subprocess import shlex @@ -29,6 +28,13 @@ class CUDAStandaloneConfigurationBase(Configuration): def before_run(self): # set brian preferences + slurm_cluster = os.environ.get("SLURM_CLUSTER_NAME", default=None) + if slurm_cluster == "hpc": + device_query_path = "~/cuda-samples/bin/x86_64/linux/release/deviceQuery" + brian2.prefs.devices.cuda_standalone.cuda_backend.device_query_path = ( + device_query_path + ) + for key, value in self.extra_prefs.items(): brian2.prefs[key] = value if self.name is None: diff --git a/brian2cuda/tools/test_suite/utils.py b/brian2cuda/tools/test_suite/utils.py index a8e55a52..24152a44 100644 --- a/brian2cuda/tools/test_suite/utils.py +++ b/brian2cuda/tools/test_suite/utils.py @@ -1,6 +1,7 @@ """Utility funcitons""" import traceback import time +import os import numpy as np from itertools import chain, combinations @@ -132,6 +133,14 @@ def set_preferences(args, prefs, fast_compilation=True, suppress_warnings=True, prefs['devices.cuda_standalone.cuda_backend.extra_compile_args_nvcc'].extend(compile_args) prints.append("Suppressing compiler warnings") + slurm_cluster = os.environ.get("SLURM_CLUSTER_NAME", default=None) + if slurm_cluster == "hpc": + device_query_path = "~/cuda-samples/bin/x86_64/linux/release/deviceQuery" + prefs.devices.cuda_standalone.cuda_backend.device_query_path = ( + device_query_path + ) + prints.append(f"Setting `device_query_path = {device_query_path}") + if args.jobs is not None: k = 'devices.cpp_standalone.extra_make_args_unix' if '-j' not in prefs[k]: