Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
fd1da301
Commit
fd1da301
authored
6 years ago
by
Neil Vaytet
Browse files
Options
Downloads
Patches
Plain Diff
Refs #20443 : Reverted to OMP schedule(static)
parent
deab8bb2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/Kernel/inc/MantidKernel/Strings.h
+13
-11
13 additions, 11 deletions
Framework/Kernel/inc/MantidKernel/Strings.h
with
13 additions
and
11 deletions
Framework/Kernel/inc/MantidKernel/Strings.h
+
13
−
11
View file @
fd1da301
...
...
@@ -165,17 +165,19 @@ join(ITERATOR_TYPE begin, ITERATOR_TYPE end, const std::string &separator,
// Initialise ostringstream
std
::
ostringstream
thread_stream
;
// Compute loop start and stop for current thread
int
nchunk
=
dist
/
nThreads
;
int
nstart
=
nchunk
*
idThread
;
int
nextra
=
dist
%
nchunk
;
if
(
idThread
<
nextra
)
nchunk
++
;
nstart
+=
std
::
min
(
idThread
%
nThreads
,
nextra
);
int
nstop
=
nstart
+
nchunk
;
// Write to ostringstream for this thread
for
(
int
i
=
nstart
;
i
<
nstop
;
i
++
)
{
/* To make sure the loop is done in the right order, we use schedule(static).
From the OpenMP documentation:
"When schedule(static, chunk_size) is specified, iterations are divided into
chunks of size chunk_size, and the chunks are assigned to the threads in the
team in a round-robin fashion **in the order of the thread number**."
"When no chunk_size is specified, the iteration space is divided into chunks
that are approximately equal in size, and at most one chunk is distributed to
each thread."
*/
#pragma omp for schedule(static)
for
(
int
i
=
0
;
i
<
dist
;
i
++
)
{
thread_stream
<<
separator
<<
*
(
begin
+
i
);
}
output
[
idThread
]
=
thread_stream
.
str
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment