Detecting same device on different platforms

Hi,

I would like to be able to automatically use all available devices on any given system. The problem I’m having is that I can’t find any way of telling if two devices on different platforms are in-fact the same device.

For example, I have a system that has 3 available platforms (Intel, Nvidia and AMD). The results of querying for all devices on all platforms are:

Platform #1
Name      : Intel(R) OpenCL
Vendor    : Intel(R) Corporation
Version   : OpenCL 1.1 LINUX
Device #1 : Intel(R) Core(TM)2 Duo CPU     E8500  @ 3.16GHz
-> Device ID   : 650862304
-> Vendor ID   : 32902
-> Vendor Name : Intel(R) Corporation

Platform #2
Name      : NVIDIA CUDA
Vendor    : NVIDIA Corporation
Version   : OpenCL 1.0 CUDA 4.0.1
Device #1 : GeForce GTX 285
-> Device ID   : 694609024
-> Vendor ID   : 4318
-> Vendor Name : NVIDIA Corporation

Platform #3
Name      : AMD Accelerated Parallel Processing
Vendor    : Advanced Micro Devices, Inc.
Version   : OpenCL 1.1 AMD-APP-SDK-v2.4 (595.10)
Device #1 : Intel(R) Core(TM)2 Duo CPU     E8500  @ 3.16GHz
-> Device ID   : 695052672
-> Vendor ID   : 4098
-> Vendor Name : GenuineIntel

The CPU seen by both AMD and Intel is the same, but there doesn’t seem to be any way of programatically detecting this, since they have different device IDs, different vendor IDs etc.

Is there a good way to achieve this that I’m not seeing?

Thanks in advance for any advice.

All CPUs are the same device. All GPUs are different devices. That’s pretty much the state of things today. It’s quick and dirty, but it will work.

That is, unless you are using IBM’s Common Runtime, in which case you can simply use that.

Fair enough, I guess that’s more or less the workaround I have at the moment.

Thanks very much.

I think there’s something more to this. Do you have an ATI GPU installed, and is it listed?

I’m having a similar problem, where I have an Intel CPU Q6600 showing up under the AMD OpenCL platform, e.g.,

    Platform [1]
        id         = 039970C4
        profile    = FULL_PROFILE
        version    = OpenCL 1.1 AMD-APP-SDK-v2.4 (650.9)
        name       = AMD Accelerated Parallel Processing
        vendor     = Advanced Micro Devices, Inc.
        extensions = cl_khr_icd
                     cl_amd_event_callback
                     cl_amd_offline_devices
                     cl_khr_d3d10_sharing

        1 Device detected
            Device [0]
                id                            = 03C38810
                type                          = CL_DEVICE_TYPE_CPU
                name                          = Intel(R) Core(TM)2 Quad CPU      @ 2.40GHz
                vendor                        = GenuineIntel

                driver version                = 2.0
                device version                = OpenCL 1.1 AMD-APP-SDK-v2.4 (650.9)
                profile                       = FULL_PROFILE
                max compute units             = 4
                max work items dimensions     = 3
                max work item sizes           = 1024 / 1024 / 1024
                max work group size           = 1024
                max clock frequency           = 2515 MHz
                address_bits                  = 32
                max mem alloc size            = 1024 MB
                global mem size               = 2048 MB
                image support                 = CL_TRUE
                max read image args           = 128
                max write image args          = 8
                2D image max size             = 8192 x 8192
                3D image max size             = 2048 x 2048 x 2048
                max samplers                  = 16
                max parameter size            = 4096
                mem base addr align           = 1024
                min data type align size      = 128
                single fp config              = CL_FP_DENORM CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST CL_FP_ROUND_TO_ZERO CL_FP_ROUND_TO_INF
                global mem cache type         = CL_READ_WRITE_CACHE
                global mem cacheline size     = 64
                global mem cache size         = 32768
                max constant buffer size      = 64 KB
                max constant args             = 8
                local mem type                = CL_GLOBAL
                local mem size                = 32 KB
                error correction support      = CL_FALSE
                profiling timer resolution    = 407 ns
                endian little                 = CL_TRUE
                available                     = CL_TRUE
                compiler available            = CL_TRUE
                execution capabilities        = CL_EXEC_KERNEL CL_EXEC_NATIVE_KERNEL
                queue properties              = CL_QUEUE_PROFILING_ENABLE
                extensions                    = cl_khr_fp64
                                                cl_amd_fp64
                                                cl_khr_global_int32_base_atomics

                                                cl_khr_global_int32_extended_atomics
                                                cl_khr_local_int32_base_atomics
                                                cl_khr_local_int32_extended_atomics
                                                cl_khr_byte_addressable_store
                                                cl_khr_gl_sharing
                                                cl_ext_device_fission
                                                cl_amd_device_attribute_query
                                                cl_amd_vec3
                                                cl_amd_media_ops
                                                cl_amd_popcnt
                                                cl_amd_printf
                                                cl_khr_d3d10_sharing

What is interesting is that my CPU cannot support OpenCL because it doesn’t support SSE4–at least that’s according to the Intel OpenCL SDK. Moreover, I haven’t installed the Intel OpenCL SDK either. I have an ATI GPU card (HD 6450) and an NVIDIA GPU installed. The NVIDIA GPU shows up fine in the NVIDIA platform. But, there is no device with the HD 6450 listed explicitly.

I’m wondering if there is a bug here. In one case, it could be that the AMD OpenCL is reporting the ATI card as a “CPU”/“Intel”. Or, in another case, the AMD card isn’t being recognized, and that AMD gratuitously implemented OpenCL for all multicore x86 CPUs, including Intel. I haven’t gotten to the bottom of this yet because it’s so hard removing these stupid PCIe video cards with that latch. You need to have fingers the size of a mouse.

Ken

The AMD OpenCL SDK does indeed work for all x86 CPUs, including Intels. Perhaps AMD’s driver works differently to Intel’s and doesn’t require SSE4. My guess is the latter of your hunches - the ATI card isn’t being recognised. When I plug my ATI card in it is picked up alongside the CPU.

In any case, its not the same problem - in my case the CPU is legitimately being picked up by both AMD and Intel.