21int main(
int argc,
char* argv[]) {
23 std::cout<<
"trigGpuTest usage: ./trigGpuTest <geo_file.bin> <data_dir> nevents"<<std::endl;
30 void* handle = dlopen(
"libTrigInDetCUDA.so", RTLD_LAZY);
33 fprintf(stderr,
"cannot load the factory library : %s\n", dlerror());
42 int (*getFactoryId)();
46 getFactoryId = (int (*)()) dlsym(handle,
"getFactoryId");
49 std::cout<<
"factory library id = "<<std::hex<<getFactoryId()<<std::dec<<std::endl;
56 std::cout<<
"Factory config failed"<<std::endl;
62 const size_t bufferOffset = 256;
66 std::string geoName(argv[1]);
68 std::cout<<
"reading geometry from file "<<geoName<<std::endl;
70 size_t bSize = pBG->
load(geoName);
72 std::cout<<
"loaded "<<bSize<<
" bytes"<<std::endl;
74 std::shared_ptr<TrigAccel::OffloadBuffer> pDMBuff = std::make_shared<TrigAccel::OffloadBuffer>(pBG);
83 std::string data_path(argv[2]);
84 std::vector<std::string> event_files;
86 for(
const auto& entry : std::experimental::filesystem::directory_iterator(data_path)) {
87 event_files.push_back(entry.path());
92 std::cout<<
"running the GPU test with "<<
nEvents<<
" events"<<std::endl;
98 std::ofstream timeFile(
"results.csv");
100 timeFile<<
"nsp,nseeds,time"<<std::endl;
102 for(
int iEvent=0;iEvent<
nEvents;iEvent++) {
104 const std::string& fileName = event_files[fileIdx];
107 if(fileIdx >= (
int)event_files.size()) {
111 std::cout<<
"reading event from file "<<fileName<<std::endl;
113 bSize = pB->
load(fileName);
119 tbb::tick_count tzero = tbb::tick_count::now();
121 std::shared_ptr<TrigAccel::OffloadBuffer> pBuff = std::make_shared<TrigAccel::OffloadBuffer>(pB);
126 std::cout<<
"ERROR: cannot create work item"<<std::endl;
132 tbb::tick_count tnow=tbb::tick_count::now();
133 tbb::tick_count::interval_t duration = tnow - tzero;
134 std::cout<<
"triplet making took "<<duration.seconds()*1000.0<<
" ms"<<std::endl;
136 std::shared_ptr<TrigAccel::OffloadBuffer> pOB = pJob->
getOutput();
140 std::cout<<
"Found "<<pOutput->
m_nSeeds<<
" triplets"<<std::endl;