Results 1 to 6 of 6

Thread: Unique device/implementation name

  1. #1
    Senior Member
    Join Date
    Nov 2009
    Posts
    118

    Unique device/implementation name

    Is there a better way than :
    devicesInfos.vendorID + deviceInfos.name + platformInfos.version
    to find and unique identifier for a device on an implementation?

    This permit to find a file name for each potentially different binary produced by opencl compilers.

  2. #2
    Junior Member
    Join Date
    Mar 2010
    Posts
    5

    Re: Unique device/implementation name

    Quote Originally Posted by matrem
    Is there a better way than :
    devicesInfos.vendorID + deviceInfos.name + platformInfos.version
    to find and unique identifier for a device on an implementation?

    This permit to find a file name for each potentially different binary produced by opencl compilers.
    Hash the string "devicesInfos.vendorID + deviceInfos.name + platformInfos.version" with MD5 or SHA1, and use the hash for the filename.

  3. #3

    Re: Unique device/implementation name

    I went nuts and used everything I could find:
    Code :
    static std::string GetUniqueDeviceName(const cl::Device &device)
    {
      std::string uname;
      uname += DeviceTypeToString(device.getInfo<CL_DEVICE_TYPE>());
      uname += device.getInfo<CL_DEVICE_VENDOR>();
      uname += NumberToString(device.getInfo<CL_DEVICE_VENDOR_ID>());
      uname += device.getInfo<CL_DEVICE_NAME>();
      uname += device.getInfo<CL_DEVICE_VERSION>();
      uname += device.getInfo<CL_DEVICE_PROFILE>();
      uname += device.getInfo<CL_DEVICE_EXTENSIONS>();
     
      return uname;
    }

    It sure would be nice if the spec said what the minimal set was to associate with binaries.

    Based on another thread though there may not be anything possible at this point:

    Quote Originally Posted by dbs2
    Quote Originally Posted by coleb
    For the foreseeable future we're going to have to do individual builds for each vendor's hardware platform. We already do it for x86 vs x64 vs PPC vs sparc. Ideally, we can make "universal" binaries that support the major implementations: NVidia and ATI.
    Good luck! This is really hard to get right with the current API. E.g., on a Mac, if you compile on an SSE4.2 machine your saved kernel binary will crash on an SSE4.1 or SSSE3 machine with invalid instructions. This is unfortunately not a very well thought-out part of the design.
    viewtopic.php?f=28&t=2617

  4. #4
    Senior Member
    Join Date
    Nov 2009
    Posts
    118

    Re: Unique device/implementation name

    Hash is a good idea for file name (because some returned string are not valid file name ).

    SSE3 and SSE4 machine should not have same device, so two differents ID?

  5. #5
    Junior Member
    Join Date
    Mar 2010
    Posts
    5

    Re: Unique device/implementation name

    Quote Originally Posted by matrem
    Hash is a good idea for file name (because some returned string are not valid file name ).

    SSE3 and SSE4 machine should not have same device, so two differents ID?
    Are you talking about a CPU OpenCL implementation ??
    If you have a CPU OpenCL (like AMD) then, I don't know if AMD expose in the "system infos" the fact that you are on a machine with SSE[3|4], that strings are implementation dependant.

  6. #6
    Senior Member
    Join Date
    Sep 2002
    Location
    Santa Clara
    Posts
    105

    Re: Unique device/implementation name

    A hash generated for the string CL_DEVICE_VENDOR_ID + CL_DEVICE_NAME should be sufficient to identify a unique device identifier. You may want to include CL_DRIVER_VERSION as well.

    WRT following comment "Good luck! This is really hard to get right with the current API. E.g., on a Mac, if you compile on an SSE4.2 machine your saved kernel binary will crash on an SSE4.1 or SSSE3 machine with invalid instructions. This is unfortunately not a very well thought-out part of the design." this looks like a bug with the Mac OS X OpenCL implementation. A SSE4.1 device should either have a different vendor ID or different device name vs. a SSSE3 device. Please file an appropriate bug with your ADC account against Mac OS X OpenCL.

Similar Threads

  1. unique kernel names?
    By qwer in forum OpenCL
    Replies: 4
    Last Post: 12-26-2010, 08:49 AM
  2. Replies: 3
    Last Post: 05-12-2010, 03:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •