macosopencltorchamd-gpu

Set OpenCL device on OSX to dedicated AMD GPU


I'm in the process of setting up Torch on OSX on a 2015 MacBook Pro with a Radeon GPU using this library (cltorch) for OpenCL support.

I can successfully run Torch scripts now, but running this test script which outputs the device and platform being used I get:

Using Apple , OpenCL platform: Apple
Using OpenCL device: Iris Pro

Obviously, I want torch to run on Radeon instead of the integrated Iris, but I have no idea how to do that.


Solution

  • You can use cltorch.setDevice to choose the device, like:

    cltorch.setDevice(2)