Skip to content

Commit

Permalink
Looks like defined(_OPENMP) is what's known in the MSVC(2019) world…
Browse files Browse the repository at this point in the history
…: added that one as another enabling condition since benchmarks have shown MSVC2019's `/openmp:experimental` to deliver. :-) (See tesseract-ocr#3486 benchmark reports on @stweil's DotProductNative() implementation)
  • Loading branch information
GerHobbelt committed Jul 13, 2021
1 parent f32b9de commit a5d45b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/arch/dotproduct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace tesseract {
template <class TFloat>
TFloat DotProductNative(const TFloat *u, const TFloat *v, int n) {
TFloat total = 0;
#if defined(OPENMP_SIMD)
#if defined(OPENMP_SIMD) || defined(_OPENMP)

This comment has been minimized.

Copy link
@stweil

stweil Jul 13, 2021

I think that _OPENMP is the standard macro which is defined when OpenMP is enabled.

But we don't want to enable OpenMP (at least not for all Tesseract code) because that would enable multithreading, too, and that costs a lot of computation overhead.

For Linux it is possible to enable OpenMP SIMD without enabling all of OpenMP. Is there a compiler flag which supports such limited OpenMP for MS VC, too?

#pragma omp simd reduction(+:total)
#endif
for (int k = 0; k < n; k++) {
Expand Down

0 comments on commit a5d45b9

Please sign in to comment.