Commit f1094442 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Honor "iothreads" when reading from seismic store, allowing OpenZGY to do more...

Honor "iothreads" when reading from seismic store, allowing OpenZGY to do more parallelizing internally.
parent ac925be7
......@@ -1232,15 +1232,31 @@ SeismicStoreFile::xx_readv(const ReadList& requests, bool parallel_ok, bool immu
// cloud reads then this needs to wait until the end. Or of really
// fancy, keep track of when all the data has need read for each
// of the original requests.
for (const auto& it : work) {
const std::int64_t worksize = work.size();
const std::int64_t threadcount = std::max(std::min(std::min(
worksize,
static_cast<std::int64_t>(omp_get_max_threads())),
_config->_iothreads),
static_cast<std::int64_t>(1));
MTGuard guard;
//std::cerr << "Access seismic store (" << worksize << "): ";
#pragma omp parallel for num_threads(threadcount) schedule(dynamic,1)
for (std::int64_t ii=0; ii<worksize; ++ii) {
//if (!ii) std::cerr << ("[" + std::to_string(omp_get_num_threads()) + "]");
const auto& it = work[ii];
guard.run([&](){
//std::cerr << "0123456789"[omp_get_thread_num() % 10];
SimpleTimerEx tt(*_rtimer);
this->_dataset->dataset()->readBlock
(static_cast<int>(it.blocknum),
data.get() + it.outpos,
static_cast<size_t>(it.local_offset),
static_cast<size_t>(it.local_size));
});
_rtimer->addBytesRead(it.local_size);
}
guard.finished();
//std::cerr << "$\n";
// TODO-Performance, if parallel_ok, can I parallelize only this
// loop if it gets too difficult to do it inside the above loop?
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment