From 926b560eff3143f2c3bbb9d087fb46127a4fc8b6 Mon Sep 17 00:00:00 2001 From: Andres Rios-Tascon Date: Mon, 19 Feb 2024 14:52:05 -0500 Subject: [PATCH] Replaced hardcoded values of MAX_CONNECTED_MODULES --- SDL/Event.cc | 3 ++- SDL/Module.h | 2 +- SDL/ModuleMethods.h | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/SDL/Event.cc b/SDL/Event.cc index a541c14d..a43fc383 100644 --- a/SDL/Event.cc +++ b/SDL/Event.cc @@ -1855,7 +1855,8 @@ SDL::modulesBuffer* SDL::Event::getFullModules() { modulesInCPUFull->setData(*modulesInCPUFull); alpaka::memcpy(queue, modulesInCPUFull->detIds_buf, modulesBuffersES->detIds_buf, nModules); - alpaka::memcpy(queue, modulesInCPUFull->moduleMap_buf, modulesBuffersES->moduleMap_buf, 40 * nModules); + alpaka::memcpy( + queue, modulesInCPUFull->moduleMap_buf, modulesBuffersES->moduleMap_buf, MAX_CONNECTED_MODULES * nModules); alpaka::memcpy(queue, modulesInCPUFull->nConnectedModules_buf, modulesBuffersES->nConnectedModules_buf, nModules); alpaka::memcpy(queue, modulesInCPUFull->drdzs_buf, modulesBuffersES->drdzs_buf, nModules); alpaka::memcpy(queue, modulesInCPUFull->slopes_buf, modulesBuffersES->slopes_buf, nModules); diff --git a/SDL/Module.h b/SDL/Module.h index aa483d83..aefaed01 100644 --- a/SDL/Module.h +++ b/SDL/Module.h @@ -286,7 +286,7 @@ namespace SDL { template modulesBuffer(TDevAcc const& devAccIn, unsigned int nMod = modules_size, unsigned int nPixs = pix_tot) : detIds_buf(allocBufWrapper(devAccIn, nMod)), - moduleMap_buf(allocBufWrapper(devAccIn, nMod * 40)), + moduleMap_buf(allocBufWrapper(devAccIn, nMod * MAX_CONNECTED_MODULES)), mapdetId_buf(allocBufWrapper(devAccIn, nMod)), mapIdx_buf(allocBufWrapper(devAccIn, nMod)), nConnectedModules_buf(allocBufWrapper(devAccIn, nMod)), diff --git a/SDL/ModuleMethods.h b/SDL/ModuleMethods.h index 54a9fa54..ffe27c82 100644 --- a/SDL/ModuleMethods.h +++ b/SDL/ModuleMethods.h @@ -132,7 +132,7 @@ namespace SDL { inline void fillConnectedModuleArrayExplicit(struct modulesBuffer* modulesBuf, unsigned int nMod, TQueue queue) { - auto moduleMap_buf = allocBufWrapper(devHost, nMod * 40); + auto moduleMap_buf = allocBufWrapper(devHost, nMod * MAX_CONNECTED_MODULES); uint16_t* moduleMap = alpaka::getPtrNative(moduleMap_buf); auto nConnectedModules_buf = allocBufWrapper(devHost, nMod); @@ -144,11 +144,11 @@ namespace SDL { auto& connectedModules = moduleConnectionMap.getConnectedModuleDetIds(detId); nConnectedModules[index] = connectedModules.size(); for (uint16_t i = 0; i < nConnectedModules[index]; i++) { - moduleMap[index * 40 + i] = (*detIdToIndex)[connectedModules[i]]; + moduleMap[index * MAX_CONNECTED_MODULES + i] = (*detIdToIndex)[connectedModules[i]]; } } - alpaka::memcpy(queue, modulesBuf->moduleMap_buf, moduleMap_buf, nMod * 40); + alpaka::memcpy(queue, modulesBuf->moduleMap_buf, moduleMap_buf, nMod * MAX_CONNECTED_MODULES); alpaka::memcpy(queue, modulesBuf->nConnectedModules_buf, nConnectedModules_buf, nMod); alpaka::wait(queue); };