Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix or disable failing unit tests #253

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ namespace phase1PixelTopology {
constexpr uint32_t numPixsInModule = uint32_t(numRowsInModule)* uint32_t(numColsInModule);

constexpr uint32_t numberOfModules = 1856;

constexpr uint32_t layerStart[11] = {0,96,320,672,1184,1296,1408,1520,1632,1744,1856};
constexpr char const * layerName[10] = {"BL1","BL2","BL3","BL4",
"E+1", "E+2", "E+3",
"E-1", "E-2", "E-3"
};
constexpr uint32_t numberOfLayers = 10;
constexpr uint32_t layerStart[numberOfLayers + 1] = {
0, 96, 320, 672, // barrel
1184, 1296, 1408, // positive endcap
1520, 1632, 1744, // negative endcap
numberOfModules
};
constexpr char const * layerName[numberOfLayers] = {
"BL1", "BL2", "BL3", "BL4", // barrel
"E+1", "E+2", "E+3", // positive endcap
"E-1", "E-2", "E-3" // negative endcap
};


template<class Function, std::size_t... Indices>
Expand Down Expand Up @@ -60,7 +66,6 @@ namespace phase1PixelTopology {

constexpr uint32_t maxModuleStride = findMaxModuleStride();


constexpr uint8_t findLayer(uint32_t detId) {
for (uint8_t i=0; i<11; ++i) if (detId<layerStart[i+1]) return i;
return 11;
Expand All @@ -72,9 +77,8 @@ namespace phase1PixelTopology {
return 11;
}


constexpr uint32_t layerIndexSize = numberOfModules/maxModuleStride;
constexpr std::array<uint8_t,layerIndexSize> layer = map_to_array<layerIndexSize>(findLayerFromCompact);
constexpr uint32_t layerIndexSize = numberOfModules / maxModuleStride;
constexpr std::array<uint8_t, layerIndexSize> layer = map_to_array<layerIndexSize>(findLayerFromCompact);

constexpr bool validateLayerIndex() {
bool res=true;
Expand All @@ -87,12 +91,11 @@ namespace phase1PixelTopology {
return res;
}

static_assert(validateLayerIndex(),"layer from detIndex algo is buggy");
static_assert(validateLayerIndex(), "layer from detIndex algo is buggy");


// this is for the ROC n<512 (upgrade 1024)
constexpr inline
uint16_t divu52(uint16_t n) {
uint16_t divu52(uint16_t n) {
n = n>>2;
uint16_t q = (n>>1) + (n>>4);
q = q + (q>>4) + (q>>5); q = q >> 3;
Expand All @@ -101,13 +104,14 @@ namespace phase1PixelTopology {
}

constexpr inline
bool isEdgeX(uint16_t px) { return (px==0) | (px==lastRowInModule);}
constexpr inline
bool isEdgeY(uint16_t py) { return (py==0) | (py==lastColInModule);}
bool isEdgeX(uint16_t px) { return (px==0) | (px==lastRowInModule); }

constexpr inline
bool isEdgeY(uint16_t py) { return (py==0) | (py==lastColInModule); }

constexpr inline
uint16_t toRocX(uint16_t px) { return (px<numRowsInRoc) ? px : px-numRowsInRoc; }

constexpr inline
uint16_t toRocY(uint16_t py) {
auto roc = divu52(py);
Expand Down
14 changes: 9 additions & 5 deletions Geometry/TrackerGeometryBuilder/test/phase1PixelTopology_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,17 @@ int main() {
assert(std::get<1>(ori)==bp);
}

using namespace phase1PixelTopology;
for (auto i=0U; i<numberOfModules; ++i) {
assert(layer[i]<10);
assert(i>=layerStart[layer[i]]);
assert(i<layerStart[layer[i]+1]);
for (auto i = 0U; i < phase1PixelTopology::numberOfLayers; ++i) {
std::cout << "layer " << i << ", \"" << phase1PixelTopology::layerName[i] << "\", [" << phase1PixelTopology::layerStart[i] << ", " << phase1PixelTopology::layerStart[i+1] << ")" << std::endl;
}

for (auto i = 0U; i < phase1PixelTopology::numberOfModules; ++i) {
int layer = phase1PixelTopology::layer[i / phase1PixelTopology::maxModuleStride];
//std::cout << "module " << i << ": " << "layer " << layer << ", \"" << phase1PixelTopology::layerName[layer] << "\", [" << phase1PixelTopology::layerStart[layer] << ", " << phase1PixelTopology::layerStart[layer+1] << ")" << std::endl;
assert(layer < 10);
assert(i >= phase1PixelTopology::layerStart[layer]);
assert(i < phase1PixelTopology::layerStart[layer+1]);
}

return 0;
}
12 changes: 7 additions & 5 deletions HeterogeneousCore/CUDAUtilities/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<bin file="cudastdAlgorithm_t.cu" name="gpuCudastdAlgorithm_t">
<use name="cuda-api-wrappers"/>
<flags CUDA_FLAGS="-g -DGPU_DEBUG"/>
<flags CUDA_FLAGS="-g -DGPU_DEBUG"/>
</bin>

<bin file="radixSort_t.cu" name="gpuRadixSort_t">
Expand All @@ -29,25 +29,27 @@
<flags CUDA_FLAGS="-g -G -DGPU_DEBUG"/>
</bin>

<!--
<bin file="HistoContainer_t.cpp">
<flags CXXFLAGS="-g"/>
</bin>
-->

<bin file="HistoContainer_t.cu" name="gpuHistoContainer_t">
<use name="cuda-api-wrappers"/>
<use name="cub"/>
<use name="cub"/>
<flags CUDA_FLAGS="-g -DGPU_DEBUG"/>
</bin>

<bin file="HistoContainer_t.cu" name="gpuHistoContainer_debug">
<use name="cuda-api-wrappers"/>
<use name="cub"/>
<use name="cub"/>
<flags CUDA_FLAGS="-g -G -DGPU_DEBUG"/>
</bin>

<bin file="OneHistoContainer_t.cu" name="gpuOneHistoContainer_t">
<use name="cuda-api-wrappers"/>
<use name="cub"/>
<use name="cub"/>
<flags CUDA_FLAGS="-g -DGPU_DEBUG"/>
</bin>

Expand All @@ -57,7 +59,7 @@

<bin file="OneToManyAssoc_t.cu" name="gpuOneToManyAssoc_t">
<use name="cuda-api-wrappers"/>
<use name="cub"/>
<use name="cub"/>
<flags CUDA_FLAGS="-g -DGPU_DEBUG"/>
</bin>

Expand Down
4 changes: 2 additions & 2 deletions HeterogeneousCore/CUDAUtilities/test/HistoContainer_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ int main() {
exitSansCUDADevices();

go<int16_t>();
go<uint8_t,128,8,4>();
go<uint16_t,313/2,9,4>();
go<uint8_t, 128, 8, 4>();
go<uint16_t, 313/2, 9, 4>();

return 0;
}
11 changes: 6 additions & 5 deletions HeterogeneousCore/CUDAUtilities/test/assert_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#include "HeterogeneousCore/CUDAUtilities/interface/exitSansCUDADevices.h"

__global__
void testIt(int c){
assert(c==1);
void testIt(int one){
assert(one == 1);
}

int main(int c, char **) {
int main(int argc, char* argv[]) {
exitSansCUDADevices();

testIt<<<1,1>>>(c);
testIt<<<1,1>>>(argc);
cudaDeviceSynchronize();
return c==1;

return (argc == 1) ? EXIT_SUCCESS : EXIT_FAILURE;
}
38 changes: 19 additions & 19 deletions HeterogeneousCore/CUDAUtilities/test/radixSort_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ template<typename T, int NS=sizeof(T),
void go(bool useShared) {

std::mt19937 eng;
// std::mt19937 eng2;
//std::mt19937 eng2;
auto rgen = RS<T>::ud();

auto start = std::chrono::high_resolution_clock::now();
Expand Down Expand Up @@ -82,7 +82,7 @@ void go(bool useShared) {
offsets[10]=3297+offsets[9];
}

std::random_shuffle(v,v+N);
std::random_shuffle(v, v+N);

auto v_d = cuda::memory::device::make_unique<U[]>(current_device, N);
auto ind_d = cuda::memory::device::make_unique<uint16_t[]>(current_device, N);
Expand All @@ -94,29 +94,29 @@ void go(bool useShared) {

if (i<2) std::cout << "lauch for " << offsets[blocks] << std::endl;

auto ntXBl = 1==i%4 ? 256 : 256;
auto ntXBl = 1==i%4 ? 256 : 256;

delta -= (std::chrono::high_resolution_clock::now()-start);
constexpr int MaxSize = 256*32;
if (useShared)
cuda::launch(
radixSortMultiWrapper<U,NS>,
{ blocks, ntXBl, MaxSize*2 },
v_d.get(),ind_d.get(),off_d.get(),nullptr
delta -= (std::chrono::high_resolution_clock::now()-start);
constexpr int MaxSize = 256*32;
if (useShared)
cuda::launch(
radixSortMultiWrapper<U, NS>,
{ blocks, ntXBl, MaxSize*2 },
v_d.get(), ind_d.get(), off_d.get(), nullptr
);
else
cuda::launch(
radixSortMultiWrapper2<U,NS>,
{ blocks, ntXBl },
v_d.get(),ind_d.get(),off_d.get(),ws_d.get()
else
cuda::launch(
radixSortMultiWrapper2<U, NS>,
{ blocks, ntXBl },
v_d.get(), ind_d.get(), off_d.get(), ws_d.get()
);

if (i==0) std::cout << "done for " << offsets[blocks] << std::endl;
if (i==0) std::cout << "done for " << offsets[blocks] << std::endl;

// cuda::memory::copy(v, v_d.get(), 2*N);
cuda::memory::copy(ind, ind_d.get(), 2*N);
// cuda::memory::copy(v, v_d.get(), 2*N);
cuda::memory::copy(ind, ind_d.get(), 2*N);

delta += (std::chrono::high_resolution_clock::now()-start);
delta += (std::chrono::high_resolution_clock::now()-start);

if (i==0) std::cout << "done for " << offsets[blocks] << std::endl;

Expand Down