Skip to content

Commit

Permalink
Simplify OpenMP clause to avoid compiler bugs
Browse files Browse the repository at this point in the history
Issues were encountered when using NVC++ compiler and ScoreP wrapper.
Those are compiler bugs, but extracting the chunk size not only avoids
the problem, but also makes the code (subjectively) easier to read.
  • Loading branch information
al42and committed Mar 16, 2024
1 parent f03fdef commit c498f01
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/muParserBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,8 @@ namespace mu
#endif
omp_set_num_threads(nMaxThreads);

#pragma omp parallel for schedule(static, std::max(nBulkSize/nMaxThreads, 1)) private(nThreadID)
const int chunkSize = std::max(nBulkSize/nMaxThreads, 1);
#pragma omp parallel for schedule(static, chunkSize) private(nThreadID)
for (i = 0; i < nBulkSize; ++i)
{
nThreadID = omp_get_thread_num();
Expand Down

0 comments on commit c498f01

Please sign in to comment.