Results 1 to 4 of 4

Thread: device select on MacBookPro

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    2

    device select on MacBookPro

    Hello! Please be a little forgiving, I'm learning C and OpenCL at the same time
    I'm busy querying devices on my mbp to make a choice which gpu to use. I have set up a list of devices with
    Code :
    cl_device_id allCLdevices[4] ;
    cl_device_id *selectedCLdevice = &allCLdevices[0];
    and
    Code :
    err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 2, allCLdevices, &numberOfCLdevices);
    when I'm getting info about the devices with
    Code :
    for (int devNr=0; devNr<numberOfCLdevices; devNr++) {
         selectedCLdevice = &allCLdevices[devNr]; 
         err = clGetDeviceInfo(*selectedCLdevice, CL_DEVICE_NAME, sizeof(device_name), device_name, NULL);
         printf("device %d: \t\t\t\t%s\n", devNr, device_name);
         ...
    };
    all present GPUs are listed (two of them). Now I'm running the whole (test-)calculation on the CPU, which works fine.
    After that I'm running the same CL-routine on the gpu, where I'm trying to select a device with
    Code :
    if (numberOfCLdevices > 1) {
    			selectedCLdevice = &allCLdevices[1];
    			printf("%s, (%d devices)\n", device, numberOfCLdevices);
    		}else {
    			selectedCLdevice = &allCLdevices[0];
    		};
    To select the "bigger" GPU on the MacBookPro, which is not being used for display, I'm choosing the selectedCLdevice = &allCLdevices[1], whenever there is more than one device.

    Problem:

    selectedCLdevice = &allCLdevices[0] will work (also in the GPU-run), selectedCLdevice = &allCLdevices[1] will give me a nice litte
    Code :
    creating queue... 		queue error number -2
    i.e. CL_DEVICE_NOT_AVAILABLE
    coming from
    Code :
    commandQueue = clCreateCommandQueue(CLcontext, *selectedCLdevice , 0,  &err);

    Shouldn't the secondary gpu, that I'm not using for display, be available for OpenCL just like the first one? Or did I make a mistake with the pointers or the allCLdevices-list?
    Thanks

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: device select on MacBookPro

    That is really a question for Apple. Maybe Affie will see your post and comment.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Posts
    29

    Re: device select on MacBookPro

    The specific model of the MacBookPro and the energy settings selected by the user (e.g. to conserve battery) effect device availability. These factors may also effect the order of devices in the list returned by clGetDeviceIDs. Your program can check to see if a device is available before attempting to create a command queue on it with the CL_DEVICE_AVAILABLE enum of clGetDeviceInfo.

  4. #4
    Junior Member
    Join Date
    Jul 2011
    Posts
    1

    Re: device select on MacBookPro

    Quote Originally Posted by ajs2
    The specific model of the MacBookPro and the energy settings selected by the user (e.g. to conserve battery) effect device availability. These factors may also effect the order of devices in the list returned by clGetDeviceIDs. Your program can check to see if a device is available before attempting to create a command queue on it with the CL_DEVICE_AVAILABLE enum of clGetDeviceInfo.
    Good to find out about the the settings (energy). Why would it effect the order of the devices, though. That doesn't make sense to me.

Similar Threads

  1. about SELECT mechanism
    By vrmm in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 07-27-2004, 02:05 AM

Posting Permissions

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