// ************************************************************************** // 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 #include "pthread.h" using namespace std; //#include "L1AlgoInter.h" #include "TaskManager.h" #include "InputDataArray.h" #include "L1AlgoInputMCData.h" #include "TStopwatch.h" int main(int argc, char **argv) { int iVerbose = 0; int firstEvent = 0; int lastEvent = 0; int StartTime = -1; int nThreads = 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], "-NThreads" ) && ++i < argc ) { nThreads = 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], "-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; } } // int s; // cpu_set_t cpuset; // int cpuId = 0; // pthread_t thread = pthread_self(); // CPU_ZERO(&cpuset); // CPU_SET(cpuId, &cpuset); // s = pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset); map threadNumberToCpuMap; cout<ReadSettingsFromFile(LocalfilePrefix.data(), iVerbose)) { std::cout << "Setting can not be read" << std::endl; } for ( int kEvents = 0; kEvents <= lastEvent; kEvents++ ) { if (!InputData.fInput[kEvents].ReadHitsFromFile(LocalfilePrefix.data(), NEventsToRead, iVerbose)) { cout << "Hits Data for Event " << kEvents << " can't be read." << std::endl; break; } if(iVerbose>0) { if (!InputMCData.fMCInput[kEvents].ReadMCDataFromFile(LocalfilePrefix.data(), NEventsToRead, iVerbose)) { cout << "MC Data for Event " << kEvents << " can't be read." << std::endl; break; } } } } TaskManager manager(nThreads); // manager.SetNThreads(nThreads); manager.Init( InputData.fSettings, iVerbose ); for ( int iE = firstEvent; iE <= lastEvent; iE++ ) { if(iVerbose>0) manager.SetData( &(InputData.fInput[iE]), &(InputMCData.fMCInput[iE]) ); else manager.SetData( &(InputData.fInput[iE]) ); manager.Run(); } if(iVerbose>0) manager.PrintEff(); return 0; }