Skip to content

Commit 74a4b9f

Browse files
committed
update ci
1 parent f58d819 commit 74a4b9f

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
os: [ubuntu-20.04, ubuntu-22.04, windows-latest]
10+
# macos-13 is the last runner with an OpenCL device
11+
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
1112
python-version: ["3.9", "3.12"]
1213

1314
runs-on: ${{ matrix.os }}

pytissueoptics/rayscattering/opencl/config/CLConfig.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@
77
try:
88
import pyopencl as cl
99
OPENCL_AVAILABLE = True
10+
11+
available_platforms = cl.get_platforms()
12+
print("Available OpenCL platforms:")
13+
for platform in available_platforms:
14+
print(f"... {platform.name}")
15+
print("Available OpenCL devices:")
16+
has_device = False
17+
for platform in available_platforms:
18+
devices = platform.get_devices()
19+
for device in devices:
20+
has_device = True
21+
print(f"... {device.name} ({device.global_mem_size // 1024 ** 2} MB | {device.max_clock_frequency} MHz)")
22+
1023
except ImportError:
1124
class DummyCL:
1225
def __getattr__(self, item):

pytissueoptics/rayscattering/tests/opencl/src/testCLPhoton.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import numpy as np
77

88
from pytissueoptics import Vector, ScatteringMaterial, ScatteringScene
9-
from pytissueoptics.rayscattering.opencl import OPENCL_AVAILABLE
9+
from pytissueoptics.rayscattering.opencl import OPENCL_AVAILABLE, OPENCL_OK
1010
from pytissueoptics.rayscattering.opencl.config.CLConfig import OPENCL_SOURCE_DIR
1111
from pytissueoptics.rayscattering.opencl.CLProgram import CLProgram
1212
from pytissueoptics.rayscattering.opencl.CLScene import NO_SURFACE_ID, NO_LOG_ID, NO_SOLID_ID, CLScene
@@ -37,7 +37,7 @@ class DataPointResult:
3737
surfaceID: int
3838

3939

40-
@unittest.skipIf(not OPENCL_AVAILABLE, 'Requires PyOpenCL.')
40+
@unittest.skipIf(not OPENCL_OK, 'Requires working OpenCL setup.')
4141
class TestCLPhoton(unittest.TestCase):
4242
def setUp(self):
4343
self.INITIAL_POSITION = Vector(2, 2, 0)
@@ -414,7 +414,6 @@ def _photonFunc(self, funcName: str, *args) -> PhotonResult:
414414
materialID=0, solidID=self.INITIAL_SOLID_ID, weight=self.INITIAL_WEIGHT)
415415
npArgs = [np.float32(arg) if isinstance(arg, (float, int)) else arg for arg in args]
416416
npArgs = [cl.cltypes.make_float3(*arg.array) if isinstance(arg, Vector) else arg for arg in npArgs]
417-
print("npArgs:", npArgs)
418417
self.program.launchKernel(kernelName=funcName + "Kernel", N=1,
419418
arguments=npArgs + [photonBuffer, np.int32(0)])
420419
photonResult = self._getPhotonResult(photonBuffer)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ setenv =
88
PTO_N_WORK_UNITS = 128
99
PTO_MAX_MEMORY_MB = 1024
1010
commands =
11-
python -m unittest discover -v
11+
python -m unittest pytissueoptics/rayscattering/tests/opencl/src/testCLPhoton.py -v

0 commit comments

Comments
 (0)