Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-fem-dg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
dune-fem
dune-fem-dg
Commits
944a0aff
Commit
944a0aff
authored
6 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[bugfix][ThreadHandle] adjust to changes in ThreadManager.
parent
69c3f6b1
No related branches found
No related tags found
1 merge request
!4
Latest features added to dune-fem-dg.
Pipeline
#12308
failed
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/fem-dg/pass/threadhandle.hh
+22
-20
22 additions, 20 deletions
dune/fem-dg/pass/threadhandle.hh
with
22 additions
and
20 deletions
dune/fem-dg/pass/threadhandle.hh
+
22
−
20
View file @
944a0aff
#ifndef DUNE_FEM_PTHREADCLASS_HH
#define DUNE_FEM_PTHREADCLASS_HH
#if USE_PTHREADS && ! HAVE_PTHREAD
#error "pthreads not found, reconfigure!"
#endif
#include
<cassert>
#include
<mutex>
#include
<vector>
...
...
@@ -52,7 +48,7 @@ namespace Fem
}
};
#if
US
E_PTHREAD
S
#if
HAV
E_PTHREAD
////////////////////////////////////////////
// class ThreadHandleObject
////////////////////////////////////////////
...
...
@@ -303,7 +299,7 @@ namespace Fem
pthread_barrier_destroy
(
&
waitBegin_
);
}
#endif
#endif
// end HAVE_PTHREAD
public
:
template
<
class
Object
>
...
...
@@ -314,20 +310,23 @@ namespace Fem
if
(
!
ThreadManager
::
singleThreadMode
()
)
DUNE_THROW
(
InvalidStateException
,
"ThreadHandle :: run called from thread parallel region!"
);
#if USE_PTHREADS
#if HAVE_PTHREAD
if
(
ThreadManager
::
pthreads
)
{
// pthread version
instance
().
runThreads
(
obj
);
}
#else
// OpenMP parallel region
else
#endif
{
// OpenMP parallel region
#ifdef _OPENMP
#pragma omp parallel
#endif
{
obj
.
runThread
();
{
obj
.
runThread
();
}
}
#endif
}
template
<
class
Object
>
...
...
@@ -341,23 +340,26 @@ namespace Fem
// run threads in blocking mode
std
::
mutex
mtx
;
#if USE_PTHREADS
#if HAVE_PTHREAD
if
(
ThreadManager
::
pthreads
)
{
// pthread version
instance
().
runThreads
(
obj
,
&
mtx
);
}
#else
// use mutex to lock call
typename
ThreadHandle
::
template
ObjectWrapper
<
Object
>
objCaller
(
obj
,
&
mtx
);
else
#endif
{
// use mutex to lock call
typename
ThreadHandle
::
template
ObjectWrapper
<
Object
>
objCaller
(
obj
,
&
mtx
);
// OpenMP parallel region
// OpenMP parallel region
#ifdef _OPENMP
#pragma omp parallel
#endif
{
objCaller
.
run
();
{
objCaller
.
run
();
}
}
#endif
}
};
...
...
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