33 lines
898 B
Python
33 lines
898 B
Python
import pyopencl as cl
|
|
|
|
# Get all platforms
|
|
platforms = cl.get_platforms()
|
|
if not platforms:
|
|
raise RuntimeError("No OpenCL platforms found")
|
|
|
|
# Use the first platform (rusticl in your case)
|
|
platform = platforms[0]
|
|
print("Using platform:", platform.name)
|
|
|
|
# Get devices for that platform
|
|
devices = platform.get_devices()
|
|
if not devices:
|
|
raise RuntimeError("No devices found on platform")
|
|
|
|
for platform in cl.get_platforms():
|
|
for device in platform.get_devices():
|
|
print("Device:", device.name)
|
|
# if device.type & cl.device_type.GPU == 0:
|
|
# print("Skipping non-GPU device:", device.name)
|
|
|
|
# Use the first device (your Adreno GPU)
|
|
device = devices[0]
|
|
print("Using device:", device.name)
|
|
|
|
# Create a context with that device
|
|
ctx = cl.Context([device])
|
|
|
|
# Create a command queue
|
|
queue = cl.CommandQueue(ctx)
|
|
|
|
print("Context and command queue created successfully!") |