raytracing - Optimal way to record ray intersection data for ray tracing using OpenCL -


i developing monte carlo ray tracer in opencl calculating 'view factors' radiative heat transfer analysis , wish know optimal way collate number of times object x intersected rays fired object i.

now basic algorithm follows :

  1. fire random ray, r, off surface of object i
  2. test intersection of ray r objects 0 - n
  3. determine first object intersected r, let object x
  4. record first intersection incrementing array of int's such array[i][x] +=1
  5. repeat total number of rays
  6. divide each value in ith row of array total number of arrays fired object i.

now typically in parallel implementation on cpu each thread maintain own copy of array[n] , when rays have been fired object i, master thread sum individual arrays results.

in opencl on gpu not practical solution when n increases there becomes shortage of local memory , using single array barriers cripple performance.

what best practical preforming reduction of results array or a memory barrier practical solution?

kernel a) described, writing own copies of array[n] global memory @ end.

kernel b) kernel reduction (that "master thread" in description).

make invocations of kernel set events upon completion. make invocation(s) of kernel b depend on events. use multiple invocations of kernel b pyramid reduction, taking 2 (or more, tuning may needed) arrays , writing out 1 sum. chain of events resolve dependencies , allow deep queuing.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -