Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Replace hardcoded values of MAX_CONNECTED_MODULES #371

Merged
merged 1 commit into from
Feb 20, 2024
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
3 changes: 2 additions & 1 deletion SDL/Event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,8 @@ SDL::modulesBuffer<alpaka::DevCpu>* 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);
Expand Down
2 changes: 1 addition & 1 deletion SDL/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ namespace SDL {
template <typename TDevAcc>
modulesBuffer(TDevAcc const& devAccIn, unsigned int nMod = modules_size, unsigned int nPixs = pix_tot)
: detIds_buf(allocBufWrapper<unsigned int>(devAccIn, nMod)),
moduleMap_buf(allocBufWrapper<uint16_t>(devAccIn, nMod * 40)),
moduleMap_buf(allocBufWrapper<uint16_t>(devAccIn, nMod * MAX_CONNECTED_MODULES)),
mapdetId_buf(allocBufWrapper<unsigned int>(devAccIn, nMod)),
mapIdx_buf(allocBufWrapper<uint16_t>(devAccIn, nMod)),
nConnectedModules_buf(allocBufWrapper<uint16_t>(devAccIn, nMod)),
Expand Down
6 changes: 3 additions & 3 deletions SDL/ModuleMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace SDL {
inline void fillConnectedModuleArrayExplicit(struct modulesBuffer<TDev>* modulesBuf,
unsigned int nMod,
TQueue queue) {
auto moduleMap_buf = allocBufWrapper<uint16_t>(devHost, nMod * 40);
auto moduleMap_buf = allocBufWrapper<uint16_t>(devHost, nMod * MAX_CONNECTED_MODULES);
uint16_t* moduleMap = alpaka::getPtrNative(moduleMap_buf);

auto nConnectedModules_buf = allocBufWrapper<uint16_t>(devHost, nMod);
Expand All @@ -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);
};
Expand Down