-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x and y position calculation in kernel
- Loading branch information
Bruno Alves
committed
Jan 21, 2021
1 parent
4773a0a
commit 22e19fb
Showing
61 changed files
with
2,383 additions
and
966 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
macs -nw 2 --- | ||
Language: Cpp | ||
BasedOnStyle: Google | ||
ColumnLimit: 120 | ||
|
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,8 @@ | ||
<use name="FWCore/Utilities"/> | ||
<use name="Geometry/HGCalGeometry"/> | ||
<use name="HeterogeneousCore/CUDACore"/> | ||
<use name="cuda"/> | ||
|
||
<export> | ||
<lib name="1"/> | ||
</export> |
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 was deleted.
Oops, something went wrong.
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
12 changes: 12 additions & 0 deletions
12
CondFormats/DataRecord/interface/HeterogeneousHGCalHEFCellPositionsConditionsRecord.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,12 @@ | ||
#ifndef CondFormats_DataRecord_HeterogeneousHGCalHEFCellPositionsConditionsRecord_h | ||
#define CondFormats_DataRecord_HeterogeneousHGCalHEFCellPositionsConditionsRecord_h | ||
|
||
#include "FWCore/Framework/interface/DependentRecordImplementation.h" | ||
//#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" | ||
#include "Geometry/Records/interface/IdealGeometryRecord.h" | ||
#include "FWCore/Utilities/interface/mplVector.h" | ||
|
||
class HeterogeneousHGCalHEFCellPositionsConditionsRecord | ||
: public edm::eventsetup::DependentRecordImplementation<HeterogeneousHGCalHEFCellPositionsConditionsRecord, edm::mpl::Vector<IdealGeometryRecord>> {}; | ||
|
||
#endif //CondFormats_DataRecord_HeterogeneousHGCalHEFCellPositionsConditionsRecord_h |
4 changes: 4 additions & 0 deletions
4
CondFormats/DataRecord/src/HeterogeneousHGCalHEFCellPositionsConditionsRecord.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/DataRecord/interface/HeterogeneousHGCalHEFCellPositionsConditionsRecord.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
|
||
EVENTSETUP_RECORD_REG(HeterogeneousHGCalHEFCellPositionsConditionsRecord); |
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,8 @@ | ||
<use name="FWCore/Utilities"/> | ||
<use name="FWCore/MessageLogger"/> | ||
<use name="HeterogeneousCore/CUDACore"/> | ||
<use name="CUDADataFormats/HGCal"/> | ||
<use name="Geometry/HGCalCommonData"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> |
73 changes: 73 additions & 0 deletions
73
CondFormats/HGCalObjects/interface/HeterogeneousHGCalHEFCellPositionsConditions.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,73 @@ | ||
#ifndef CondFormats_HGCalObjects_HeterogeneousHGCalHEFConditions_h | ||
#define CondFormats_HGCalObjects_HeterogeneousHGCalHEFConditions_h | ||
|
||
#include <numeric> //accumulate | ||
#include <typeinfo> | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" | ||
#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" | ||
#include "CUDADataFormats/HGCal/interface/HGCConditions.h" | ||
#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" | ||
#include "Geometry/HGCalCommonData/interface/HGCalParameters.h" | ||
|
||
namespace cpar = hgcal_conditions::parameters; | ||
namespace cpos = hgcal_conditions::positions; | ||
|
||
// Declare the wrapper ESProduct. The corresponding ESProducer should | ||
// produce objects of this type. | ||
class HeterogeneousHGCalHEFCellPositionsConditions { | ||
public: | ||
// Constructor takes the standard CPU ESProduct, and transforms the | ||
// necessary data to array(s) in pinned host memory | ||
HeterogeneousHGCalHEFCellPositionsConditions(cpos::HGCalPositionsMapping*); | ||
|
||
// Deallocates all pinned host memory | ||
~HeterogeneousHGCalHEFCellPositionsConditions(); | ||
|
||
// Function to return the actual payload on the memory of the current device | ||
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct const *getHeterogeneousConditionsESProductAsync(cudaStream_t stream) const; | ||
|
||
private: | ||
// Holds the data in pinned CPU memory | ||
// Contrary to its non-heterogeneous counterpart (constructor argument) it is *not* a pointer (so to avoid an extra allocation) | ||
cpos::HeterogeneousHGCalPositionsMapping posmap_; | ||
size_t nelems_posmap_; | ||
|
||
std::vector<size_t> sizes_pos_; | ||
size_t chunk_pos_; | ||
const size_t number_position_arrays = 2; //x and y; required due to the assymetry between cpos::HeterogeneousHGCalPositionsMapping and cpos::HGCalPositionsMapping | ||
|
||
std::vector<size_t> calculate_memory_bytes_pos_(cpos::HGCalPositionsMapping*); | ||
size_t allocate_memory_pos_(const std::vector<size_t>&); | ||
void transfer_data_to_heterogeneous_pointers_pos_(const std::vector<size_t>&, cpos::HGCalPositionsMapping*); | ||
void transfer_data_to_heterogeneous_vars_pos_(const cpos::HGCalPositionsMapping*); | ||
|
||
/*methods for managing SoA's pointers*/ | ||
//float | ||
float*& select_pointer_f_(cpos::HeterogeneousHGCalPositionsMapping*, const unsigned int&) const; | ||
std::vector<float>& select_pointer_f_(cpos::HGCalPositionsMapping*, const unsigned int&); | ||
//int32_t | ||
int32_t*& select_pointer_i_(cpos::HeterogeneousHGCalPositionsMapping*, const unsigned int&) const; | ||
std::vector<int32_t>& select_pointer_i_(cpos::HGCalPositionsMapping*, const unsigned int&); | ||
//uint32_t | ||
uint32_t*& select_pointer_u_(cpos::HeterogeneousHGCalPositionsMapping*, const unsigned int&) const; | ||
std::vector<uint32_t>& select_pointer_u_(cpos::HGCalPositionsMapping*, const unsigned int&); | ||
|
||
// Helper struct to hold all information that has to be allocated and | ||
// deallocated per device | ||
struct GPUData { | ||
// Destructor should free all member pointers | ||
~GPUData(); | ||
// internal pointers are on device, struct itself is on CPU | ||
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct *host = nullptr; | ||
// internal pounters and struct are on device | ||
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct *device = nullptr; | ||
}; | ||
|
||
// Helper that takes care of complexity of transferring the data to | ||
// multiple devices | ||
cms::cuda::ESProduct<GPUData> gpuData_; | ||
}; | ||
|
||
#endif //CondFormats_HGCalObjects_HeterogeneousHGCalHEFConditions_h |
Oops, something went wrong.