forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 5
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
113 changed files
with
65,441 additions
and
40 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
CondFormats/SiPixelObjects/interface/SiPixelGainForHLTonGPU.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,71 @@ | ||
#ifndef CondFormats_SiPixelObjects_SiPixelGainForHLTonGPU_h | ||
#define CondFormats_SiPixelObjects_SiPixelGainForHLTonGPU_h | ||
|
||
#include <cassert> | ||
#include <cstdint> | ||
#include <cstdio> | ||
#include <tuple> | ||
|
||
struct SiPixelGainForHLTonGPU_DecodingStructure{ | ||
uint8_t gain; | ||
uint8_t ped; | ||
}; | ||
|
||
|
||
// copy of SiPixelGainCalibrationForHLT | ||
class SiPixelGainForHLTonGPU { | ||
|
||
public: | ||
|
||
using DecodingStructure = SiPixelGainForHLTonGPU_DecodingStructure; | ||
|
||
using Range = std::pair<uint32_t,uint32_t>; | ||
|
||
|
||
inline __host__ __device__ | ||
std::pair<float,float> getPedAndGain(uint32_t moduleInd, int col, int row, bool& isDeadColumn, bool& isNoisyColumn ) const { | ||
|
||
|
||
auto range = rangeAndCols[moduleInd].first; | ||
auto nCols = rangeAndCols[moduleInd].second; | ||
|
||
// 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 = (range.second-range.first)/nCols; | ||
unsigned int lengthOfAveragedDataInEachColumn = 2; // we always only have two values per column averaged block | ||
unsigned int numberOfDataBlocksToSkip = row / numberOfRowsAveragedOver_; | ||
|
||
|
||
auto offset = range.first + col*lengthOfColumnData + lengthOfAveragedDataInEachColumn*numberOfDataBlocksToSkip; | ||
|
||
assert(offset<range.second); | ||
assert(offset<3088384); | ||
assert(0==offset%2); | ||
|
||
auto s = v_pedestals[offset/2]; | ||
|
||
isDeadColumn = (s.ped & 0xFF) == deadFlag_; | ||
isNoisyColumn = (s.ped & 0xFF) == noisyFlag_; | ||
|
||
return std::make_pair(decodePed(s.ped & 0xFF),decodeGain(s.gain & 0xFF)); | ||
|
||
} | ||
|
||
|
||
|
||
constexpr float decodeGain(unsigned int gain) const {return gain*gainPrecision + minGain_;} | ||
constexpr float decodePed (unsigned int ped) const { return ped*pedPrecision + minPed_;} | ||
|
||
DecodingStructure * v_pedestals; | ||
std::pair<Range, int> rangeAndCols[2000]; | ||
|
||
float minPed_, maxPed_, minGain_, maxGain_; | ||
|
||
float pedPrecision, gainPrecision; | ||
|
||
unsigned int numberOfRowsAveragedOver_; // this is 80!!!! | ||
unsigned int nBinsToUseForEncoding_; | ||
unsigned int deadFlag_; | ||
unsigned int noisyFlag_; | ||
}; | ||
|
||
#endif // CondFormats_SiPixelObjects_SiPixelGainForHLTonGPU_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# This modifier is for replacing CPU modules with GPU counterparts | ||
|
||
gpu = cms.Modifier() |
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,5 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# This modifier is for replacing the default pixel track "fitting" with Riemann fit | ||
|
||
riemannFit = cms.Modifier() |
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
43 changes: 43 additions & 0 deletions
43
DataFormats/GeometrySurface/test/gpuFrameTransformKernel.cu
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,43 @@ | ||
#include "DataFormats/GeometrySurface/interface/SOARotation.h" | ||
#include <cstdint> | ||
|
||
|
||
__global__ | ||
void toGlobal(SOAFrame<float> const * frame, | ||
float const * xl, float const * yl, | ||
float * x, float * y, float * z, | ||
uint32_t n) | ||
{ | ||
int i = blockDim.x * blockIdx.x + threadIdx.x; | ||
if (i >= n) return; | ||
|
||
frame[0].toGlobal(xl[i],yl[i],x[i],y[i],z[i]); | ||
|
||
|
||
} | ||
|
||
#include<iostream> | ||
#include <iomanip> | ||
#include "cuda/api_wrappers.h" | ||
|
||
|
||
void toGlobalWrapper(SOAFrame<float> const * frame, | ||
float const * xl, float const * yl, | ||
float * x, float * y, float * z, | ||
uint32_t n) { | ||
|
||
int threadsPerBlock = 256; | ||
int blocksPerGrid = (n + threadsPerBlock - 1) / threadsPerBlock; | ||
std::cout | ||
<< "CUDA toGlobal kernel launch with " << blocksPerGrid | ||
<< " blocks of " << threadsPerBlock << " threads" << std::endl; | ||
|
||
cuda::launch( | ||
toGlobal, | ||
{ blocksPerGrid, threadsPerBlock }, | ||
frame, xl, yl, x, y, z, | ||
n | ||
); | ||
|
||
} | ||
|
Oops, something went wrong.