// ************************************************************************** // This file is property of and copyright by the CBM HLT Project * // CBM Experiment at FAIR, All rights reserved. * // * // * // Primary Authors: Igor Kulakov * // Maksym Zyzak * // Ivan Kisel * // * // Permission to use, copy, modify and distribute this software and its * // documentation strictly for non-commercial purposes is hereby granted * // without fee, provided that the above copyright notice appears in all * // copies and that both the copyright notice and this permission notice * // appear in the supporting documentation. The authors make no claims * // about the suitability of this software for any purpose. It is * // provided "as is" without express or implied warranty. * // * //*************************************************************************** #include #include #include #include using namespace std; //#include "L1AlgoInter.h" #include "Performance.h" #include "multithread.h" #include "parallel_for_simpleEqNThr.h" #include "TStopwatch.h" static void usage(const char *execName) { std::cout << "Usage: " << execName << " [OPTION] [event number]\n" "Reconstruct slice tracks and merge them from cluster data read from the Events directory.\n\n" " -h, --help print this message\n" << endl; } int main(int argc, char **argv) { int iVerbose = 0; int firstEvent = 0; int lastEvent = 0; int nThreads = 1; int Step=1; int nRuns=1; int iSocket = 0; int StartTime = -1; bool fullTiming = 0; string filePrefix = "./Events/"; for( int i=1; i < argc; i++ ){ if ( !std::strcmp( argv[i], "-h" ) || !std::strcmp( argv[i], "--help" ) || !std::strcmp( argv[i], "-help" ) ) { usage(argv[0]); return 0; } else if ( !std::strcmp( argv[i], "-perf" ) ) { iVerbose=1; } else if ( !std::strcmp( argv[i], "-VerboseLevel" ) && ++i < argc ) { iVerbose = atoi( argv[i] ); } else if ( !std::strcmp( argv[i], "-time" ) ) { fullTiming = true; } else if ( !std::strcmp( argv[i], "-dir" ) && ++i < argc ) { filePrefix = argv[i]; } else if ( !std::strcmp( argv[i], "-nThreads" ) && ++i < argc ) { nThreads = atoi( argv[i] ); } else if ( !std::strcmp( argv[i], "-Step" ) && ++i < argc ) { Step = atoi( argv[i] ); } else if ( !std::strcmp( argv[i], "-nRuns" ) && ++i < argc ) { nRuns = atoi( argv[i] ); } else if ( !std::strcmp( argv[i], "-iSocket" ) && ++i < argc ) { iSocket = atoi( argv[i] ); } else if ( !std::strcmp( argv[i], "-StartTime" ) && ++i < argc ) { StartTime = atoi( argv[i] ); } else if ( !std::strcmp( argv[i], "-ev" ) && ++i < argc ) { firstEvent = atoi( argv[i] ); if (++i < argc){ lastEvent = atoi( argv[i] ); // std::cout << "Only process events " << firstEvent << ",..," << lastEvent << std::endl; } else{ lastEvent = firstEvent; // std::cout << "Only process event " << lastEvent << std::endl; } } else { firstEvent = atoi( argv[i] ); lastEvent = firstEvent; // std::cout << "Only process event " << lastEvent << std::endl; } } const int NEventsPerThread = lastEvent - firstEvent + 1; InputDataArray InputDataPerThread; InputMCDataArray InputMCDataPerThread; { std::string LocalfilePrefix = filePrefix; LocalfilePrefix += "/"; const int NEventsToRead = lastEvent+1; InputDataPerThread.fInput = new L1AlgoInputData[NEventsToRead]; InputDataPerThread.fSettings = new L1AlgoInputSettings; InputMCDataPerThread.fMCInput = new L1AlgoInputMCData[NEventsToRead]; if(!InputDataPerThread.fSettings->ReadSettingsFromFile(LocalfilePrefix.data(), iVerbose)) { std::cout << "Setting can not be read" << std::endl; } for ( int kEvents = 0; kEvents <= lastEvent; kEvents++ ) { if (!InputDataPerThread.fInput[kEvents].ReadHitsFromFile(LocalfilePrefix.data(), NEventsToRead, iVerbose)) { cout << "Hits Data for Event " << kEvents << " can't be read." << std::endl; break; } if(iVerbose>0) { if (!InputMCDataPerThread.fMCInput[kEvents].ReadMCDataFromFile(LocalfilePrefix.data(), NEventsToRead, iVerbose)) { cout << "MC Data for Event " << kEvents << " can't be read." << std::endl; break; } } } } // L1AlgoInter* algoInter = new L1AlgoInter(); // algoInter->Init(filePrefix.data(), iVerbose, nThreads, NEventsPerThread); // std::cout << nThreads << " " << Step << " " << 1/*nRuns*/ << " " << NEventsPerThread << std::endl; // std::cout << std::endl << std::endl; // std::cout << " --- tbb ---"<RunEv(); // if( iVerbose >= 1 ) perf->Init(filePrefix.data(), algoInter); // if( iVerbose >= 1 ) perf->RunEv(); const int NSockets = 4; const int NCoresPerSocket = 20; int mThreadNumberToCpuMap[NSockets][NCoresPerSocket]; for(int iProc=0; iProc-1) while(time(NULL) < StartTime) {} if(iVerbose == 0) { timer.Start(); for(int iTimes = 0; iTimes