Commit Graph

2669 Commits

Author SHA1 Message Date
Kenneth Moreland
1ec4e5d62c Improve type reporting in UnknownArrayHandle
Added features with reporting types with `UnknownArrayHandle`. First,
added a method named `GetArrayTypeName` that returns a string containing
the type of the contained array. There were already methods
`GetValueType` and `GetStorageType`, but this provides a convenience to
get the whole name in one go.

Also improved the reporting when an `AsArrayHandle` call failed. Before,
the thrown method just reported that the `UnknownArrayHandle` could not
be converted to the given type. Now, it also reports the type actually
held by the `UnknownArrayHandle` so the user can better understand why
the conversion failed.
2021-08-04 12:11:10 -06:00
Kenneth Moreland
6f5455d0d6 Enable TypeToString for type_info
VTK-m contains a helpful method named `vtkm::cont::TypeToString` that
either takes a type as a template argument or a `std::type_info` object
and returns a human-readable string for that type.

The standard C++ library has an alternate for `std::type_info` named
`std::type_index`, which has the added ability to be used in a container
like `set` or `map`. The `TypeToString` overloads have been extended to
also accept a `std::type_info` and report the name of the type stored in
it (rather than the name of `type_info` itself).
2021-08-04 12:11:10 -06:00
Kenneth Moreland
822eb8f165 Merge topic 'copy-runtime-state'
624117963 Add RuntimeDeviceTracker::CopyState

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2540
2021-07-29 10:37:52 -04:00
Kenneth Moreland
3b9e028a5e Merge topic 'deprecate-arrayhandle-getdeviceadapterid'
34615a985 Deprecate ArrayHandle::GetDeviceAdapterId

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2534
2021-07-29 10:37:05 -04:00
Kenneth Moreland
6241179631 Add RuntimeDeviceTracker::CopyState
It is sometimes the case that you want to copy the state of one
`RuntimeDeviceTracker` to another. This is particularly the case when
creating threads in the control environment. Each thread has its own
copy of `RuntimeDeviceTracker`, so when you spawn a thread you probably
want to copy the state of the tracker from the calling thread.
2021-07-28 13:16:12 -06:00
Kenneth Moreland
34615a9858 Deprecate ArrayHandle::GetDeviceAdapterId
This method is a remenant of when `ArrayHandle` could only store data on
one device at a time. It is now capable of storing data on any number of
devices (as well as the host), so asking for "the" device no longer
makes sense. Thus, this method is deprecated in favor of
`ArrayHandle::IsOnDevice`.

This deprecation leads to fixing some older functionality that still
assumed data could only be on one device at a time.

Fixes #592.
2021-07-28 12:51:51 -06:00
Kenneth Moreland
5c36eafe56 Add ArrayCopyShallowIfPossible
Often times you have an array of an unknown type (likely from a data set),
and you need it to be of a particular type (or can make a reasonable but
uncertain assumption about it being a particular type). You really just
want a shallow copy (a reference in a concrete `ArrayHandle`) if that is
possible.

`ArrayCopyShallowIfPossible` pulls an array of a specific type from an
`UnknownArrayHandle`. If the type is compatible, it will perform a shallow
copy. If it is not possible, a deep copy is performed to get it to the
correct type.

Fixes #572.
2021-07-15 08:52:07 -06:00
Kenneth Moreland
b01ca530b8 Turn on floating point exception trapping for GCC in tests
Some simulations trap floating point exceptions to ensure that their
code is working correctly, and we want VTK-m to work correctly in their
code. To check this, we want to turn on floating point exception
trapping in our test code. This is very implementation-specific, so for
now we are just turning it on for GCC. This will at least alert a
problem on some of the dashboards.
2021-07-12 10:29:37 -06:00
Kenneth Moreland
80d622cd92 Merge topic 'unknown-array-better-allocate'
8d7cf2c85 Support all Allocate flags in UnknownArrayHandle

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2522
2021-06-30 14:06:18 -04:00
Nickolas Davis
f949d8adea Merge topic 'device-resource-management'
fe3b82b99 implement return codes and protected virtual parsing of arguments
ce9c27bc0 Implement tests for RuntimeDeviceConfiguration helpers
408beefc0 Implement RuntimeDeviceConfiguration

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !2513
2021-06-23 16:11:32 -04:00
nadavi
fe3b82b99c implement return codes and protected virtual parsing of arguments 2021-06-23 17:58:38 +00:00
Kenneth Moreland
8d7cf2c858 Support all Allocate flags in UnknownArrayHandle
`UnknownArrayHandle` supported an `Allocate` method to change
the size of the underlying array without knowing its type.
However, it did not give all the features of `ArrayHandle`'s
allocate. Namely, you could not specify that the data should
be preserved and you could not provide a `Token` object. This
change adds these (optional) parameters.
2021-06-21 11:25:51 -06:00
nadavi
ce9c27bc0e Implement tests for RuntimeDeviceConfiguration helpers 2021-06-17 17:56:39 +00:00
nadavi
408beefc0a Implement RuntimeDeviceConfiguration 2021-06-17 17:56:38 +00:00
Kenneth Moreland
2589e5b740 Merge topic 'latest-tbb'
3be3529ff Export tbb interface as vtkm::tbb
a8825db59 Disable loading the TBBConfig.cmake file
5eb688da2 Update parallel radix sort for OpenMP
1eea0bee1 Use TBB task_group for radix sort
904e784e8 Remove TBB parallel_sort patch
0390c8b07 Pull FindTBB.cmake from VTK

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !2509
2021-06-14 09:27:16 -04:00
Kenneth Moreland
5eb688da2a Update parallel radix sort for OpenMP
Some changes required for TBB bled into the implementation of OpenMP.
2021-06-10 10:39:18 -06:00
Kenneth Moreland
1eea0bee12 Use TBB task_group for radix sort
TBB 2020 introduced a new class called `task_group`. TBB 2021 removed
the old class `task` as its functionality was replaced by `task_group`.
Our parallel radix sort for TBB was implemented using `task`s, so change
it to use `task_group` (which actually cleans up the code a bit).
2021-06-10 10:39:13 -06:00
Kenneth Moreland
904e784e89 Remove TBB parallel_sort patch
Years ago we discovered a problem with TBB's parallel sort, which we
patch in our local repo and submitted a change to TBB, which has been
accepted.

The code to decide whether to use our parallel_sort patch does not work
with the latest versions of TBB because it requires including a header
that changed names to get the TBB version.

We no longer support any TBB version with this bug, so just remove the
patch from VTK-m.
2021-06-10 09:18:08 -06:00
Dave Pugmire
3bd15950bd Clarify dimension values for 2d, 1d. fix test 2021-06-09 16:16:34 -04:00
Dave Pugmire
651345b491 cleanup included headers. 2021-06-09 14:02:42 -04:00
Dave Pugmire
aaa6855a6f Clean the code up a little. 2021-06-09 13:58:27 -04:00
Dave Pugmire
3588209562 Add helper class to build curvilinear datasets. 2021-06-09 13:50:01 -04:00
Ben Boeckel
b719911d1b cmake: use if (TEST) to detect tests that are enabled
It's just simpler in this case.
2021-06-01 18:40:46 -04:00
Ben Boeckel
4c7fe13a98 cmake: avoid adding testing directories if testing is disabled
Some testing directories have side effects such as installing headers or
compiling code that ultimately doesn't end up getting used.
2021-06-01 18:40:40 -04:00
Kenneth Moreland
e0abb39810 Unify common storage types
The list defining the common storage types was defined in
DefaultTypes.h.in. The problem was that derived default types could not
just add their own type. They had to redefine the whole list.

Instead, move the list to StorageList.h. Also updated
DefaultTypesVTK.h.in to use this list when using XGC. This enables
ArrayHandleSOA for this case.
2021-05-13 08:18:33 -06:00
Nickolas Davis
c4117ede8a Merge topic 'prefix-cmd-line-args'
968c66f94 add TODO to update kokkos initialize
18d7827db update vtkm test arguments
5fa8734bb update vtkm initialize flags to have 'vtkm' prefix and deprecate old flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !2456
2021-05-12 09:57:47 -04:00
Sujin Philip
7972070d7c PartitionedDataSet GetField should be const 2021-04-30 16:27:58 -04:00
nadavi
968c66f949 add TODO to update kokkos initialize 2021-04-29 00:58:50 +00:00
nadavi
18d7827db7 update vtkm test arguments 2021-04-29 00:58:50 +00:00
nadavi
5fa8734bbc update vtkm initialize flags to have 'vtkm' prefix and deprecate old flags 2021-04-29 00:58:50 +00:00
Kenneth Moreland
8eed21d085 Do not declare headers for virtual classes that are removed 2021-04-28 15:28:06 -06:00
Kenneth Moreland
cb3bb43ff9 Completely deprecate virtual methods
Deprecate `VirtualObjectHandle` and all other classes that are used to
implement objects with virtual methods in the execution environment.

Additionally, the code is updated so that if the
`VTKm_NO_DEPRECATED_VIRTUAL` flag is set none of the code is compiled at
all. This opens us up to opportunities that do not work with virtual
methods such as backends that do not support virtual methods and dynamic
libraries for CUDA.
2021-04-28 07:28:32 -06:00
Nick Thompson
9f1ef651c4 Update UnitTestError.cxx 2021-04-16 17:46:43 +00:00
Nick Thompson
794872eb07 Fix error in unit test. 2021-04-13 11:21:42 -04:00
Nick Thompson
9d6b732750 Use better variable names. 2021-04-12 18:51:53 -04:00
Nick Thompson
4133e40c06 Remove printing of expected errors. 2021-04-12 18:51:53 -04:00
Nick Thompson
eb760e04ef Revert removal of print statements. 2021-04-12 18:51:53 -04:00
Nick Thompson
e7c075b5c4 Remove unused variable. 2021-04-12 18:51:53 -04:00
Nick Thompson
cb83b81793 Save another 10 seconds. 2021-04-12 18:51:52 -04:00
Nick Thompson
1b11348cc3 Reduce data size to operate on in unit tests. 2021-04-12 18:51:52 -04:00
Nick Thompson
134c6c3d4e Speed up CellLocator tests. 2021-04-12 18:51:51 -04:00
Nick Thompson
33993db2df Reduce runtime of unit tests. 2021-04-12 18:51:51 -04:00
Nick Thompson
ff4ad96efc Do not print extra information on Kokkos and CUDA. 2021-04-12 15:01:07 -04:00
Nick Thompson
321571fabe Make sure operator precedence is correct over macro invocation. 2021-04-12 13:50:27 -04:00
Nick Thompson
94a32bf64c Improve code in response to review. 2021-04-12 13:42:19 -04:00
Nick Thompson
568c0b5d29 Small formatting changes. 2021-04-12 13:05:36 -04:00
Nick Thompson
a8e25da0ab Add __func__ to unit test metadata printed on failure. 2021-04-12 12:54:38 -04:00
Kenneth Moreland
14839a0325 Fix deprecation warnings with MSVC 2021-04-08 09:28:03 -06:00
Kenneth Moreland
5510521a06 Fix VariantArrayHandle::AsVirtual with cast arrays
The both the underlying `UnknownArrayHandle` and `ArrayHandleVirtual`
handle `ArrayHandleCast` specially. This caused problems when passing an
`ArrayHandleCast` to `VariantArrayHandle::AsVirtual`. Solve the problem
by stripping out the cast storage tags and letting these classes handle
it internally.

It's annoying to have to fix a problem in a method of a deprecated class
that returns another class that is deprecated for a different reason. No
one should really be running this.
2021-04-08 09:21:39 -06:00
Kenneth Moreland
b4ef9fcac3 Fix UnknownArrayHandle::CastAndCall for special arrays
`UnknownArrayHandle` treats a `ArrayHandleCast` and
`ArrayHandleMultiplexer` special. When you put one of these arrays in an
`UnknownArrayHandle`, it takes the original array out and stores it. If
you try to take an array of that type out, it will again do the proper
conversion.

The only problem is that if you use `IsType`, the result can be
unexpected. This is what happened with `CastAndCall`, which was using
`IsType` internally. Changed that to `CanConvert` to properly get the
array handle out.
2021-04-07 16:12:42 -06:00