| | 63 | err = clEnqueueNDRangeKernel(commands, kernel, 1, NULL, &global, &local, 0, NULL, NULL); |
| | 64 | |
| | 65 | Starts taking all the information gathered and queues up work and workgroups using the specified commands, kernel, global worksize, and local work size. |
| | 66 | |
| | 67 | {{{ |
| | 68 | $proc procs[global/local]; |
| | 69 | for(int i = 0; i < global/local; i++) |
| | 70 | { |
| | 71 | param[i].workgroup = i; |
| | 72 | //procs[i] = $spawn square(param[i].global_id, param[i].input, param[i].output, param[i].count); |
| | 73 | procs[i] = $spawn worksquare(local, global, param[i]); |
| | 74 | } |
| | 75 | |
| | 76 | for(int i = 0; i < global/local; i++) |
| | 77 | { |
| | 78 | $wait(procs[i]); |
| | 79 | } |
| | 80 | }}} |
| | 81 | |
| | 82 | This method simulates the use of block workgroups |
| | 83 | |
| | 84 | {{{ |
| | 85 | void worksquare(size_t local, size_t global, kernel param) |
| | 86 | { |
| | 87 | for(int i = local * param.workgroup; i < local * param.workgroup + local; i++) |
| | 88 | { |
| | 89 | param.local_id = i % local; |
| | 90 | param.global_id = i; |
| | 91 | //printf("My workgroup id is %d, my global id is %d, my local id is %d\n", param.workgroup, param.global_id, param.local_id); |
| | 92 | square(param.workgroup, param.global_id, param.local_id, param.input, param.output, param.count); |
| | 93 | } |
| | 94 | } |
| | 95 | }}} |
| | 96 | err = clEnqueueReadBuffer( commands, output, CL_TRUE, 0, sizeof(float) * count, results, 0, NULL, NULL ); |
| | 97 | |
| | 98 | Puts the data from a kernel from one of the variables passed in to another variable. |
| | 99 | |
| | 100 | {{{ |
| | 101 | memcpy(results, output, sizeof(int) * count); |
| | 102 | }}} |