forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separated EndcapGeometry into host-only and buffers struct
- Loading branch information
Showing
8 changed files
with
117 additions
and
102 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef EndcapGeometryBuffers_h | ||
#define EndcapGeometryBuffers_h | ||
|
||
#include <map> | ||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <string> | ||
#include <vector> | ||
#include <stdexcept> | ||
|
||
#include "HeterogeneousCore/AlpakaInterface/interface/host.h" | ||
|
||
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h" | ||
|
||
namespace SDL { | ||
|
||
struct endcapGeom { | ||
const unsigned int* geoMapDetId; | ||
const float* geoMapPhi; | ||
|
||
template <typename TBuff> | ||
void setData(const TBuff& endcapgeombuf) { | ||
geoMapDetId = alpaka::getPtrNative(endcapgeombuf.geoMapDetId_buf); | ||
geoMapPhi = alpaka::getPtrNative(endcapgeombuf.geoMapPhi_buf); | ||
} | ||
}; | ||
|
||
template <typename TDev> | ||
struct endcapGeometryBuffer : endcapGeom { | ||
Buf<TDev, unsigned int> geoMapDetId_buf; | ||
Buf<TDev, float> geoMapPhi_buf; | ||
|
||
endcapGeometryBuffer(TDev const& dev, unsigned int nEndCapMap) | ||
: geoMapDetId_buf(allocBufWrapper<unsigned int>(dev, nEndCapMap)), | ||
geoMapPhi_buf(allocBufWrapper<float>(dev, nEndCapMap)) { | ||
setData(*this); | ||
} | ||
|
||
template <typename TQueue, typename TDevSrc> | ||
inline void copyFromSrc(TQueue queue, const endcapGeometryBuffer<TDevSrc>& src) { | ||
alpaka::memcpy(queue, geoMapDetId_buf, src.geoMapDetId_buf); | ||
alpaka::memcpy(queue, geoMapPhi_buf, src.geoMapPhi_buf); | ||
} | ||
|
||
template <typename TQueue> | ||
endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer<alpaka::DevCpu>& src, unsigned int nEndCapMap) { | ||
copyFromSrc(queue, src); | ||
} | ||
|
||
inline SDL::endcapGeom const* data() const { return this; } | ||
}; | ||
|
||
} // namespace SDL | ||
|
||
#endif |
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
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
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