Skip to content

Commit

Permalink
make code checks happy
Browse files Browse the repository at this point in the history
  • Loading branch information
VinInn committed May 10, 2022
1 parent 521d4c0 commit 9402cb7
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 52 deletions.
4 changes: 1 addition & 3 deletions CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SiPixelDigisCUDA {
public:
using StoreType = uint16_t;
SiPixelDigisCUDA() = default;
/*inline*/ SiPixelDigisCUDA(size_t maxFedWords, cudaStream_t stream);
SiPixelDigisCUDA(size_t maxFedWords, cudaStream_t stream);
~SiPixelDigisCUDA() = default;

SiPixelDigisCUDA(const SiPixelDigisCUDA &) = delete;
Expand Down Expand Up @@ -41,6 +41,4 @@ class SiPixelDigisCUDA {
uint32_t nDigis_h = 0;
};

// #include "SiPixelDigisCUDAImpl.h"

#endif // CUDADataFormats_SiPixelDigi_interface_SiPixelDigisCUDA_h
29 changes: 0 additions & 29 deletions CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDAImpl.h

This file was deleted.

29 changes: 28 additions & 1 deletion CUDADataFormats/SiPixelDigi/src/SiPixelDigisCUDA.cc
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
#include <cassert>

#include "CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h"
#include "CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDAImpl.h"
#include "HeterogeneousCore/CUDAUtilities/interface/cudaMemoryPool.h"
#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h"

SiPixelDigisCUDA::SiPixelDigisCUDA(size_t maxFedWords, cudaStream_t stream)
: m_store(memoryPool::cuda::makeBuffer<SiPixelDigisCUDA::StoreType>(
SiPixelDigisCUDASOAView::roundFor128ByteAlignment(maxFedWords) *
static_cast<int>(SiPixelDigisCUDASOAView::StorageLocation::kMAX),
stream,
memoryPool::onDevice)),
m_view(m_store, maxFedWords, SiPixelDigisCUDASOAView::StorageLocation::kMAX) {
assert(maxFedWords != 0);
}

memoryPool::Buffer<SiPixelDigisCUDA::StoreType> SiPixelDigisCUDA::copyAllToHostAsync(cudaStream_t stream) const {
auto ret = memoryPool::cuda::makeBuffer<StoreType>(
m_view.roundFor128ByteAlignment(nDigis()) * static_cast<int>(SiPixelDigisCUDASOAView::StorageLocationHost::kMAX),
stream,
memoryPool::onHost);
cudaCheck(cudaMemcpyAsync(ret.get(),
m_view.clus(),
m_view.roundFor128ByteAlignment(nDigis()) * sizeof(SiPixelDigisCUDA::StoreType) *
static_cast<int>(SiPixelDigisCUDASOAView::StorageLocationHost::kMAX),
cudaMemcpyDeviceToHost,
stream));
return ret;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ class TrackingRecHit2DHeterogeneous {

TrackingRecHit2DHeterogeneous() = default;

/*inline*/ TrackingRecHit2DHeterogeneous(uint32_t nHits,
bool isPhase2,
int32_t offsetBPIX2,
pixelCPEforGPU::ParamsOnGPU const* cpeParams,
uint32_t const* hitsModuleStart,
memoryPool::Where where,
cudaStream_t stream,
TrackingRecHit2DHeterogeneous const* input = nullptr);
TrackingRecHit2DHeterogeneous(uint32_t nHits,
bool isPhase2,
int32_t offsetBPIX2,
pixelCPEforGPU::ParamsOnGPU const* cpeParams,
uint32_t const* hitsModuleStart,
memoryPool::Where where,
cudaStream_t stream,
TrackingRecHit2DHeterogeneous const* input = nullptr);

// used on CPU only
/*inline*/ TrackingRecHit2DHeterogeneous(float* store32,
uint16_t* store16,
uint32_t* modules,
int nHits,
memoryPool::Where where = memoryPool::onCPU,
cudaStream_t stream = nullptr);
TrackingRecHit2DHeterogeneous(float* store32,
uint16_t* store16,
uint32_t* modules,
int nHits,
memoryPool::Where where = memoryPool::onCPU,
cudaStream_t stream = nullptr);
~TrackingRecHit2DHeterogeneous() = default;

TrackingRecHit2DHeterogeneous(const TrackingRecHit2DHeterogeneous&) = delete;
Expand All @@ -72,15 +72,15 @@ class TrackingRecHit2DHeterogeneous {
auto phiBinnerStorage() { return m_phiBinnerStorage; }
auto iphi() { return m_iphi; }

/*inline*/ Buffer<float> localCoordToHostAsync(cudaStream_t stream) const;
Buffer<float> localCoordToHostAsync(cudaStream_t stream) const;

/*inline*/ Buffer<uint32_t> hitsModuleStartToHostAsync(cudaStream_t stream) const;
Buffer<uint32_t> hitsModuleStartToHostAsync(cudaStream_t stream) const;

/*inline*/ Buffer<uint16_t> store16ToHostAsync(cudaStream_t stream) const;
/*inline*/ Buffer<float> store32ToHostAsync(cudaStream_t stream) const;
Buffer<uint16_t> store16ToHostAsync(cudaStream_t stream) const;
Buffer<float> store32ToHostAsync(cudaStream_t stream) const;

// needed for Host
/*inline*/ void copyFromGPU(TrackingRecHit2DHeterogeneous const* input, cudaStream_t stream);
void copyFromGPU(TrackingRecHit2DHeterogeneous const* input, cudaStream_t stream);

private:
static constexpr uint32_t n16 = 4; // number of elements in m_store16
Expand Down

0 comments on commit 9402cb7

Please sign in to comment.