How do I launch rays in parallel inside raygen function? #182
-
I want to launch two rays in parallel in OPTIX_RAYGEN_PROGRAM(rayGen). I understand the first step is to assign two threads per query point. owl::Ray ray1 = owl::Ray(...); I want ray1 and ray2 to be launched in parallel. Any ideas as to how to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The raygen program is always executed NxM times in parallel, where N and M are the "dimensions" of that launch that you specify in owlLaunch2D(...,N,M,...). Note this is exactly the same way you would launch parallel work in CUDA - the code/program you're writing is always for one thread, and the parallelism comes from launching this NxM(xK) times. So for your example above of tracing two rays in parallel, you'd specify a launch dimension of 2x1 in owlLaunch, and in the raygen program trace only one ray - using a different ray for each launch index (see optxGetLaunchIndex()). That said, I'm not sure if "two" rays is a useful degree of parallelism to employ here: GPUs are typically designed/intended for literally thousands of parallel work items - "two" will not even utilize one warp, let alone one SM, let alone an entire GPU. |
Beta Was this translation helpful? Give feedback.
The raygen program is always executed NxM times in parallel, where N and M are the "dimensions" of that launch that you specify in owlLaunch2D(...,N,M,...). Note this is exactly the same way you would launch parallel work in CUDA - the code/program you're writing is always for one thread, and the parallelism comes from launching this NxM(xK) times.
So for your example above of tracing two rays in parallel, you'd specify a launch dimension of 2x1 in owlLaunch, and in the raygen program trace only one ray - using a different ray for each launch index (see optxGetLaunchIndex()).
That said, I'm not sure if "two" rays is a useful degree of parallelism to employ here: GPUs are typically designe…