hpe-cct / cct-core

CCT compiler, runtime, graphical debugger, and standard library
Apache License 2.0
15 stars 4 forks source link

OpenCL device selection logic ignores GeForce GT 750M when Iris Pro is present #8

Closed bchandle closed 8 years ago

bchandle commented 8 years ago

I'm seeing this behavior on a MacBook Pro with a discreet NVIDIA GPU. This is the debugging output with verboseOpenCLDevices and verboseOpenCLPlatform enabled:

Selecting OpenCL platform:   Apple OpenCL 1.2 (Apr 26 2016 00:05:53) with extensions [cl_APPLE_clut, cl_APPLE_query_kernel_names, cl_khr_gl_event, cl_APPLE_ContextLoggingFunctions, cl_APPLE_SetMemObjectDestructor, cl_APPLE_gl_sharing]
Selecting: CLDevice [id: 16925952 name: Iris Pro type: GPU profile: FULL_PROFILE]
Ignoring: CLDevice [id: 4294967295 name: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz type: CPU profile: FULL_PROFILE]
Ignoring: CLDevice [id: 16918272 name: GeForce GT 750M type: GPU profile: FULL_PROFILE]

The problem appears to be the GPU device selection code in OpenCLPlatform.createDevices():

val maxLocalMemSize = gpuDevices.map(_.getLocalMemSize).foldLeft(0L)(_ max _)
val bestGPUDevices = gpuDevices.filter(_.getLocalMemSize == maxLocalMemSize)
bestGPUDevices

The Iris Pro is a weaker GPU, but it's returning 65536 for getLocalMemSize compared to 49152 from the GT 750M. The CCT device selection logic is ignoring the NVIDIA GPU because of the comparatively smaller local memory.

@DickJC123, any suggestions on how to proceed? The simplest fix for this particular platform would be to return all GPU devices and let the user pick.

DickJC123 commented 8 years ago

I have eliminated the auto-pruning of "weak GPUs" that have less local memory than the best GPU on the platform (available in release v5.0.0-alpha.4). As before, choose the device you desire with the -Dcog.device=N JVM argument, or in your scala code as in:

val cg = new ComputeGraph(device=N) { ... }

Please verify this fix works for you.

bchandle commented 8 years ago

Yes, the fix works. The test suite isn't passing on either the Iris Pro or GT 750M right now, but I'll open separate issues for those problems.