-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
66 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,47 @@ | ||
#include "CUDADataFormats/SiPixelDigi/interface/SiPixelDigiErrorsCUDA.h" | ||
|
||
#include "HeterogeneousCore/CUDAUtilities/interface/cudaMemoryPool.h" | ||
#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" | ||
|
||
|
||
SiPixelDigiErrorsCUDA::SiPixelDigiErrorsCUDA(size_t maxFedWords, SiPixelFormatterErrors errors, cudaStream_t stream) : | ||
formatterErrors_h(std::move(errors)), | ||
nErrorWords_(maxFedWords) { | ||
assert(maxFedWords != 0); | ||
|
||
memoryPool::Deleter deleter = memoryPool::Deleter(std::make_shared<memoryPool::cuda::BundleDelete>(stream, memoryPool::onDevice)); | ||
assert(deleter.pool()); | ||
|
||
data_d = memoryPool::cuda::make_buffer<SiPixelErrorCompact>(maxFedWords, deleter); | ||
error_d = memoryPool::cuda::make_buffer<SiPixelErrorCompactVector>(1,deleter); | ||
error_h = memoryPool::cuda::make_buffer<SiPixelErrorCompactVector>(1,stream,memoryPool::onHost); | ||
|
||
|
||
cudaMemsetAsync(data_d.get(), 0x00, maxFedWords, stream); | ||
|
||
cms::cuda::make_SimpleVector(error_h.get(), maxFedWords, data_d.get()); | ||
assert(error_h->empty()); | ||
assert(error_h->capacity() == static_cast<int>(maxFedWords)); | ||
|
||
cudaCheck(memoryPool::cuda::copy(error_d, error_h, 1,stream)); | ||
} | ||
|
||
void SiPixelDigiErrorsCUDA::copyErrorToHostAsync(cudaStream_t stream) { | ||
cudaCheck(memoryPool::cuda::copy(error_h, error_d, 1,stream)); | ||
} | ||
|
||
SiPixelDigiErrorsCUDA::HostDataError SiPixelDigiErrorsCUDA::dataErrorToHostAsync(cudaStream_t stream) const { | ||
// On one hand size() could be sufficient. On the other hand, if | ||
// someone copies the SimpleVector<>, (s)he might expect the data | ||
// buffer to actually have space for capacity() elements. | ||
auto data = memoryPool::cuda::make_buffer<SiPixelErrorCompact>(error_h->capacity(), stream, memoryPool::onHost); | ||
|
||
// but transfer only the required amount | ||
if (not error_h->empty()) { | ||
cudaCheck(memoryPool::cuda::copy(data, data_d, error_h->size(), stream)); | ||
} | ||
auto err = *error_h; | ||
err.set_data(data.get()); | ||
return HostDataError(err, std::move(data)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
#include "CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h" | ||
#include "CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDAImpl.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneousImpl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
CUDADataFormats/TrackingRecHit/src/TrackingRecHit2DHeterogeneous.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include "CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneousImpl.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters