Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Sudhanshu Sane
VTK-m
Commits
59dc78fd
Commit
59dc78fd
authored
Dec 22, 2017
by
Sujin Philip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ErrorBadDevice
parent
4810cef7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
0 deletions
+72
-0
vtkm/cont/CMakeLists.txt
vtkm/cont/CMakeLists.txt
+1
-0
vtkm/cont/ErrorBadDevice.h
vtkm/cont/ErrorBadDevice.h
+48
-0
vtkm/cont/RuntimeDeviceTracker.h
vtkm/cont/RuntimeDeviceTracker.h
+18
-0
vtkm/cont/TryExecute.cxx
vtkm/cont/TryExecute.cxx
+5
-0
No files found.
vtkm/cont/CMakeLists.txt
View file @
59dc78fd
...
...
@@ -68,6 +68,7 @@ set(headers
EnvironmentTracker.h
Error.h
ErrorBadAllocation.h
ErrorBadDevice.h
ErrorBadType.h
ErrorBadValue.h
ErrorExecution.h
...
...
vtkm/cont/ErrorBadDevice.h
0 → 100644
View file @
59dc78fd
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_cont_ErrorBadDevice_h
#define vtk_m_cont_ErrorBadDevice_h
#include <vtkm/cont/Error.h>
namespace
vtkm
{
namespace
cont
{
VTKM_SILENCE_WEAK_VTABLE_WARNING_START
/// This class is thrown when VTK-m performs an operation that is not supported
/// on the current device.
///
class
VTKM_ALWAYS_EXPORT
ErrorBadDevice
:
public
Error
{
public:
ErrorBadDevice
(
const
std
::
string
&
message
)
:
Error
(
message
)
{
}
};
VTKM_SILENCE_WEAK_VTABLE_WARNING_END
}
}
// namespace vtkm::cont
#endif // vtk_m_cont_ErrorBadDevice_h
vtkm/cont/RuntimeDeviceTracker.h
View file @
59dc78fd
...
...
@@ -22,6 +22,7 @@
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/ErrorBadAllocation.h>
#include <vtkm/cont/ErrorBadDevice.h>
#include <vtkm/cont/RuntimeDeviceInformation.h>
namespace
vtkm
...
...
@@ -85,6 +86,23 @@ public:
this
->
SetDeviceState
(
deviceId
,
name
,
false
);
}
//@{
/// Report a ErrorBadDevice failure and flag the device as unusable.
template
<
typename
DeviceAdapterTag
>
VTKM_CONT
void
ReportBadDeviceFailure
(
DeviceAdapterTag
,
const
vtkm
::
cont
::
ErrorBadDevice
&
)
{
using
Traits
=
vtkm
::
cont
::
DeviceAdapterTraits
<
DeviceAdapterTag
>
;
this
->
SetDeviceState
(
Traits
::
GetId
(),
Traits
::
GetName
(),
false
);
}
VTKM_CONT
void
ReportBadDeviceFailure
(
vtkm
::
Int8
deviceId
,
const
std
::
string
&
name
,
const
vtkm
::
cont
::
ErrorBadDevice
&
)
{
this
->
SetDeviceState
(
deviceId
,
name
,
false
);
}
//@}
/// Reset the tracker for the given device. This will discard any updates
/// caused by reported failures
///
...
...
vtkm/cont/TryExecute.cxx
View file @
59dc78fd
...
...
@@ -46,6 +46,11 @@ void HandleTryExecuteException(vtkm::Int8 deviceId,
//than we fallback to another device
tracker
.
ReportAllocationFailure
(
deviceId
,
name
,
e
);
}
catch
(
vtkm
::
cont
::
ErrorBadDevice
&
e
)
{
std
::
cerr
<<
"caught ErrorBadDevice: "
<<
e
.
GetMessage
()
<<
std
::
endl
;
tracker
.
ReportBadDeviceFailure
(
deviceId
,
name
,
e
);
}
catch
(
vtkm
::
cont
::
ErrorBadType
&
e
)
{
//should bad type errors should stop the execution, instead of
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment