dumppmicubed: use dynamic scheduler for omp loop
The first words have by far the most partners, assign them to different
threads.
diff --git a/dumppmicubed.cc b/dumppmicubed.cc
index 3482da0..41fd4a3 100644
--- a/dumppmicubed.cc
+++ b/dumppmicubed.cc
@@ -23,7 +23,7 @@
FILE* pFile;
CollocatorDB cdb = CollocatorDB(argv[1], true);
std::cerr << "Database " << argv[1] << " opened\n";
- #pragma omp parallel for
+ #pragma omp parallel for schedule(dynamic, 1)
for(uint32_t i=START; i< STOP; i++) {
std::vector<rocksdb::Collocator> cs = cdb.get_collocators(i);
int j=0;
@@ -34,11 +34,11 @@
}
if(done++ % 100 == 0) {
std::cerr <<"\r\033[2K"<<std::flush;
- std::cerr << "done: " << done * 100.0 / (STOP-START) << "%" <<std::flush;
+ std::cerr << "done: " << done * 100.0 / (STOP-START) << "%" << " (todo: " << STOP-START-done << ")" << std::flush;
}
}
pFile = fopen("file.binary", "wb");
- fwrite(array, STOP*20, sizeof(uint32_t), pFile);
+ fwrite(array, sizeof(uint32_t), STOP*20, pFile);
fclose(pFile);
std::cout << std::flush;
}