Skip to content

Commit aa9a144

Browse files
committed
add CI env vars for CL config
1 parent 0b480e6 commit aa9a144

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ jobs:
3939
run: pip install tox
4040

4141
- name: Run tests
42+
env:
43+
PTO_DEVICE_INDEX: 0
44+
PTO_N_WORK_UNITS: 1024
4245
run: tox -e py${{ matrix.python-version }}

pytissueoptics/rayscattering/opencl/config/CLConfig.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,19 @@ def _load(self):
174174
with open(OPENCL_CONFIG_PATH, "r") as f:
175175
self._config = json.load(f)
176176

177+
if os.getenv("PTO_DEVICE_INDEX") is not None:
178+
try:
179+
self.DEVICE_INDEX = int(os.getenv("PTO_DEVICE_INDEX"))
180+
except ValueError:
181+
raise ValueError(f"Invalid value for PTO_DEVICE_INDEX: {os.getenv('PTO_DEVICE_INDEX')}. Must be an "
182+
f"integer.")
183+
if os.getenv("PTO_N_WORK_UNITS") is not None:
184+
try:
185+
self.N_WORK_UNITS = int(os.getenv("PTO_N_WORK_UNITS"))
186+
except ValueError:
187+
raise ValueError(f"Invalid value for PTO_N_WORK_UNITS: {os.getenv('PTO_N_WORK_UNITS')}. Must be an "
188+
f"integer.")
189+
177190
def _assertExists(self):
178191
if not os.path.exists(OPENCL_CONFIG_PATH):
179192
warnings.warn("No OpenCL config file found. Creating a new one.")

0 commit comments

Comments
 (0)