Changes between Version 2 and Version 3 of OpenCLTransformation
- Timestamp:
- 06/26/14 14:49:03 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
OpenCLTransformation
v2 v3 1 1 This 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: 2 2 3 clGetDeviceIDs(NULL, gpu ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU, 1, &device_id, NULL);3 err = clGetDeviceIDs(NULL, gpu ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU, 1, &device_id, NULL); 4 4 5 5 This 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. … … 14 14 } 15 15 }}} 16 17 kernel = clCreateKernel(program, "square", &err); 18 19 Creates 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 21 input = clCreateBuffer(context, CL_MEM_READ_ONLY, sizeof(float) * count, NULL, NULL); 22 23 clCreateBuffer 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 {{{ 25 input = (int *) malloc(sizeof(int) * count); 26 }}} 27 28 err = clEnqueueWriteBuffer(commands, input, CL_TRUE, 0, sizeof(float) * count, data, 0, NULL, NULL); 29 30 clEnqueueWriteBuffer writes to a buffer with extra data. In the transformation it is currently a memcpy. 31 {{{ 32 memcpy(input, data, sizeof(int) * count); 33 }}}
