Skip to content

Commit

Permalink
Implement library-only wrappers for launching CUDA kernels (#390)
Browse files Browse the repository at this point in the history
Implement a wrapper to launch a CUDA kernel without using the
non-standard CUDA <<<...>>> syntax, based on the cudaLaunchKernel
library function.

Implement a similar wrapper for cudaLaunchCooperativeKernel.

Migrate code base from cuda::launch to cudautils::launch.
  • Loading branch information
cmsbuild authored and fwyzard committed Dec 25, 2020
1 parent 1d61155 commit 55a3fce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions RecoLocalTracker/SiPixelClusterizer/test/gpuClustering_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <cuda/api_wrappers.h>

#include "HeterogeneousCore/CUDAUtilities/interface/exitSansCUDADevices.h"
#include "HeterogeneousCore/CUDAUtilities/interface/launch.h"
#endif

#include "RecoLocalTracker/SiPixelClusterizer/plugins/gpuClustering.h"
Expand Down Expand Up @@ -263,7 +264,7 @@ int main(void) {
std::cout << "CUDA countModules kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock
<< " threads\n";

cuda::launch(countModules, {blocksPerGrid, threadsPerBlock}, d_id.get(), d_moduleStart.get(), d_clus.get(), n);
cudautils::launch(countModules, {blocksPerGrid, threadsPerBlock}, d_id.get(), d_moduleStart.get(), d_clus.get(), n);

blocksPerGrid = MaxNumModules; //nModules;

Expand All @@ -272,7 +273,7 @@ int main(void) {

cuda::memory::device::zero(d_clusInModule.get(), MaxNumModules * sizeof(uint32_t));

cuda::launch(findClus,
cudautils::launch(findClus,
{blocksPerGrid, threadsPerBlock},
d_id.get(),
d_x.get(),
Expand Down Expand Up @@ -300,7 +301,7 @@ int main(void) {
if (ncl != std::accumulate(nclus, nclus + MaxNumModules, 0))
std::cout << "ERROR!!!!! wrong number of cluster found" << std::endl;

cuda::launch(clusterChargeCut,
cudautils::launch(clusterChargeCut,
{blocksPerGrid, threadsPerBlock},
d_id.get(),
d_adc.get(),
Expand Down

0 comments on commit 55a3fce

Please sign in to comment.