Commit Graph

154 Commits

Author SHA1 Message Date
Kenneth Moreland
d967205817 Consolidate UnitTestVirtualObjectHandle
Previously, each device adapter implementation had their own version of
this test by including a common header. Simplify this by making a single
test in UnitTests_vtkm_cont_testing, which can now be compiled for and
tested on a device.
2022-07-13 13:27:38 -06:00
Kenneth Moreland
896065044a Consolidate UnitTestPointLocatorSparseGrid
Previously, each device adapter implementation had their own version of
this test by including a common header. Simplify this by making a single
test in UnitTests_vtkm_cont_testing, which can now be compiled for and
tested on a device.
2022-07-13 13:27:38 -06:00
Kenneth Moreland
d569bbca40 Consolidate UnitTestImplicitFunction
Previously, each device adapter implementation had their own version of
this test by including a common header. Simplify this by making a single
test in UnitTests_vtkm_cont_testing, which can now be compiled for and
tested on a device.
2022-07-13 13:27:17 -06:00
Kenneth Moreland
b2b075f047 Consolidate UnitTestDataSet*
Previously, each device adapter implementation had their own version of
these tests by including a common header. Simplify this by making a
single test in UnitTests_vtkm_cont_testing for each, which can now be
compiled for and tested on a device.
2022-07-13 12:09:24 -06:00
Kenneth Moreland
f48789f57c Consolidate UnitTestComputeRange
Previously, each device adapter implementation had their own version of
this test by including a common header. Simplify this by making a single
test in UnitTests_vtkm_cont_testing, which can now be compiled for and
tested on a device.

Also re-enabled the testing of ranges for Vecs of size 9, which is now
supported.
2022-07-13 12:07:10 -06:00
Kenneth Moreland
bda676e7d9 Consolidate UnitTestColorTable
Previously, each device adapter implementation had their own version of
this test by including a common header. Simplify this by making a single
test in UnitTests_vtkm_cont_testing, which can now be compiled for and
tested on a device.
2022-07-13 12:05:39 -06:00
Kenneth Moreland
12c1a80212 Consolidate UnitTestCellLocator*
Previously, each device adapter implementation had their own version of
these tests by including a common header. Simplify this by making a
single test in UnitTests_vtkm_cont_testing for each, which can now be
compiled for and tested on a device.
2022-07-13 12:03:25 -06:00
Kenneth Moreland
891cfcfa86 Consolidate UnitTestBitField
Previously, each device adapter implementation had their own version of
this test by including a common header. Simplify this by making a single
test in UnitTests_vtkm_cont_testing, which can now be compiled for and
tested on a device.
2022-07-13 11:59:27 -06:00
Kenneth Moreland
05bf2e4518 Remove TestingFancyArrayHandles.h
This header file contained tests for a bunch of fancy array handles so
that they could be compiled for each device. These tests were bunched
together because they were replicated for each device implementation,
which was a hassle. However, having a bunch of tests crammed together is
problematic for a number of reasons.

The new testing no longer has a need to make a separate test for each
device. Thus, the tests for the individual devices are removed, and the
tests are split up and added to the basic vtkm_cont tests. In some
cases, individual tests already existed there as well (probably because
the developer did not see the test).
2022-07-13 11:52:11 -06:00
Kenneth Moreland
3a03c38ebf Consoidate UnitTestArrayHandleMultiplexer
Previously, each device adapter implementation had their own version of
this test by including a common header. Simplify this by making a single
test in UnitTests_vtkm_cont_testing, which can now be compiled for and
tested on a device.
2022-07-13 11:52:04 -06:00
Kenneth Moreland
2a0e92c63e Consolidate UnitTestArrayHandle
Previously, each device adapter implementation had their own version of
this test by including a common header. Simplify this by making a single
test in UnitTests_vtkm_cont_testing, which can now be compiled for and
tested on a device.
2022-07-13 11:49:26 -06:00
Kenneth Moreland
c7053f584c Merge topic 'deallocate-after-finalize'
9855db096 Add test for array and datas that are cleaned up after finalize

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2801
2022-07-12 14:33:30 -04:00
Kenneth Moreland
163d591795 Add DEVICE_SOURCES to vtkm_unit_tests
The `vtkm_unit_tests` function in the CMake build now allows you to specify
which files need to be compiled with a device compiler using the
`DEVICE_SOURCES` argument. Previously, the only way to specify that unit
tests needed to be compiled with a device compiler was to use the
`ALL_BACKENDS` argument, which would automatically compile everything with
the device compiler as well as test the code on all backends.
`ALL_BACKENDS` is still supported, but it no longer changes the sources to
be compiled with the device compiler.
2022-07-08 06:28:51 -06:00
Kenneth Moreland
9855db0961 Add test for array and datas that are cleaned up after finalize
It is the case that arrays might be deallocated from a device after the
device is closed. This can happen, for example, when an `ArrayHandle` is
declared globally. It gets constructed before VTK-m is initialized. This
is OK as long as you do not otherwise use it until VTK-m is initialized.
However, if you use that `ArrayHandle` to move data to a device and that
data is left on the device when the object closes, then the
`ArrayHandle` will be left holding a reference to invalid device memory
once the device is shut down. This can cause problems when the
`ArrayHandle` destructs itself and attempts to release this memory.

The VTK-m devices should gracefully handle deallocations that happen
after device shutdown.
2022-07-01 12:36:55 -06:00
Kenneth Moreland
7749b86b22 Move MakeTestDataSet.cxx to vtkm_cont
Originally `MakeTestDataSet.h` was header-only code. This was changed to
put its functionality into a library. The obvious library to put it in
was `vtkm_cont_testing`.

The problem is that there is some external code that is (unadvisably)
adding this header to their own code. This code ends up breaking because
it needed to include `vtkm_cont_testing`, which was not needed before.

As a workaround, there was a CMake interface link that caused external
code linking in `vtkm_cont` to also link in `vtkm_cont_testing`. This
works OK, but creates something of a circular dependency. CMake itself
has no problem with this, because `vtkm_cont` did not itself depend on
`vtkm_cont_testing`; only things that linked to `vtkm_cont` also had to
link to `vtkm_cont_testing`.

Unfortunately, some Ascent CMake script was trying to trace down
dependencies and ran into an infinite loop. So this solution was not so
great for them.

Get around the problem by just adding the `MakeTestDataSet` code
directly to `vtkm_cont` (for now).
2022-05-24 14:43:10 -06:00
Kenneth Moreland
9d6f63b677 Add vtkm_cont_testing to interface of vtkm_cont
Recent changes to VTK-m include changes to MakeDataSet.h that require
the vtkm_cont_testing library to be loaded. This is problematic for
software using an earlier minor revision as they do not expect to need
to include this library.

For now, include vtkm_cont_testing in the interface of vtkm_cont so that
downstream code will load it. This should be a temporary solution. As we
move to new versions of VTK-m, we should break this link and require
downstream components to include it themselves.
2022-03-16 14:44:42 -06:00
Kenneth Moreland
de14629c1f Merge topic 'render-test-improvements'
1981f9061 Add secondary image for MapperConnectivity test
d4d1ef955 Add secondary image for MapperQuad test
54c1a85d0 Reduce templating in RenderTest code
c0fbe5f30 Remove antiquated templated render test functions
0fe9300ee Expand test_equal_images
12e116417 Redefine RenderTest interface for library
afa8c9082 Add struct for passing options to render tests
9173d6bba Rename RegressionTests to RenderTests
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Nickolas Davis <nadavi@sandia.gov>
Merge-request: !2657
2022-01-04 14:54:31 -05:00
Kenneth Moreland
a2ab460f5d Compile more sources without device compiler
We have been doing a better job at hiding device code (and moving code
into libraries). Smoke out source that no longer needs to be compiled by
device compilers.
2022-01-03 08:23:04 -07:00
Kenneth Moreland
d29532c23c Move non-templated testing functions to library
Previously, all methods in the `vtkm::cont::testing::Testing` class were
inlined in the header file. This makes sense for the methods that are
templated, but not so much for methods that are not templated.

Although this change provides minimal improvements with compile times
and object sizes (maybe). But the real benefit is that some of these
methods declare static objects. When declared in inlined functions, a
different object will be created for each translation unit. This can
lead to unexpected behavior when multiple versions of a supposed
singleton static object exist.
2021-12-29 13:12:36 -07:00
Kenneth Moreland
d7a4e0d757 Merge topic 'unknown-cell-set'
1dc3d145a Allow `UnknownCellSet::Cast` return a reference
030ac1fff Fix some copy/paste errors with comments and variable names
4cb392ca2 Make DynamicCellSet directly an UnknownCellSet
6da5aa456 Replace DynamicCellSet implementation with UnknownCellSet
ac024587a Add UncertainCellSet

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2647
2021-12-17 09:44:53 -05:00
Kenneth Moreland
ac024587a6 Add UncertainCellSet
This is a replacement for DynamicCellSet that requires less templating.
2021-12-15 12:59:18 -07:00
Li-Ta Lo
1b2ea8ea81 remove ArrayCopy 2021-12-14 09:36:33 -07:00
Li-Ta Lo
942653bbe2 Extract implementation of MakeTestDataSet to .cxx 2021-12-13 19:11:40 -07:00
Roxana Bujack
f4605302ee add unit test 2021-10-28 15:36:20 -06:00
Jieyang Chen
a157c0e846 Add changes for supporting Kokkos/HIP
Some of the unit tests for serial and kokkos are disable for hipcc to
properly compile.
VTKM_MATH_ASSERT and VTKM_TEST_ASSERT fail to compile with HIP in
execution environment so they are disabled with building with HIP.
Kokkos::finalize is causing error so it is temporarily disabled.
2021-10-01 15:27:00 -04:00
Vicente Adolfo Bolea Sanchez
b83b4f8880 CMake: adds VTKm_ENABLE_TESTING_LIB 2021-09-28 16:58:18 -04:00
Kenneth Moreland
24621e95ed Merge topic 'convert-to-expected'
0855de1b4 Collect the get methods for `Field` in the header definition
47371bb5e Add ability to convert fields to known types

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !2558
2021-08-23 15:15:44 -04:00
Kenneth Moreland
47371bb5e6 Add ability to convert fields to known types
In VTK-m we have a constant tension between minimizing the number of
types we have to compile for (to reduce compile times and library size)
and maximizing the number of types that our filters support.
Unfortunately, if you don't compile a filter for a specific array type
(value type and storage), trying to run that filter will simply fail.

To compromise between the two, added methods to `DataSet` and `Field`
that will automatically convert the data in the `Field` arrays to a type
that VTK-m will understand. Although this will cause an extra data copy,
it will at least prevent the program from failing, and thus make it more
feasible to reduce types.
2021-08-19 07:10:20 -06:00
Nickolas Davis
56cbd0abe2 Merge topic 'kokkos-runtime-device-config'
cd2a6c138 implement kokkos runtime device configuration

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !2549
2021-08-18 16:35:43 -04:00
nadavi
cd2a6c1385 implement kokkos runtime device configuration 2021-08-18 13:23:30 -06:00
Kenneth Moreland
3feff36891 Save device choice on spawned control threads
The `RuntimeDeviceTracker` is a thread-local variable that monitors the
devices to use separately on each thread. This is an important feature
to allow different threads to control different devices.

When a tracker is created on a new thread, it was simply reset, which
makes sense. However, the reset does not take into account the device
selected by `vtkm::cont::Initialize`. This means that if VTK-m was used
in a different thread than it was initialized, it would ignore the
`--vtkm-device` parameter.

To get around this problem, keep track of the `RuntimeDeviceTracker` on
the "main" thread. When a `RuntimeDeviceTracker` is created on a new
thread, it copies the state from that tracker.
2021-07-29 16:57:27 -06:00
Dave Pugmire
3588209562 Add helper class to build curvilinear datasets. 2021-06-09 13:50:01 -04:00
Kenneth Moreland
75597e240b Merge topic 'array-range-compute-unknown'
04f020ae6 Update Field to use new ArrayRangeCompute features
2a41428fe Add implementation of ArrayRangeCompute for UnknownArrayHandle

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2409
2021-02-17 15:43:53 -05:00
Kenneth Moreland
b9430c52e6 Create ArrayHandleOffsetsToNumComponents
This is a fancy array that takes an array of offsets and converts it to
an array of the number of components for each packed entry.

This replaces the use of `ArrayHandleDecorator` in `CellSetExplicit`.
The two implementation should do the same thing, but the new
`ArrayHandleOffsetsToNumComponents` should be less complex for
compilers.
2021-02-17 10:44:47 -07:00
Kenneth Moreland
2a41428fe4 Add implementation of ArrayRangeCompute for UnknownArrayHandle
This allows you to easily compute the range of any ArrayHandle, even if
you don't know the type.

A unit test for ArrayRangeCompute was also added.
2021-02-17 09:18:31 -07:00
Kenneth Moreland
e61c54f873 Add CellLocatorChooser
`CellLocatorChooser` allows you to select a cell locator at compile
time. Unlike `CellLocatorGeneral`, you have to deduce what cell set
types you might have, but you don't have to have a large switch
statement in the middle of your worklet.
2021-02-15 12:39:11 -07:00
Caitlin Ross
46155daaa2 removing ArrayHandleExtrude* 2021-02-10 15:20:35 -05:00
Kenneth Moreland
755af739e3 Add ArrayHandleRecombineVec
The primary purpose of `ArrayHandleRecombineVec` is to take arrays
returned from `ArrayExtractComponent` and recombine them again into a
single `ArrayHandle` that has `Vec` values.
2021-01-04 11:55:02 -07:00
Kenneth Moreland
932c8e5ec0 Wrap test_equal_ArrayHandles into a precompiled library
The previous implementation of test_equal_ArrayHandles was several
templates that had to be resolved by any test that used them, which
could be costly for unknown array types. Simplify this a bit by moving
the implementation of testing unknown arrays into a library.

Another advantage of the new implementation is that is handles more
cases. Thus, you should not need to `ResetTypes` on the unknown/
uncertain arrays.
2020-12-22 17:17:19 -07:00
Kenneth Moreland
760553725c Add ArrayExtractComponent function
`ArrayExtractComponent` allows you to get a component of an array.
Unlike `ArrayHandleExtractComponent`, the type you get is always the
same: an `ArrayHandleStride`. This way, you can get an array that
contains the data of an extracted component with less templating and
potentially dramatically reduce the amount of code generated (although
some runtime integer arithmetic is added).
2020-12-16 17:22:44 -07:00
Kenneth Moreland
f66dc780c5 Update ArrayHandleImplicit to new array style with Buffer
Also updated the dependent `ArrayHandle`s that use
`ArrayHandleImplicit`'s storage.
2020-10-21 08:36:29 -06:00
Kenneth Moreland
b012c42beb Rename CellLocatorUniformBins to CellLocatorTwoLevel
The new name is more descriptive and prevents confusion with
CellLocatorUniformGrid.
2020-09-21 15:42:47 -06:00
Kenneth Moreland
c9b763aca9 Rename PointLocatorUniformGrid to PointLocatorSparseGrid
The new name reflects better what the underlying algorithm does. It also
helps prevent confusion about what types of data the locator is good
for. The old name suggested it only worked for structured grids, which
is not the case.
2020-09-21 15:42:41 -06:00
Kenneth Moreland
63ef84ed78 Optionally remove all use of ArrayHandleVirtual
As we remove more and more virtual methods from VTK-m, I expect several
users will be interested in completely removing them from the build for
several reasons.

1. They may be compiling for hardware that does not support virtual
methods.
2. They may need to compile for CUDA but need shared libraries.
3. It should go a bit faster.

To enable this, a CMake option named `VTKm_NO_DEPRECATED_VIRTUAL` is
added. It defaults to `OFF`. But when it is `ON`, none of the code that
both uses virtuals and is deprecated will be built.

Currently, only `ArrayHandleVirtual` is deprecated, so the rest of the
virtual classes will still be built. As we move forward, more will be
removed until all virtual method functionality is removed.
2020-09-04 22:52:45 -06:00
Kenneth Moreland
e47cedd972 Add UnknownArrayHandle 2020-08-31 09:46:56 -06:00
Kenneth Moreland
56bec1dd7b Replace basic ArrayHandle implementation to use Buffers
This encapsulates a lot of the required memory management into the
Buffer object and related code.

Many now unneeded classes were deleted.
2020-06-25 14:02:26 -06:00
Li-Ta Lo
980c4864ac Merge branch 'master' into standard_normal 2020-06-24 14:38:50 -06:00
dpugmire
02d8c3782d Add unittest for particlearraycopy 2020-06-18 15:45:36 -04:00
Li-Ta Lo
2aea7534bd Add ArrayHandleRandomStandardNormal 2020-06-17 15:48:09 -06:00
Li-Ta Lo
e9f584a91f ArrayHandleRandomUniformReal
Add an ArrayHandle for generating random Float64 in the range of [0, 1).
2020-06-02 11:58:57 -06:00