Skip to content

Commit 9ca7f3a

Browse files
committed
GPU: Fix crash with --noEvents option, and improve some debug messages
1 parent 36b13b4 commit 9ca7f3a

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

GPU/GPUTracking/Standalone/Benchmark/standalone.cxx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ int32_t ReadConfiguration(int argc, char** argv)
173173
return 1;
174174
}
175175
if (configStandalone.proc.doublePipeline && (configStandalone.runs < 4 || !configStandalone.outputcontrolmem)) {
176-
printf("Double pipeline mode needs at least 3 runs per event and external output. To cycle though multiple events, use --preloadEvents and --runs n for n iterations round-robin\n");
176+
printf("Double pipeline mode needs at least 4 runs per event and external output. To cycle though multiple events, use --preloadEvents and --runs n for n iterations round-robin\n");
177177
return 1;
178178
}
179179
if (configStandalone.TF.bunchSim && configStandalone.TF.nMerge) {
@@ -297,7 +297,8 @@ int32_t SetupReconstruction()
297297
printf("Error reading event config file\n");
298298
return 1;
299299
}
300-
printf("Read event settings from dir %s (solenoidBz: %f, constBz %d, maxTimeBin %d)\n", eventsDir.c_str(), rec->GetGRPSettings().solenoidBzNominalGPU, (int32_t)rec->GetGRPSettings().constBz, rec->GetGRPSettings().grpContinuousMaxTimeBin);
300+
const char* tmptext = configStandalone.noEvents ? "Using default event settings, no event dir loaded" : "Read event settings from dir ";
301+
printf("%s%s (solenoidBz: %f, constBz %d, maxTimeBin %d)\n", tmptext, configStandalone.noEvents ? "" : eventsDir.c_str(), rec->GetGRPSettings().solenoidBzNominalGPU, (int32_t)rec->GetGRPSettings().constBz, rec->GetGRPSettings().grpContinuousMaxTimeBin);
301302
if (configStandalone.testSyncAsync) {
302303
recAsync->ReadSettings(eventsDir.c_str());
303304
}
@@ -781,13 +782,17 @@ int32_t main(int argc, char** argv)
781782

782783
srand(configStandalone.seed);
783784

784-
for (nEventsInDirectory = 0; true; nEventsInDirectory++) {
785-
std::ifstream in;
786-
in.open((eventsDir + GPUCA_EVDUMP_FILE "." + std::to_string(nEventsInDirectory) + ".dump").c_str(), std::ifstream::binary);
787-
if (in.fail()) {
788-
break;
785+
nEventsInDirectory = 0;
786+
if (!configStandalone.noEvents) {
787+
while (true) {
788+
std::ifstream in;
789+
in.open((eventsDir + GPUCA_EVDUMP_FILE "." + std::to_string(nEventsInDirectory) + ".dump").c_str(), std::ifstream::binary);
790+
if (in.fail()) {
791+
break;
792+
}
793+
in.close();
794+
nEventsInDirectory++;
789795
}
790-
in.close();
791796
}
792797

793798
if (configStandalone.TF.bunchSim || configStandalone.TF.nMerge) {
@@ -824,11 +829,7 @@ int32_t main(int argc, char** argv)
824829
fflush(stdout);
825830
for (int32_t i = 0; i < nEvents - configStandalone.StartEvent; i++) {
826831
LoadEvent(configStandalone.StartEvent + i, i);
827-
if (configStandalone.proc.debugLevel >= 2) {
828-
printf("Loading event %d\n", i);
829-
} else {
830-
printf(" %d", i);
831-
}
832+
printf(configStandalone.proc.debugLevel >= 2 ? "Loading event %d\n" : " %d", i + configStandalone.StartEvent);
832833
fflush(stdout);
833834
}
834835
printf("\n");
@@ -856,7 +857,7 @@ int32_t main(int argc, char** argv)
856857
if (iEvent != configStandalone.StartEvent) {
857858
printf("\n");
858859
}
859-
if (configStandalone.noEvents == false && !configStandalone.preloadEvents) {
860+
if (!configStandalone.noEvents && !configStandalone.preloadEvents) {
860861
HighResTimer timerLoad;
861862
timerLoad.Start();
862863
if (LoadEvent(iEvent, 0)) {
@@ -889,12 +890,14 @@ int32_t main(int argc, char** argv)
889890
}
890891
printf("Loading time: %'d us\n", (int32_t)(1000000 * timerLoad.GetCurrentElapsedTime()));
891892
}
892-
printf("Processing Event %d\n", iEvent);
893893

894894
nIteration.store(0);
895895
nIterationEnd.store(0);
896896
double pipelineWalltime = 1.;
897-
if (configStandalone.proc.doublePipeline) {
897+
if (configStandalone.noEvents) {
898+
printf("No processing, no events loaded\n");
899+
} else if (configStandalone.proc.doublePipeline) {
900+
printf(configStandalone.preloadEvents ? "Processing Events %d to %d in Pipeline\n" : "Processing Event %d in Pipeline %d times\n", iEvent, configStandalone.preloadEvents ? std::min(iEvent + configStandalone.runs - 1, nEvents - 1) : configStandalone.runs);
898901
HighResTimer timerPipeline;
899902
if (configStandalone.proc.debugLevel < 2 && (RunBenchmark(rec, chainTracking, 1, iEvent, &nTracksTotal, &nClustersTotal) || RunBenchmark(recPipeline, chainTrackingPipeline, 2, iEvent, &nTracksTotal, &nClustersTotal))) {
900903
goto breakrun;
@@ -907,6 +910,7 @@ int32_t main(int argc, char** argv)
907910
pipelineWalltime = timerPipeline.GetElapsedTime() / (configStandalone.runs - 2);
908911
printf("Pipeline wall time: %f, %d iterations, %f per event\n", timerPipeline.GetElapsedTime(), configStandalone.runs - 2, pipelineWalltime);
909912
} else {
913+
printf("Processing Event %d\n", iEvent);
910914
if (RunBenchmark(rec, chainTracking, configStandalone.runs, iEvent, &nTracksTotal, &nClustersTotal)) {
911915
goto breakrun;
912916
}

0 commit comments

Comments
 (0)