Changes between Version 5 and Version 6 of OpenCLTransformation


Ignore:
Timestamp:
06/27/14 12:53:39 (12 years ago)
Author:
fuufusuu
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenCLTransformation

    v5 v6  
     1Note: err is just an int that will say whether the function executed properly, not part of translation at this time.
     2
    13This 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:
    24
     
    5961}}}
    6062
     63err = clEnqueueNDRangeKernel(commands, kernel, 1, NULL, &global, &local, 0, NULL, NULL);
     64
     65Starts 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
     82This method simulates the use of block workgroups
     83
     84{{{
     85void 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}}}
     96err = clEnqueueReadBuffer( commands, output, CL_TRUE, 0, sizeof(float) * count, results, 0, NULL, NULL ); 
     97
     98Puts 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}}}