Commit Graph

5981 Commits

Author SHA1 Message Date
Kenneth Moreland
f7cc03107d Fix deprecated warnings
Supress the deprecated class warnings for the implementation of
deprecated features.
2020-09-09 06:13:07 -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
e11f612add Deprecate ArrayHandleVirtual
Virtual methods in the execution environment are going away the next
major release of VTK-m, so deprecate their use in preparation for that.
2020-09-04 22:52:45 -06:00
Kenneth Moreland
06579aac8c Merge topic 'replace-variantarrayhandle-impl'
386301719 Test UnknownArrayHandle behavior on special arrays
872da1f8e Suppress unnecessary deprecation warnings on VS
bb443bbc2 Replace the implementation of VariantArrayHandle

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2255
2020-09-05 00:32:16 -04:00
Vicente Adolfo Bolea Sanchez
fb919e048e vtkm::Vec: added unrolled arithmetic operators overload
Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-09-03 16:10:15 -04:00
Kenneth Moreland
3863017190 Test UnknownArrayHandle behavior on special arrays
`UnknownArrayHandle` has special behavior when putting in or getting out
an `ArrayHandleMultiplexer` or an `ArrayHandleCast`. When putting in
either of these, `UnknownArrayHandle` gets the actual array stored in
the multiplexer and cast so that you can later retrieve the base array.
Likewise, when you get the array out with `AsArrayHandle`, you can give
it an `ArrayHandleCast` or `ArrayHandleMultiplexer`, and you will get
the base array placed inside of it.
2020-09-03 09:13:01 -06:00
Kenneth Moreland
872da1f8e6 Suppress unnecessary deprecation warnings on VS
The Visual Studio compiler has an annoying habit where if you use a
templated class or method with a deprecated class as a template
parameter, you will get a deprecation warning where that class is used
in the templated thing. Thus, if you want to suppress the warning, you
have to supress every instance of the template, not just where the
template is declared.

This is annoying behavior that is thankfully not replicated in other
compilers.
2020-09-02 16:48:11 -06:00
Kenneth Moreland
bb443bbc24 Replace the implementation of VariantArrayHandle
The implementation of `VariantArrayHandle` has been changed to be a
relatively trivial subclass of `UnknownArrayHandle`.

The advantage of this change is twofold. First, it removes
`VariantArrayHandle`'s dependence on `ArrayHandleVirtual`, which gets us
much closer to deprecating that class. Second, it ensures that
`UnknownArrayHandle` is a reasonable replacement for
`VariantArrayHandle`, so we can move forward with replacing that.
2020-09-02 15:02:44 -06:00
Kenneth Moreland
66a4a23ebf Fix issue of getting pointer from std::vector of size 0
C++11 introduced the `std::vector::data()` method. In addition to being
more syntatically pleasing, it should correctly handle the condition
when the `std::vector` is size 0 and therefore has no real pointer.
(Expressions like `&v[0]` are undefined when the `vector` is empty.)
2020-09-02 12:04:34 -06:00
Kenneth Moreland
3f8da6e7e1 Fix some debugging code that should not have been there 2020-09-01 14:21:09 -06:00
Kenneth Moreland
52cecefba0 Fix crash when loading poly data with no cells 2020-09-01 14:20:11 -06:00
Kenneth Moreland
5250c28ff2 Swap call pattern of ArrayHandle::DeepCopy
The new method `ArrayHandle::DeepCopy` had the pattern such that the
data in the `this` array was pushed to the provided destination array.
However, this is the opposite pattern used in the equivalent method in
VTK, which takes the data from the provided array and copies it to
`this` array.

So, swap the pattern to match that of VTK. Also, make the method name
more descriptive by renaming it to `DeepCopyFrom`. Hopefully, users will
read that to mean given the `ArrayHandle`, you copy data from the other
provided `ArrayHandle`.
2020-09-01 10:08:06 -06:00
Ben Boeckel
aa6eb01dfe ComputeMoments: use FilterField instead of FilterCell 2020-08-31 16:51:12 -04:00
Kenneth Moreland
c79daa5c2f Suggested changes to comments 2020-08-31 09:51:53 -06:00
Kenneth Moreland
fca25fa3c7 Enable serialization of UnknownArrayHandle and UncertainArrayHandle
Because UnknownArrayHandle is not typed, we can compile into vtkm_cont
the ability to serialize many types.
2020-08-31 09:46:57 -06:00
Kenneth Moreland
94aa6449b9 Add UncertainArrayHandle 2020-08-31 09:46:57 -06:00
Kenneth Moreland
e47cedd972 Add UnknownArrayHandle 2020-08-31 09:46:56 -06:00
Ben Boeckel
ede0c179b7 Merge topic 'vtkmdiy-install-destination'
f4df3fe00 vtkmdiy: forward the bin install directory to diy
a4b4b1a2c Merge branch 'upstream-diy' into HEAD
db483b3e2 diy 2020-08-26 (c9efaac9)
acde82a36 diy: update for install destination fix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2244
2020-08-28 14:29:11 -04:00
Kenneth Moreland
2877aab21a Fix problem with ArrayCopy of two of the same arrays
A recent modification to `ArrayCopy` created a fast path for when
copying arrays of the same type. This fast path just deep copies the
buffers. The issue was that the buffer copy was creating new buffers
instead of updating the existing buffers. The passed in `ArrayHandle`
would get updated to the new buffers, but any other `ArrayHandle`s
sharing those buffers would still have the old versions. That would lead
to unexpected errors in code like this.

```cpp
vtkm::cont::ArrayHandle<T> outArray1;
vtkm::cont::ArrayHandle<T> outArray2 = outArray1;

vtkm::cont::ArrayCopy(inArray, outArray2);
```

If `inArray` was a different type than `outArray2`, then the data for
both `outArray1` and `outArray2` would be updated (which is the expected
behavior for something considered a "pointer"). However, if `inArray`
was the same type as `outArray2`, then the fast path would change
`outArray2` but leave `outArray1` the same.

This behavior has been corrected so that, in this case, the data of
`outArray1` always follows that of `outArray2`.
2020-08-27 17:28:54 -06:00
Kenneth Moreland
d938226cd3 Fix tests that relied on stable sort
The parallel sorts in the device adapter are documented to not be
stable. Up until recently, the sorts for all the supported devices
happened to be stable (or at least provided a stable sort where needed).
However, the recent Kokkos adapter provides a sort that is no stable.
This broke some tests that relied on stable sorts when they should not
have.

Fix the tests that relied on stable sort to check the results.
2020-08-27 14:50:51 -06:00
Kenneth Moreland
80cf0b3658 Fix more signed/unsigned vtkm::Id/std::size_t warnings in kokkos adapter 2020-08-27 07:59:03 -06:00
Robert Maynard
faa845d56e Merge topic 'reenable_tests_mistakenly_disabled'
769d6468f Correct a mistake where the kokkos MR merged disabled worklet tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2243
2020-08-27 07:56:37 -04:00
Kenneth Moreland
d9b8a620a1 Merge topic 'array-copy-overloads'
3143c7105 Add tests for Buffer::DeepCopy
8298d33f5 Fix issues with ArrayCopy

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2241
2020-08-26 16:06:11 -04:00
Kenneth Moreland
ef236dc1e5 Merge topic 'stateless-storage'
0cc0f3f96 Make Storage class completely stateless

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2238
2020-08-26 15:58:31 -04:00
Dave Pugmire
ca57b05264 Merge topic 'renameParticleTypes'
d64deb00f rename vtkm::Massless to Particle
596ec20e9 Change particle type in examples
855e973a2 Rename the Particle classes.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2239
2020-08-26 15:16:58 -04:00
Kenneth Moreland
3143c71058 Add tests for Buffer::DeepCopy
Tests for regression of deadlock found with copying an empty `Buffer` as
well as testing other `DeepCopy` behavior.
2020-08-26 12:45:19 -06:00
Ben Boeckel
f4df3fe007 vtkmdiy: forward the bin install directory to diy 2020-08-26 14:18:33 -04:00
Ben Boeckel
a4b4b1a2c9 Merge branch 'upstream-diy' into HEAD
# By Diy Upstream
* upstream-diy:
  diy 2020-08-26 (c9efaac9)
2020-08-26 14:18:31 -04:00
Ben Boeckel
acde82a366 diy: update for install destination fix 2020-08-26 14:17:59 -04:00
Robert Maynard
769d6468fd Correct a mistake where the kokkos MR merged disabled worklet tests 2020-08-26 13:19:49 -04:00
Robert Maynard
9aa3b9df01 DeviceAdapterAlgorithmKokkos correct signed/unsigned warnings 2020-08-26 13:10:23 -04:00
Kenneth Moreland
8298d33f52 Fix issues with ArrayCopy
C++ was not resolving the overloads of `ArrayCopyImpl` as expected,
which was causing  `ArrayCopy` to sometimes use a less efficient method
for copying.

Also fix an issue with `Buffer::DeepCopy` that caused a deadlock when
copying a buffer that was not actually allocated anywhere (as well as
failing to copy the metadata, which was probably the whole point).
2020-08-26 08:03:47 -06:00
Dave Pugmire
855e973a20 Rename the Particle classes. 2020-08-26 08:59:51 -04:00
Kenneth Moreland
0cc0f3f961 Make Storage class completely stateless
The old style `ArrayHandle` stored most of its state, including the
data, in the `vtkm::cont::internal::Storage` object (templated to the
type of array). The new style of `ArrayHandle` stores the data itself in
`Buffer` objects, and recent changes to `Buffer` allow metadata to be
stored there, too.

These changes make it pretty unnecessary to hold any state at all in the
`Storage` object. This is good since the sharing of state from one type
of `ArrayHandle` to another (such as by transforming the data), can be
done by just sharing the `Buffer` objects.

To reinforce this behavior, the `Storage` object has been changed to
make it completely stateless. All the methods of `Storage` must be
marked as `static`.
2020-08-25 20:00:54 -06:00
Kenneth Moreland
b526c4c914 Make VTKM_ARRAY_HANDLE_NEW_STYLE macro
While in the transition between two types of `ArrayHandle`
implementations, we need to declare when an `ArrayHandle` is implemented
with the new style. To consolidate, create a
`VTKM_ARRAY_HANDLE_NEW_STYLE` to override the default `ArrayHandle`
implementation with the `ArrayHandleNewStyle` implementation.
2020-08-25 13:02:19 -06:00
Dave Pugmire
2351e4775d Add particle messenger test. 2020-08-25 11:49:59 -04:00
Dave Pugmire
c9041ec41a Add unit test for particle messenger. 2020-08-25 11:39:14 -04:00
Dave Pugmire
63b31ffb24 Replace MemStream with the diy serialization code. 2020-08-25 11:38:01 -04:00
Kenneth Moreland
cdc41cc987 Merge topic 'vtk-test-files-in-repo'
a8fa14335 Move UnitTestVTKDataSetReader files to git-lfs
571aa9f3d Simplify getting test file names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2234
2020-08-25 11:27:07 -04:00
Kenneth Moreland
b5ed6e7257 Fix some conversion warnings
Fixes some compiler warnings that were missed on recent dashboards.
2020-08-25 08:30:44 -06:00
Kenneth Moreland
a8fa143351 Move UnitTestVTKDataSetReader files to git-lfs
The `UnitTestVTKDataSetReader` test reads in .vtk files of multiple
formats. The origins of this test predate the use of git-lfs and a data
directory, so the test defined in the source code several strings
containing the contents of the files.

That is no longer necessary. This change removes those strings from the
file and creates actual files in the data directory. This is easier to
manage as well as more convenient if you want to use the same data in a
different test or just take a look at the data in a different program
(such as VisIt or ParaView).
2020-08-25 07:23:13 -06:00
Kenneth Moreland
571aa9f3d7 Simplify getting test file names
The testing helper class provided a method named `GetTestDataBasePath`
that returned the base path to all the data files stored in the VTK-m
repo. This is fine, but it was a little cumbersome to build filenames.

To make things easier, there is now a new method named `DataPath` that
takes a string of the filename (or, rather, subpath) to the file in that
directory and automatically builds the path to it.
2020-08-25 06:17:59 -06:00
Kenneth Moreland
17b81f54a2 Merge topic 'arrayhandlebitfield-use-buffer'
4345fe26b Store the number of bits of a BitField in the Buffer's metadata
da0403be7 Add metadata to Buffer object.
a84891cd3 Update ArrayHandleBitField to new array style with Buffer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2218
2020-08-25 07:53:37 -04:00
Kenneth Moreland
4345fe26b0 Store the number of bits of a BitField in the Buffer's metadata
The number of bits in a `BitField` cannot be directly implied from the
size of the buffer (because the buffer gets padded to the nearest sized
word). Thus, the `BitField stored the number of bits in its own
internals.

Unfortunately, that caused issues when passing the `BitField` data
between it and an `ArrayHandleBitField`. If the `ArrayHandleBitField`
resized itself, the `BitField` would not see the new size because it
ignored the new buffer size.

To get around this problem, `BitField` now declares its own
`BufferMetaData` that stores the number of bits. Now, since the number
of bits is stored in the `Buffer` object, it is sufficient to just share
the `Buffer` to synchronize all of the state.
2020-08-24 17:09:30 -06:00
Kenneth Moreland
9941db6df5 Convert ArrayHandleSOA to use Buffer
Make `ArrayHandleSOA` use the new `ArrayHandle` style that uses `Buffer`
objects to manage and transfer data.
2020-08-24 16:03:17 -06:00
Kenneth Moreland
da0403be76 Add metadata to Buffer object.
One of the goals of the `Buffer` object is to allow sharing of data
among objects that will interpret the data differently or give a
different interface over the data. However, when sharing only the array,
important metadata can become lost.

Provide a field that can store some custom metadata in the buffer object
so that the rest of the state can follow the buffer object around.
2020-08-24 15:57:15 -06:00
Kenneth Moreland
a84891cd32 Update ArrayHandleBitField to new array style with Buffer 2020-08-24 15:57:13 -06:00
Kitware Robot
cf0cdcf7d1 clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Robert Maynard
b48c19f251 Correct warnings found by using clang as the host compiler for cuda 2020-08-24 08:57:38 -04:00
Kenneth Moreland
0370029f92 Merge topic 'free-atomic-functions'
6cbcb9f5d Fix behavior of Cuda AtomicLoad with SequentiallyConsistent
7573d4ed5 Fix compiler warnings
147dd24d0 Remove ARM intrinsics in MSVC
2229c22f4 Avoid invalid Kokkos atomic calls
3b147878f Always use our implementation of Cuda atomics
9e6fe8fb6 Add memory order semantics to atomic functions
d2ac4b860 Be more careful in casting with Atomic functions
13056b3af Deprecate AtomicInterfaceControl and AtomicInterfaceExecution
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2223
2020-08-22 00:21:01 -04:00