RAJA icon indicating copy to clipboard operation
RAJA copied to clipboard

Perfectly nested loops in RAJA::launch

Open artv3 opened this issue 3 years ago • 0 comments

Users would like a simple interface to express the following types of computing patterns:

RAJA::Launch(..., [&]() {
   // Loop for z thread with inner loops for x and y threads
   RAJA::loop<z>(num_threads_in_z, [&](int z) {
      // 2D perfectly nested block but the z thread is "free"
      RAJA::loop<xy>(dim, dim, [&](int d1, int d2) {
         ...
      });
      // 2D perfectly nested block but only 1 index
      RAJA::loop<flatten<xy>>(dofs, [&](int j) {
         ...
      });
      // Only 1 thread in xy
      RAJA::loop<once<xy>>([&]() {
         ...
      });
   });
   // 3D perfectly nested block
   RAJA::loop<xyz>(qpts, qpts, qpts, [&](int jx, int jy, int jz) {
      ...
   });
   // 3D perfectly nested block but only 1 index
   RAJA::loop<flatten<xyz>>(size, [&](int i) {
      ...
   });
});

artv3 avatar Oct 14 '22 20:10 artv3