Exemplo n.º 1
0
 /**
  * The devices associated with the program.
  *
  * @param program The program
  * @return The value
  */
 public static cl_device_id[] getDevices(cl_program program) {
   int numDevices = getNumDevices(program);
   cl_device_id devices[] = new cl_device_id[numDevices];
   Infos.getPointers(Infos.FOR_PROGRAM, program, CL_PROGRAM_DEVICES, devices);
   cl_device_id nullDevice = new cl_device_id();
   for (int i = 0; i < numDevices; i++) {
     if (devices[i].equals(nullDevice)) {
       devices[i] = null;
     }
   }
   return devices;
 }
Exemplo n.º 2
0
 /**
  * The sizes of the program binaries for each device.
  *
  * @param program The program
  * @return The value
  */
 public static String[] getBinaries(cl_program program) {
   int numBinaries = getNumDevices(program);
   long sizes[] = getBinarySizes(program);
   byte dataArrays[][] = new byte[numBinaries][];
   Pointer dataPointers[] = new Pointer[numBinaries];
   for (int i = 0; i < numBinaries; i++) {
     dataArrays[i] = new byte[(int) sizes[i]];
     dataPointers[i] = Pointer.to(dataArrays[i]);
   }
   Infos.getPointers(Infos.FOR_PROGRAM, program, CL_PROGRAM_BINARIES, dataPointers);
   String dataStrings[] = new String[numBinaries];
   for (int i = 0; i < numBinaries; i++) {
     dataStrings[i] = new String(dataArrays[i], 0, (int) sizes[i] - 1);
   }
   return dataStrings;
 }