Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK-m
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Dave Pugmire
VTK-m
Commits
9ae3098a
Commit
9ae3098a
authored
7 years ago
by
Robert Maynard
Browse files
Options
Downloads
Patches
Plain Diff
Give each thread using vtk a separate runtime device tracker
parent
9f51f4b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vtkm/cont/RuntimeDeviceTracker.cxx
+19
-2
19 additions, 2 deletions
vtkm/cont/RuntimeDeviceTracker.cxx
vtkm/cont/RuntimeDeviceTracker.h
+3
-3
3 additions, 3 deletions
vtkm/cont/RuntimeDeviceTracker.h
with
22 additions
and
5 deletions
vtkm/cont/RuntimeDeviceTracker.cxx
+
19
−
2
View file @
9ae3098a
...
...
@@ -29,7 +29,10 @@
#include
<vtkm/cont/tbb/DeviceAdapterTBB.h>
#include
<algorithm>
#include
<map>
#include
<mutex>
#include
<sstream>
#include
<thread>
#define VTKM_MAX_DEVICE_ADAPTER_ID 8
...
...
@@ -155,8 +158,22 @@ void RuntimeDeviceTracker::ForceDeviceImpl(vtkm::cont::DeviceAdapterId deviceId,
VTKM_CONT
vtkm
::
cont
::
RuntimeDeviceTracker
GetGlobalRuntimeDeviceTracker
()
{
static
vtkm
::
cont
::
RuntimeDeviceTracker
globalTracker
;
return
globalTracker
;
static
std
::
mutex
mtx
;
static
std
::
map
<
std
::
thread
::
id
,
vtkm
::
cont
::
RuntimeDeviceTracker
>
globalTrackers
;
std
::
thread
::
id
this_id
=
std
::
this_thread
::
get_id
();
std
::
unique_lock
<
std
::
mutex
>
lock
(
mtx
);
auto
iter
=
globalTrackers
.
find
(
this_id
);
if
(
iter
!=
globalTrackers
.
end
())
{
return
iter
->
second
;
}
else
{
vtkm
::
cont
::
RuntimeDeviceTracker
tracker
;
globalTrackers
[
this_id
]
=
tracker
;
return
tracker
;
}
}
}
}
// namespace vtkm::cont
This diff is collapsed.
Click to expand it.
vtkm/cont/RuntimeDeviceTracker.h
+
3
−
3
View file @
9ae3098a
...
...
@@ -207,13 +207,13 @@ private:
bool
runtimeExists
);
};
/// \brief Get the
global
\c RuntimeDeviceTracker.
/// \brief Get the \c RuntimeDeviceTracker
for the current thread
.
///
/// Many features in VTK-m will attempt to run algorithms on the "best
/// available device." This often is determined at runtime as failures in
/// one device are recorded and that device is disabled. To prevent having
/// to check over and over again, VTK-m
features generally use the global
///
device adapter
so that these choices are marked and shared.
/// to check over and over again, VTK-m
uses per thread runtime device tracker
/// so that these choices are marked and shared.
///
VTKM_CONT_EXPORT
VTKM_CONT
...
...
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