forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addressing comments and adding new features
- Loading branch information
1 parent
b4dede0
commit b64e14b
Showing
60 changed files
with
432 additions
and
505 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
CondFormats/SiPixelObjects/interface/alpaka/SiPixelGainCalibrationForHLTDevice.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,13 @@ | ||
#ifndef CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTDevice_h | ||
#define CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTDevice_h | ||
|
||
#include <alpaka/alpaka.hpp> | ||
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLTLayout.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE { | ||
|
||
using SiPixelGainCalibrationForHLTDevice = PortableCollection<SiPixelGainCalibrationForHLTSoA>; | ||
|
||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE | ||
#endif // CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTDevice_h |
41 changes: 41 additions & 0 deletions
41
CondFormats/SiPixelObjects/interface/alpaka/SiPixelGainCalibrationForHLTUtilities.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,41 @@ | ||
#ifndef CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTUtilities_h | ||
#define CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTUtilities_h | ||
|
||
#include <cstdint> | ||
#include <alpaka/alpaka.hpp> | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLTLayout.h" | ||
|
||
struct SiPixelGainUtilities { | ||
ALPAKA_FN_HOST_ACC ALPAKA_FN_ACC ALPAKA_FN_INLINE static std::pair<float, float> getPedAndGain( | ||
const SiPixelGainCalibrationForHLTSoAConstView& view, | ||
uint32_t moduleInd, | ||
int col, | ||
int row, | ||
bool& isDeadColumn, | ||
bool& isNoisyColumn) { | ||
auto start = view.modStarts()[moduleInd]; | ||
auto end = view.modEnds()[moduleInd]; | ||
auto nCols = view.modCols()[moduleInd]; | ||
// determine what averaged data block we are in (there should be 1 or 2 of these depending on if plaquette is 1 by X or 2 by X | ||
unsigned int lengthOfColumnData = (end - start) / nCols; | ||
unsigned int lengthOfAveragedDataInEachColumn = 2; // we always only have two values per column averaged block | ||
unsigned int numberOfDataBlocksToSkip = row / view.numberOfRowsAveragedOver(); | ||
|
||
auto offset = start + col * lengthOfColumnData + lengthOfAveragedDataInEachColumn * numberOfDataBlocksToSkip; | ||
assert(offset < end); | ||
assert(offset < 3088384); | ||
assert(0 == offset % 2); | ||
|
||
auto lp = view.v_pedestals(); | ||
auto s = lp[offset / 2]; | ||
|
||
isDeadColumn = (s.ped & 0xFF) == view.deadFlag(); | ||
isNoisyColumn = (s.ped & 0xFF) == view.noisyFlag(); | ||
float decodeGain = float(s.gain & 0xFF) * view.gainPrecision() + view.minGain(); | ||
float decodePed = float(s.ped & 0xFF) * view.pedPrecision() + view.minPed(); | ||
|
||
return std::make_pair(decodePed, decodeGain); | ||
}; | ||
}; | ||
|
||
#endif //CondFormats_SiPixelObjects_interface_alpaka_SiPixelGainCalibrationForHLTUtilities_h |
17 changes: 17 additions & 0 deletions
17
CondFormats/SiPixelObjects/interface/alpaka/SiPixelMappingDevice.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,17 @@ | ||
#ifndef CondFormats_SiPixelObjects_interface_alpaka_SiPixelMappingDevice_h | ||
#define CondFormats_SiPixelObjects_interface_alpaka_SiPixelMappingDevice_h | ||
|
||
#include <cstdint> | ||
#include <alpaka/alpaka.hpp> | ||
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelMappingLayout.h" | ||
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESProducer.h" | ||
#include "DataFormats/Portable/interface/PortableHostCollection.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE { | ||
|
||
using SiPixelMappingDevice = PortableCollection<SiPixelMappingSoA>; | ||
|
||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE | ||
|
||
#endif // DataFormats_SiPixelMappingSoA_alpaka_SiPixelClustersDevice_h |
53 changes: 53 additions & 0 deletions
53
CondFormats/SiPixelObjects/interface/alpaka/SiPixelMappingUtilities.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,53 @@ | ||
#ifndef CondFormats_SiPixelObjects_interface_alpaka_SiPixelMappingUtilities_h | ||
#define CondFormats_SiPixelObjects_interface_alpaka_SiPixelMappingUtilities_h | ||
|
||
#include <cstdint> | ||
#include <alpaka/alpaka.hpp> | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelMappingLayout.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE { | ||
|
||
struct SiPixelMappingUtilities { | ||
ALPAKA_FN_HOST_ACC ALPAKA_FN_ACC ALPAKA_FN_INLINE static bool hasQuality(const SiPixelMappingSoAConstView& view) { | ||
return view.hasQuality(); | ||
} | ||
|
||
ALPAKA_FN_HOST_ACC ALPAKA_FN_ACC ALPAKA_FN_INLINE static cms::alpakatools::device_buffer<Device, unsigned char[]> | ||
getModToUnpRegionalAsync(std::set<unsigned int> const& modules, | ||
const SiPixelFedCablingTree* cabling, | ||
std::vector<unsigned int> const& fedIds, | ||
Queue& queue) { | ||
auto modToUnpDevice = cms::alpakatools::make_device_buffer<unsigned char[]>(queue, pixelgpudetails::MAX_SIZE); | ||
auto modToUnpHost = cms::alpakatools::make_host_buffer<unsigned char[]>(queue, pixelgpudetails::MAX_SIZE); | ||
|
||
unsigned int startFed = fedIds.front(); | ||
unsigned int endFed = fedIds.back() - 1; | ||
|
||
sipixelobjects::CablingPathToDetUnit path; | ||
int index = 1; | ||
|
||
for (unsigned int fed = startFed; fed <= endFed; fed++) { | ||
for (unsigned int link = 1; link <= pixelgpudetails::MAX_LINK; link++) { | ||
for (unsigned int roc = 1; roc <= pixelgpudetails::MAX_ROC; roc++) { | ||
path = {fed, link, roc}; | ||
const sipixelobjects::PixelROC* pixelRoc = cabling->findItem(path); | ||
if (pixelRoc != nullptr) { | ||
modToUnpHost[index] = (not modules.empty()) and (modules.find(pixelRoc->rawId()) == modules.end()); | ||
} else { // store some dummy number | ||
modToUnpHost[index] = true; | ||
} | ||
index++; | ||
} | ||
} | ||
} | ||
|
||
alpaka::memcpy(queue, modToUnpDevice, modToUnpHost); | ||
|
||
return modToUnpDevice; | ||
} | ||
}; | ||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE | ||
#endif //CondFormats_SiPixelObjects_interface_alpaka_SiPixelMappingUtilities_h |
4 changes: 4 additions & 0 deletions
4
CondFormats/SiPixelObjects/src/alpaka/T_EventSetup_SiPixelGainCalibrationForHLTDevice.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,4 @@ | ||
#include "CondFormats/SiPixelObjects/interface/alpaka/SiPixelGainCalibrationForHLTDevice.h" | ||
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/typelookup.h" | ||
|
||
TYPELOOKUP_ALPAKA_DATA_REG(SiPixelGainCalibrationForHLTDevice); |
4 changes: 4 additions & 0 deletions
4
CondFormats/SiPixelObjects/src/alpaka/T_EventSetup_SiPixelMappingDevice.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,4 @@ | ||
#include "CondFormats/SiPixelObjects/interface/alpaka/SiPixelMappingDevice.h" | ||
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/typelookup.h" | ||
|
||
TYPELOOKUP_ALPAKA_DATA_REG(SiPixelMappingDevice); |
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
6 changes: 3 additions & 3 deletions
6
DataFormats/SiPixelClusterSoA/src/alpaka/classes_cuda_def.xml
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,6 +1,6 @@ | ||
<lcgdict> | ||
<class name="alpaka_cuda_async::PortableCollection<SiPixelClustersSoA>" persistent="false"/> | ||
<class name="alpaka_cuda_async::SiPixelClustersCollection" persistent="false"/> | ||
<class name="edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersCollection>" persistent="false"/> | ||
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersCollection>>" persistent="false"/> | ||
<class name="alpaka_cuda_async::SiPixelClustersSoACollection" persistent="false"/> | ||
<class name="edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersSoACollection>" persistent="false"/> | ||
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersSoACollection>>" persistent="false"/> | ||
</lcgdict> |
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
6 changes: 3 additions & 3 deletions
6
DataFormats/SiPixelClusterSoA/src/alpaka/classes_rocm_def.xml
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,6 +1,6 @@ | ||
<lcgdict> | ||
<class name="alpaka_rocm_async::PortableCollection<SiPixelClustersSoA>" persistent="false"/> | ||
<class name="alpaka_rocm_async::SiPixelClustersCollection" persistent="false"/> | ||
<class name="edm::DeviceProduct<alpaka_rocm_async::SiPixelClustersCollection>" persistent="false"/> | ||
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::SiPixelClustersCollection>>" persistent="false"/> | ||
<class name="alpaka_rocm_async::SiPixelClustersSoACollection" persistent="false"/> | ||
<class name="edm::DeviceProduct<alpaka_rocm_async::SiPixelClustersSoACollection>" persistent="false"/> | ||
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::SiPixelClustersSoACollection>>" persistent="false"/> | ||
</lcgdict> |
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,4 +1,3 @@ | ||
<use name="alpaka"/> | ||
<use name="rootcore"/> | ||
<use name="DataFormats/Common"/> | ||
<use name="DataFormats/Portable"/> | ||
|
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
28 changes: 16 additions & 12 deletions
28
...face/alpaka/SiPixelDigiErrorsCollection.h → ...e/alpaka/SiPixelDigiErrorsSoACollection.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 |
---|---|---|
@@ -1,35 +1,39 @@ | ||
#ifndef DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsCollection_h | ||
#define DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsCollection_h | ||
#ifndef DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsSoACollection_h | ||
#define DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsSoACollection_h | ||
|
||
#include <cstdint> | ||
|
||
#include <alpaka/alpaka.hpp> | ||
|
||
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h" | ||
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigiErrorsHost.h" | ||
#include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigiErrorsDevice.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/CopyToHost.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE { | ||
#ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED | ||
using SiPixelDigiErrorsCollection = SiPixelDigiErrorsHost; | ||
#else | ||
using SiPixelDigiErrorsCollection = SiPixelDigiErrorsDevice<Device>; | ||
#endif | ||
|
||
using SiPixelDigiErrorsSoACollection = | ||
std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>, SiPixelDigiErrorsHost, SiPixelDigiErrorsDevice<Device>>; | ||
|
||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE | ||
|
||
namespace cms::alpakatools { | ||
template <> | ||
struct CopyToHost<ALPAKA_ACCELERATOR_NAMESPACE::SiPixelDigiErrorsCollection> { | ||
template <typename TDevice> | ||
struct CopyToHost<SiPixelDigiErrorsDevice<TDevice>> { | ||
template <typename TQueue> | ||
static auto copyAsync(TQueue& queue, ALPAKA_ACCELERATOR_NAMESPACE::SiPixelDigiErrorsCollection const& srcData) { | ||
static auto copyAsync(TQueue& queue, SiPixelDigiErrorsDevice<TDevice> const& srcData) { | ||
SiPixelDigiErrorsHost dstData(srcData.maxFedWords(), queue); | ||
alpaka::memcpy(queue, dstData.buffer(), srcData.buffer()); | ||
|
||
#ifdef GPU_DEBUG | ||
printf("SiPixelDigiErrorsSoACollection: I'm copying to host.\n"); | ||
#endif | ||
return dstData; | ||
} | ||
}; | ||
} // namespace cms::alpakatools | ||
|
||
#endif // DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsCollection_h | ||
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(SiPixelDigiErrorsSoACollection, SiPixelDigiErrorsHost); | ||
|
||
#endif // DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigiErrorsSoACollection_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
Oops, something went wrong.