Remove error counting in OpenMP parallelize_gemm

This resolves a compilation error associated with
Eigen::eigen_assert_exception. It also eliminates the counting of
exceptions that may occur in the OpenMP parallel section. If an
unhandled exception occurs in this section, the behavior is non-conforming
according to the OpenMP specification.
This commit is contained in:
Luke Peterson 2020-10-08 12:16:53 -07:00
parent 7a0a2a5001
commit ef3cc72cb6
2 changed files with 6 additions and 10 deletions

View File

@ -132,8 +132,7 @@ void parallelize_gemm(const Functor& func, Index rows, Index cols, Index depth,
ei_declare_aligned_stack_constructed_variable(GemmParallelInfo<Index>,info,threads,0); ei_declare_aligned_stack_constructed_variable(GemmParallelInfo<Index>,info,threads,0);
int errorCount = 0; #pragma omp parallel num_threads(threads)
#pragma omp parallel num_threads(threads) reduction(+: errorCount)
{ {
Index i = omp_get_thread_num(); Index i = omp_get_thread_num();
// Note that the actual number of threads might be lower than the number of request ones. // Note that the actual number of threads might be lower than the number of request ones.
@ -152,14 +151,11 @@ void parallelize_gemm(const Functor& func, Index rows, Index cols, Index depth,
info[i].lhs_start = r0; info[i].lhs_start = r0;
info[i].lhs_length = actualBlockRows; info[i].lhs_length = actualBlockRows;
EIGEN_TRY { if(transpose)
if(transpose) func(c0, actualBlockCols, 0, rows, info); func(c0, actualBlockCols, 0, rows, info);
else func(0, rows, c0, actualBlockCols, info); else
} EIGEN_CATCH(...) { func(0, rows, c0, actualBlockCols, info);
++errorCount;
}
} }
if (errorCount) EIGEN_THROW_X(Eigen::eigen_assert_exception());
#endif #endif
} }

View File

@ -163,7 +163,7 @@ ei_add_test(constructor)
ei_add_test(linearstructure) ei_add_test(linearstructure)
ei_add_test(integer_types) ei_add_test(integer_types)
ei_add_test(unalignedcount) ei_add_test(unalignedcount)
if(NOT EIGEN_TEST_NO_EXCEPTIONS) if(NOT EIGEN_TEST_NO_EXCEPTIONS AND NOT EIGEN_TEST_OPENMP)
ei_add_test(exceptions) ei_add_test(exceptions)
endif() endif()
ei_add_test(redux) ei_add_test(redux)