22int main(
int argc,
char* argv[]) {
24 std::cout<<
"trigGpuTest usage: ./trigGpuTest <geo_file.bin> <data_dir> nevents"<<std::endl;
31 void* handle = dlopen(
"libTrigInDetCUDA.so", RTLD_LAZY);
34 fprintf(stderr,
"cannot load the factory library : %s\n", dlerror());
43 int (*getFactoryId)();
47 getFactoryId = (int (*)()) dlsym(handle,
"getFactoryId");
50 std::cout<<
"factory library id = "<<std::hex<<getFactoryId()<<std::dec<<std::endl;
57 std::cout<<
"Factory config failed"<<std::endl;
63 const size_t bufferOffset = 256;
67 std::string geoName(argv[1]);
69 std::cout<<
"reading geometry from file "<<geoName<<std::endl;
71 size_t bSize = pBG->
load(geoName);
73 std::cout<<
"loaded "<<bSize<<
" bytes"<<std::endl;
75 std::shared_ptr<TrigAccel::OffloadBuffer> pDMBuff = std::make_shared<TrigAccel::OffloadBuffer>(pBG);
84 std::string data_path(argv[2]);
85 std::vector<std::string> event_files;
87 for(
const auto& entry : std::experimental::filesystem::directory_iterator(data_path)) {
88 event_files.push_back(entry.path());
93 std::cout<<
"running the GPU test with "<<
nEvents<<
" events"<<std::endl;
99 std::ofstream timeFile(
"results.csv");
101 timeFile<<
"nsp,nseeds,time"<<std::endl;
103 for(
int iEvent=0;iEvent<
nEvents;iEvent++) {
105 const std::string& fileName = event_files[fileIdx];
108 if(fileIdx >= (
int)event_files.size()) {
112 std::cout<<
"reading event from file "<<fileName<<std::endl;
114 bSize = pB->
load(fileName);
120 tbb::tick_count tzero = tbb::tick_count::now();
122 std::shared_ptr<TrigAccel::OffloadBuffer> pBuff = std::make_shared<TrigAccel::OffloadBuffer>(pB);
127 std::cout<<
"ERROR: cannot create work item"<<std::endl;
133 tbb::tick_count tnow=tbb::tick_count::now();
134 tbb::tick_count::interval_t duration = tnow - tzero;
135 std::cout<<
"triplet making took "<<duration.seconds()*1000.0<<
" ms"<<std::endl;
137 std::shared_ptr<TrigAccel::OffloadBuffer> pOB = pJob->
getOutput();
141 std::cout<<
"Found "<<pOutput->
m_nSeeds<<
" triplets"<<std::endl;