This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Clean up N_MAX objects #228
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bc42d3c
clean up N_MAX for MD, segment, T3, T5 in write_sdl_ntuples.cc
YonsiG 5888405
remove N_MAX_MD, N_MAX_SG in Event.cu
YonsiG b8bf628
remove N_MAX in wrie_sdl_ntuple.cc completely
YonsiG 2eff9d5
remove duplications when calculating nTotalSegments
YonsiG 767474c
fix nTotalSegments as per event variable
YonsiG 25329b3
add commit to Segment memoty footprint
YonsiG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ struct SDL::modules* SDL::modulesInGPU = nullptr; | |
struct SDL::pixelMap* SDL::pixelMapping = nullptr; | ||
uint16_t SDL::nModules; | ||
uint16_t SDL::nLowerModules; | ||
unsigned int nTotalSegments; | ||
|
||
SDL::Event::Event(cudaStream_t estream) | ||
{ | ||
|
@@ -749,8 +750,7 @@ void SDL::Event::addPixelSegmentToEvent(std::vector<unsigned int> hitIndices0,st | |
mdsInGPU = (SDL::miniDoublets*)cms::cuda::allocate_host(sizeof(SDL::miniDoublets), stream); | ||
//hardcoded range numbers for this will come from studies! | ||
unsigned int nTotalMDs; | ||
createMDArrayRanges(*modulesInGPU, *rangesInGPU, nLowerModules, nTotalMDs, stream, N_MAX_MD_PER_MODULES, N_MAX_PIXEL_MD_PER_MODULES); | ||
|
||
createMDArrayRanges(*modulesInGPU, *rangesInGPU, nLowerModules, nTotalMDs, stream, N_MAX_PIXEL_MD_PER_MODULES); | ||
createMDsInExplicitMemory(*mdsInGPU, nTotalMDs, nLowerModules, N_MAX_PIXEL_MD_PER_MODULES,stream); | ||
|
||
cudaMemcpyAsync(mdsInGPU->nMemoryLocations, &nTotalMDs, sizeof(unsigned int), cudaMemcpyHostToDevice, stream); | ||
|
@@ -761,10 +761,8 @@ void SDL::Event::addPixelSegmentToEvent(std::vector<unsigned int> hitIndices0,st | |
{ | ||
segmentsInGPU = (SDL::segments*)cms::cuda::allocate_host(sizeof(SDL::segments), stream); | ||
//hardcoded range numbers for this will come from studies! | ||
unsigned int nTotalSegments; | ||
createSegmentArrayRanges(*modulesInGPU, *rangesInGPU, *mdsInGPU, nLowerModules, nTotalSegments, stream, N_MAX_SEGMENTS_PER_MODULE, N_MAX_PIXEL_SEGMENTS_PER_MODULE); | ||
// cout<<"nTotalSegments: "<<nTotalSegments<<std::endl; // for memory usage | ||
|
||
//problem here: didn't distinguish pixel segments and outtracker segments. so they use the same memory index, which should be different and allocate dynamically | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, check the discussion on the same line from the previous PR. |
||
createSegmentArrayRanges(*modulesInGPU, *rangesInGPU, *mdsInGPU, nLowerModules, nTotalSegments, stream, N_MAX_PIXEL_SEGMENTS_PER_MODULE); | ||
createSegmentsInExplicitMemory(*segmentsInGPU, nTotalSegments, nLowerModules, N_MAX_PIXEL_SEGMENTS_PER_MODULE,stream); | ||
|
||
cudaMemcpyAsync(segmentsInGPU->nMemoryLocations, &nTotalSegments, sizeof(unsigned int), cudaMemcpyHostToDevice, stream);; | ||
|
@@ -1055,7 +1053,7 @@ void SDL::Event::createMiniDoublets() | |
|
||
//hardcoded range numbers for this will come from studies! | ||
unsigned int nTotalMDs; | ||
createMDArrayRanges(*modulesInGPU, *rangesInGPU, nLowerModules, nTotalMDs, stream, N_MAX_MD_PER_MODULES, N_MAX_PIXEL_MD_PER_MODULES); | ||
createMDArrayRanges(*modulesInGPU, *rangesInGPU, nLowerModules, nTotalMDs, stream, N_MAX_PIXEL_MD_PER_MODULES); | ||
// cout<<"nTotalMDs: "<<nTotalMDs<<std::endl; // for memory usage | ||
|
||
if(mdsInGPU == nullptr) | ||
|
@@ -1128,13 +1126,12 @@ void SDL::Event::createSegmentsWithModuleMap() | |
if(segmentsInGPU == nullptr) | ||
{ | ||
segmentsInGPU = (SDL::segments*)cms::cuda::allocate_host(sizeof(SDL::segments), stream); | ||
createSegmentsInExplicitMemory(*segmentsInGPU, N_MAX_SEGMENTS_PER_MODULE, nLowerModules, N_MAX_PIXEL_SEGMENTS_PER_MODULE,stream); | ||
createSegmentsInExplicitMemory(*segmentsInGPU, nTotalSegments, nLowerModules, N_MAX_PIXEL_SEGMENTS_PER_MODULE,stream); | ||
} | ||
|
||
//HERE | ||
dim3 cSnThreads(64,1,1); | ||
uint32_t blks = nLowerModules; | ||
//printf("HERE Num nLowerModules=%d Blks=%d\n",nLowerModules,blks); | ||
dim3 cSnBlocks(blks,1,1); | ||
SDL::createSegmentsInGPUv2<<<cSnBlocks,cSnThreads,0,stream>>>(*modulesInGPU, *mdsInGPU, *segmentsInGPU, *rangesInGPU); | ||
cudaError_t cudaerr = cudaGetLastError(); | ||
|
@@ -1146,7 +1143,6 @@ void SDL::Event::createSegmentsWithModuleMap() | |
#if defined(AddObjects) | ||
addSegmentsToEventExplicit(); | ||
#endif | ||
|
||
} | ||
|
||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can now see that you don't duplicate the creation of segment arrays, taking into account my comment (thank you, I will resolve that discussion). Because of this, I understand that you had to define the
nTotalSegments
in a more global scope, so that you can use it in multiple functions within theEvent
class.However, you define it as a global variable and this can change from event to event. If we run multi-streaming, I would expect it to be changed by all of the events that run concurrently, leading to unexpected behavior, since all of them will have different values for that same variable. To save ourselves from this situation, I would make the
nTotalSegments
variable a private variable of theEvent
class (like this one), so that each event can have its own value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for pointing it out Manos! I've put this into Event class to correct this :)