Changes between Version 2 and Version 3 of OpenCLTransformation


Ignore:
Timestamp:
06/26/14 14:49:03 (12 years ago)
Author:
fuufusuu
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenCLTransformation

    v2 v3  
    11This iteration of the transformation is rather basic, with functions broken down into bare essentials. They may be transformed into slightly more complicated functions as time goes on. For now, here is what their equivalents are, using example code:
    22
    3 clGetDeviceIDs(NULL, gpu ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU, 1, &device_id, NULL);
     3err = clGetDeviceIDs(NULL, gpu ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU, 1, &device_id, NULL);
    44
    55This function in openCL will query for devices then put their ID into the pointer &device_id. In the transformation it puts in arbitrary numbers for ID.
     
    1414  }
    1515}}}
     16
     17kernel = clCreateKernel(program, "square", &err);
     18
     19Creates the kernel using data from the program, and the name of the function. In the transformation it chooses which function to use. Currently unimplemented.
     20
     21input = clCreateBuffer(context,  CL_MEM_READ_ONLY,  sizeof(float) * count, NULL, NULL);
     22
     23clCreateBuffer creates a buffer object with certain types of information attached to it. In the .cvl it only uses the right side with the third parameter, and mallocs space for it
     24{{{
     25input = (int *) malloc(sizeof(int) * count);
     26}}}
     27
     28err = clEnqueueWriteBuffer(commands, input, CL_TRUE, 0, sizeof(float) * count, data, 0, NULL, NULL);
     29
     30clEnqueueWriteBuffer writes to a buffer with extra data. In the transformation it is currently a memcpy.
     31{{{
     32memcpy(input, data, sizeof(int) * count);
     33}}}