Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /DataFormats/GeometrySurface/test/gpuFrameTransformKernel.cu is written in an unsupported language. File is not indexed.

0001 #include <cstdint>
0002 #include <iostream>
0003 #include <iomanip>
0004 
0005 #include "DataFormats/GeometrySurface/interface/SOARotation.h"
0006 #include "HeterogeneousCore/CUDAUtilities/interface/launch.h"
0007 
0008 __global__ void toGlobal(SOAFrame<float> const* frame,
0009                          float const* xl,
0010                          float const* yl,
0011                          float* x,
0012                          float* y,
0013                          float* z,
0014                          float const* le,
0015                          float* ge,
0016                          uint32_t n) {
0017   int i = blockDim.x * blockIdx.x + threadIdx.x;
0018   if (i >= n)
0019     return;
0020 
0021   frame[0].toGlobal(xl[i], yl[i], x[i], y[i], z[i]);
0022   frame[0].toGlobal(le[3 * i], le[3 * i + 1], le[3 * i + 2], ge + 6 * i);
0023 }
0024 
0025 void toGlobalWrapper(SOAFrame<float> const* frame,
0026                      float const* xl,
0027                      float const* yl,
0028                      float* x,
0029                      float* y,
0030                      float* z,
0031                      float const* le,
0032                      float* ge,
0033                      uint32_t n) {
0034   int threadsPerBlock = 256;
0035   int blocksPerGrid = (n + threadsPerBlock - 1) / threadsPerBlock;
0036   std::cout << "CUDA toGlobal kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads"
0037             << std::endl;
0038 
0039   cms::cuda::launch(toGlobal, {blocksPerGrid, threadsPerBlock}, frame, xl, yl, x, y, z, le, ge, n);
0040 }