OpenCL Devices when GPU and CPU present

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Joshua Adelman
Posts: 20
Joined: Thu Feb 21, 2008 4:42 pm

OpenCL Devices when GPU and CPU present

Post by Joshua Adelman » Sun Apr 21, 2013 11:29 am

I'm starting to test out OpenMM using the python wrapper under OpenCL in the v5.1 beta release. My system has 4x Nvidia GTX 680s and a hexcore Intel CPU. I'm trying to understand how the device picking works when both are present and how device id's are assigned.

I installed a nice little tool for extracting info on the various available opencl devices from:
https://github.com/nbigaouette/oclutils/

and it appears as if the GPU and CPU OpenCL SDKs are both installed properly. Each GPU is seen as a different device and the CPU is seen as a single device. However device index (at least from the outputs) seem to show that the CPU is device 0 on the Intel platform and the GPUs are numbered 0-3 on the GPU side (i.e the platforms number the available devices independently of one another).

Within the context of OpenMM, is there an easy way to determine which device id belongs to which piece of hardware? I looked through the manual and I don't think I saw anything on specifying cpu vs gpu for the OpenCL platform. Also, let's say that I want to run 6 separate serial calculations on the CPU using OpenCL. Since I think the whole CPU is seen as a single device, do I have to do anything special to ensure that the calculations don't collide?

Any insight on this would be most appreciated.

Josh

User avatar
Peter Eastman
Posts: 2593
Joined: Thu Aug 09, 2007 1:25 pm

Re: OpenCL Devices when GPU and CPU present

Post by Peter Eastman » Mon Apr 22, 2013 10:14 am

Hi Josh,

In 5.1, we added a pair of read-only platform-specific properties you can use to query the name of the platform and device being used. Those are OpenCLPlatformName and OpenCLDeviceName. Devices are specific to a platform (in the OpenCL sense of the word, not the OpenMM sense). So if you're using the Intel platform, you'll see one device (the CPU), and if you're using the Nvidia platform, you'll see four devices (the GPUs). Specify OpenCLPlatformIndex when creating your Context to pick the platform.

I don't recommend trying to run multiple calculations at once at the CPU. The Intel platform treats the entire CPU, including all cores, as a single device. It will make use of all of them for a single simulation.

Peter

User avatar
Joshua Adelman
Posts: 20
Joined: Thu Feb 21, 2008 4:42 pm

Re: OpenCL Devices when GPU and CPU present

Post by Joshua Adelman » Mon Apr 22, 2013 11:52 am

Hi Peter,

Thanks for your reply. Is there a way on the OpenMM side to specify the OpenCL platform to use for a calculation? Is this just the OpenCLPlatformIndex property (I only found this digging around in the OpenMM Script Builder on Heroku)?

Josh

User avatar
Peter Eastman
Posts: 2593
Joined: Thu Aug 09, 2007 1:25 pm

Re: OpenCL Devices when GPU and CPU present

Post by Peter Eastman » Mon Apr 22, 2013 12:18 pm

Correct. See section 11.1 in the user guide. I also mentioned it in my previous post. :)

Peter

POST REPLY