示例#1
0
 /**
  * The program that this kernel belongs to
  *
  * @param kernel The kernel
  * @return The value
  */
 public static cl_program getProgram(cl_kernel kernel) {
   cl_program result = new cl_program();
   Infos.getPointer(Infos.FOR_KERNEL, kernel, CL_KERNEL_PROGRAM, result);
   if (result.equals(new cl_program())) {
     return null;
   }
   return result;
 }
 /**
  * The context of the program.
  *
  * @param program The program
  * @return The value
  */
 public static cl_context getContext(cl_program program) {
   cl_context result = new cl_context();
   Infos.getPointer(Infos.FOR_PROGRAM, program, CL_PROGRAM_CONTEXT, result);
   if (result.equals(new cl_context())) {
     return null;
   }
   return result;
 }
示例#3
0
 /**
  * The context that this kernel belongs to
  *
  * @param kernel The kernel
  * @return The value
  */
 public static cl_context getContext(cl_kernel kernel) {
   cl_context result = new cl_context();
   Infos.getPointer(Infos.FOR_KERNEL, kernel, CL_KERNEL_CONTEXT, result);
   if (result.equals(new cl_context())) {
     return null;
   }
   return result;
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * The program source code
  *
  * @param program The program
  * @return The value
  */
 public static String getSource(cl_program program) {
   return Infos.getString(Infos.FOR_PROGRAM, program, CL_PROGRAM_SOURCE);
 }
 /**
  * The number of devices associated with the program.
  *
  * @param program The program
  * @return The value
  */
 public static int getNumDevices(cl_program program) {
   return Infos.getInt(Infos.FOR_PROGRAM, program, CL_PROGRAM_NUM_DEVICES);
 }
 /**
  * The reference count. Only intended for identifying memory leaks.
  *
  * @param program The program
  * @return The value
  */
 public static int getReferenceCount(cl_program program) {
   return Infos.getInt(Infos.FOR_PROGRAM, program, CL_PROGRAM_REFERENCE_COUNT);
 }
 /**
  * The sizes of the program binaries for each device.
  *
  * @param program The program
  * @return The value
  */
 public static long[] getBinarySizes(cl_program program) {
   int numBinaries = getNumDevices(program);
   return Infos.getSizes(Infos.FOR_PROGRAM, program, CL_PROGRAM_BINARY_SIZES, numBinaries);
 }
示例#10
0
 /**
  * The number of arguments
  *
  * @param kernel The kernel
  * @return The value
  */
 public static int getNumArgs(cl_kernel kernel) {
   return Infos.getInt(Infos.FOR_KERNEL, kernel, CL_KERNEL_NUM_ARGS);
 }
示例#11
0
 /**
  * The reference count - only provided for identifying memory leaks.
  *
  * @param kernel The kernel
  * @return The value
  */
 public static int getReferenceCount(cl_kernel kernel) {
   return Infos.getInt(Infos.FOR_KERNEL, kernel, CL_KERNEL_REFERENCE_COUNT);
 }
示例#12
0
 /**
  * The kernel function name.
  *
  * @param kernel The kernel
  * @return The value
  */
 public static String getFunctionName(cl_kernel kernel) {
   return Infos.getString(Infos.FOR_KERNEL, kernel, CL_KERNEL_FUNCTION_NAME);
 }