Skip to content

Commit b3c8aea

Browse files
authored
Merge pull request #468 from OpenBioSim/fix_467
Fix issue #467
2 parents 45194e3 + d280a61 commit b3c8aea

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

python/BioSimSpace/Process/_openmm.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,9 @@ def _add_config_platform(self):
20372037
"'CUDA' platform selected but 'CUDA_VISIBLE_DEVICES' "
20382038
"environment variable is unset. Defaulting to '0'."
20392039
)
2040+
else:
2041+
num_devices = len(cuda_devices.split(","))
2042+
cuda_devices = ",".join([str(x) for x in range(num_devices)])
20402043
self.addToConfig("properties = {'CudaDeviceIndex': '%s'}" % cuda_devices)
20412044
elif self._platform == "OPENCL":
20422045
opencl_devices = _os.environ.get("OPENCL_VISIBLE_DEVICES")
@@ -2046,6 +2049,9 @@ def _add_config_platform(self):
20462049
"'OpenCL' platform selected but 'OPENCL_VISIBLE_DEVICES' "
20472050
"environment variable is unset. Defaulting to '0'."
20482051
)
2052+
else:
2053+
num_devices = len(opencl_devices.split(","))
2054+
opencl_devices = ",".join([str(x) for x in range(num_devices)])
20492055
self.addToConfig(
20502056
"properties = {'OpenCLDeviceIndex': '%s'}" % opencl_devices
20512057
)

python/BioSimSpace/Sandpit/Exscientia/Process/_openmm.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,9 @@ def _add_config_platform(self):
19841984
"'CUDA' platform selected but 'CUDA_VISIBLE_DEVICES' "
19851985
"environment variable is unset. Defaulting to '0'."
19861986
)
1987+
else:
1988+
num_devices = len(cuda_devices.split(","))
1989+
cuda_devices = ",".join([str(x) for x in range(num_devices)])
19871990
self.addToConfig("properties = {'CudaDeviceIndex': '%s'}" % cuda_devices)
19881991
elif self._platform == "OPENCL":
19891992
opencl_devices = _os.environ.get("OPENCL_VISIBLE_DEVICES")
@@ -1993,6 +1996,9 @@ def _add_config_platform(self):
19931996
"'OpenCL' platform selected but 'OPENCL_VISIBLE_DEVICES' "
19941997
"environment variable is unset. Defaulting to '0'."
19951998
)
1999+
else:
2000+
num_devices = len(opencl_devices.split(","))
2001+
opencl_devices = ",".join([str(x) for x in range(num_devices)])
19962002
self.addToConfig(
19972003
"properties = {'OpenCLDeviceIndex': '%s'}" % opencl_devices
19982004
)

0 commit comments

Comments
 (0)