gpu / JOCL

Java bindings for OpenCL

Home Page:http://www.jocl.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] How to get platform and device information?

HamedSharifian opened this issue · comments

I have a device with 2 GPUs:

  • Intel(R) HD Graphics 520
  • NVIDIA GeForce 940MX
    GPU-Z shows that OpenCL is enabled and is working on both. I get 2 platforms when I obtain platform Ids using JOCL, but I don't know which device is in use! I wonder if I could know how can I get "device name" or its "vendor" using the platform Id?

The https://github.com/gpu/JOCLSamples/blob/master/src/main/java/org/jocl/samples/JOCLDeviceQuery.java sample might be what you're looking for. It iterates through all platforms, and all devices for each platform, and prints the name and vendor of each device (together with lots of further technical information).