Having 1 cpu + 1 GPU , how to choose special device when using reikna cluda.ocl_api?

39 views
Skip to first unread message

Chen Dong

unread,
Jan 24, 2019, 7:25:21 AM1/24/19
to reikna
Available devices: 
Quadro P2000 (NVIDIA Corporation)
Quadro P2000 (NVIDIA Corporation)
pthread-AMD Ryzen 7 1700X Eight-Core Processor (AuthenticAMD)
Time using OpenCL 2.0 pocl 0.13, LLVM 3.8.1 on pthread-AMD Ryzen 7 1700X Eight-Core Processor: 0.031108 seconds
Finished!


I intend to use Quadro P2000 instead of Ryzen 1700x....
Pls help!

Thanx in advance!

Bogdan Opanchuk

unread,
Jan 24, 2019, 9:11:10 AM1/24/19
to reikna
There are three possible ways. First, you can select the device manually and pass it to the Thread constructor:

from reikna.cluda import ocl_api
api = ocl_api()
device = api.get_platforms()[0].get_devices()[1] # or whichever device you want
thread = api.Thread(device)

Alternatively, you can supply inclusion/exclusion masks to Thread.create():

api = ocl_api()
thread = api.Thread.create(device_filters=dict(include_devices='Quadro')) # this will select the first Quadro card


Finally, you can select the device interactively:

api = ocl_api()
thread = api.Thread.create(interactive=True) # this will display a menu with possible options and wait for your input

Reply all
Reply to author
Forward
0 new messages