Fix non-openmp build. (#5566)
* Add test to Jenkins. * Fix threading utils tests. * Require thread library.
This commit is contained in:
@@ -110,10 +110,12 @@ class BlockedSpace2d {
|
||||
|
||||
// Wrapper to implement nested parallelism with simple omp parallel for
|
||||
template<typename Func>
|
||||
void ParallelFor2d(const BlockedSpace2d& space, const int nthreads, Func func) {
|
||||
void ParallelFor2d(const BlockedSpace2d& space, int nthreads, Func func) {
|
||||
const size_t num_blocks_in_space = space.Size();
|
||||
nthreads = std::min(nthreads, omp_get_max_threads());
|
||||
nthreads = std::max(nthreads, 1);
|
||||
|
||||
#pragma omp parallel num_threads(nthreads)
|
||||
#pragma omp parallel num_threads(nthreads)
|
||||
{
|
||||
size_t tid = omp_get_thread_num();
|
||||
size_t chunck_size = num_blocks_in_space / nthreads + !!(num_blocks_in_space % nthreads);
|
||||
|
||||
Reference in New Issue
Block a user