Commit Graph

6167 Commits

Author SHA1 Message Date
Robert Maynard
fa42c9a55c Correct casting warning in AtomicArrayExecutionObject
Fixes a warning introduced by !2282
2020-10-16 09:39:08 -04:00
Robert Maynard
0c8cd26199 Merge topic 'correct_atomic_load_api'
5fe6c36fa vtkm::AtomicLoad should only occur on non-const values

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2282
2020-10-15 17:50:02 -04:00
Kenneth Moreland
4a1b26d1b1 Change ArrayHandle::ReleaseResourcesExecution to be const
The `ReleaseResourcesExecution` method makes changes by booting data off
of the execution environment. But logically the array does not change.
It remains the same size with the same contents. Thus, it makes sense
for this to be a const method.

Also modified some deprecated methods a bit to remove some unnecessary
templates.
2020-10-15 10:03:38 -06:00
Li-Ta Lo
8c15745c04 Merge branch 'master' into particle_density 2020-10-15 07:41:05 -06:00
Kenneth Moreland
19944653bc Add scope log for functions that help map fields in filters 2020-10-13 16:35:25 -06:00
Kenneth Moreland
c60cae3b87 Add scope logs for building locators 2020-10-13 12:41:25 -06:00
Kenneth Moreland
4dec08c6f0 Add tests for advecting particles in explict cell sets
The `UnitTestParticleAdvectionFilter` was only testing advection in
structured cell sets (with either uniform or rectilinear points). This
did not test all paths (i.e. grid evaluators and locators) of particle
advection. Changed the test to also try grids with explicit cells.

Note that the explicit cells are created by just converting the
rectilinear grids to explicit grids. It would be better to get at least
one small dataset that starts as unstructured.
2020-10-13 09:06:02 -06:00
Robert Maynard
b70f677856 Merge topic 'scope-scatters'
f5c5b6188 Log the computation of ranges in fields and arrays
bef55f8ee Log the conversion of num components to offsets
420b9d397 Log the building of arrays for scatters and masks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2283
2020-10-13 09:02:51 -04:00
Robert Maynard
5c769b1b5f Merge topic 'remove_unused_functions'
22dfb4776 Remove unused functions from TestingDeviceAdapter

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2281
2020-10-13 08:58:57 -04:00
Kenneth Moreland
f5c5b61880 Log the computation of ranges in fields and arrays 2020-10-12 15:51:09 -06:00
Kenneth Moreland
bef55f8ee3 Log the conversion of num components to offsets 2020-10-12 14:02:31 -06:00
Kenneth Moreland
420b9d3979 Log the building of arrays for scatters and masks 2020-10-12 13:19:43 -06:00
Sujin Philip
0d5178dfc5 Merge topic 'kokkos-opt-algo'
c26e193fe Use kokkos provided routines for sort and copy

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2277
2020-10-12 10:28:01 -04:00
Robert Maynard
5fe6c36fa2 vtkm::AtomicLoad should only occur on non-const values
Previously vtk-m allowed users to issue atomic loads on constant
values which is problematic for the following reasons:

 - can be a source of undefined behavior
 - not supported by kokkos

This issue was detected when using kokkos HIP atomic implementation
2020-10-09 14:20:21 -04:00
Robert Maynard
22dfb4776e Remove unused functions from TestingDeviceAdapter 2020-10-09 14:13:45 -04:00
Kenneth Moreland
7933c70ca5 Add dispatcher type when logging worklet invocation
When you invoke a worklet, a scoped performance log is automatically
generated. The previous version gave the name of the worklet, which is
technically everything you need to know. However, it is also convenient
to know what type of worklet it is (e.g. a field map worklet or a
topology map worklet). This can be determined by looking at the
definition of the worklet in the source code, but that is not practical
if, for example, you want to perform automated analysis.

This change prints out the type of the dispatcher instead of the
worklet. The full type of the dispatcher includes the worklet as a
template parameter, so you get both the dispatcher/worklet type and the
worklet itself. So previously you would get log lines like

```
Invoking Worklet: 'vtkm::worklet::vtkm::worklet::ExternalFaces::NumFacesPerCell'
```

They now look like this:

```
Invoking Worklet: 'vtkm::worklet::DispatcherMapTopology<vtkm::worklet::ExternalFaces::NumFacesPerCell>'
```
2020-10-08 16:10:00 -06:00
Li-Ta Lo
ec6b2bc7fb Merge topic 'concurrent_union_find'
268a07bb0 remove test on large graph and sample data

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2278
2020-10-08 15:38:07 -04:00
Li-Ta Lo
268a07bb06 remove test on large graph and sample data 2020-10-08 13:26:46 -06:00
Sujin Philip
c26e193fec Use kokkos provided routines for sort and copy 2020-10-08 13:46:43 -04:00
Vicente Adolfo Bolea Sanchez
a290de5bcc BenchmarkFilters: adds unstructured Dataset for some filters
- It also remove termination on bench error
- It disables passing fields in Countour to skip an error.

Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-10-07 18:46:36 -04:00
Li-Ta Lo
2b0960f279 Merge topic 'concurrent_union_find'
932f8b82f Merge branch 'concurrent_union_find' of gitlab.kitware.com:ollielo/vtk-m into concurrent_union_find
eaff27195 minor changes on comments on findRoot()
9fef540ba minor changes on comments on findRoot()
916661e33 Merge branch 'concurrent_union_find' of gitlab.kitware.com:ollielo/vtk-m into concurrent_union_find
a036b0f98 Minor change based on code review.
9e68022ac Minor change based on code review.
1185f70bc Data Race Resolution
aed7e02da Merge branch 'concurrent_union_find' of gitlab.kitware.com:ollielo/vtk-m into concurrent_union_find
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2248
2020-10-07 17:48:30 -04:00
Li-Ta Lo
eaff271950 minor changes on comments on findRoot() 2020-10-07 15:09:12 -06:00
Li-Ta Lo
a036b0f980 Minor change based on code review. 2020-10-07 14:23:40 -06:00
Li-Ta Lo
c1681d2f2a Merge branch 'master' into particle_density 2020-10-07 12:24:07 -06:00
Li-Ta Lo
1185f70bc9 Data Race Resolution
Finished the comments on data races and their resolution.
2020-10-07 11:56:02 -06:00
Li-Ta Lo
3c7aa34267 Remove duplicate code in ImageConnectivity.h and GraphConnectivity.h 2020-10-06 13:38:59 -06:00
Dave Pugmire
303520ad48 Remove virtuals from vtkm::Particle 2020-10-06 13:25:26 -04:00
Kenneth Moreland
757766431b Merge topic 'variant-is-trivial'
4a7aae86f Allow Variant to be trivial

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2265
2020-10-06 10:43:08 -04:00
Li-Ta Lo
43aa21df40 Merge branch 'master' into concurrent_union_find 2020-10-05 09:28:31 -06:00
Kenneth Moreland
a653fb93ed Merge topic 'rename-2-level-locators'
b012c42be Rename CellLocatorUniformBins to CellLocatorTwoLevel
c9b763aca Rename PointLocatorUniformGrid to PointLocatorSparseGrid

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2264
2020-09-25 18:03:28 -04:00
Robert Maynard
9bd6f3e6da Disable VTKM_ASSERT when using HIP 2020-09-25 11:06:57 -04:00
Robert Maynard
68b5edfcba VTK-m defines VTKM_EXEC / VTKM_EXEC_CONT when compiling with HIP 2020-09-25 11:06:34 -04:00
Robert Maynard
d0c9fb2741 Correct missing VTKM_EXEC_CONT in UnitTestArrayHandleExtrude 2020-09-25 09:37:46 -04:00
Robert Maynard
1365cfa9ec Update ConnectivityExtrude to follow clangs rules on markup 2020-09-25 09:37:46 -04:00
Robert Maynard
09df45bb19 Update vtkm/Geometry.hxx to follow clangs rules on function markup 2020-09-25 09:37:46 -04:00
Robert Maynard
461616a771 Refactor some VTK-m device adapter to be alphabetical 2020-09-24 09:10:03 -04:00
Robert Maynard
2278fdfd94 Deprecation macro has to come before VTKM_EXEC or VTKM_EXEC_CONT
This order is needed by CUDA-clang and HIP-clang compilers
2020-09-23 10:02:37 -04:00
Kenneth Moreland
4a7aae86f9 Allow Variant to be trivial
Although `vtkm::internal::Variant` respected the trivially copyable
attribute of the types it contains, it was never totally trivial (i.e.
`std::is_trivial<Variant<...>>` was never true). The reason was that
`Variant` was initializing its `Index` parameter to signify that it was
not initialized. However, the fact that `Index` was initialized meant
that it was not trivially constructed.

Now, `Variant` type checks its types to see if they are all trivially
constructible. If so, it makes itself trivially constructible.

This means that `Index` may or may not be valid if `Variant` is
constructed without an argument. This in turn means that the result of
`Variant::IsValid` becomes undefined. That should be OK in practice.
`Index` will "point" to an uninitialized object, but that object is
trivially constructed anyway. However, that could cause problems if
developers used `IsValid` to determine if something is selected.
2020-09-22 16:22:37 -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
Gunther H. Weber
ce0aa1cf94 Fix compile errors 2020-09-17 05:42:41 -07:00
Gunther H. Weber
edd71539c9 Fix compile error due to renamed includes 2020-09-17 05:39:14 -07:00
Gunther H. Weber
33a7f5610d Added missing this-> for data members 2020-09-16 12:42:30 -07:00
Gunther H. Weber
b443fb500e Added note for future reference during API refactoring 2020-09-16 12:36:14 -07:00
Gunther H. Weber
b6343c049c Applied Ken Moreland's suggested fix to avoid copy 2020-09-16 12:36:08 -07:00
Gunther H. Weber
8489a69c39 Fixed missing invoker compile error 2020-09-15 12:55:24 -07:00
Gunther H. Weber
991f7a85ad Refactor mesh classes: switch from row/col/slice to vtkm::Id2/Id3 2020-09-15 11:15:27 -07:00
Kenneth Moreland
2e918c58dc Move ColorTable mapping to its own header
We would really like to be able to include `vtkm::cont::ColorTable` in
such a way that you don't have to compile device code (unless you are
actually compiling functions for the device). Thus, the `Map` functions
of `ColorTable` were in a special `ColorTable.hxx` that contains the
"implementation" for `ColorTable`.

That is confusing to many users. It is more clear to simply have `.h`
headers that do a specific thing. To achieve these two goals, the `Map`
functionality of `ColorTable` is separated out into its own header file.
So you don't need to be using a device compiler just to use `ColorTable`
(including `ColorTable.h`), but you do need to use a device compiler if
mapping values to colors (including `ColorTableMap.h`).
2020-09-14 16:40:26 -06:00
Kenneth Moreland
38bdfec40a Move ColorTable::Sample methods to vtkm_cont
There is little value to declare them `inline`. Instead, just have them
compiled once in the `vtkm_cont` library.
2020-09-14 16:40:26 -06:00
Kenneth Moreland
0457427ed7 Merge topic 'color-table-no-virtual'
6a3ba4291 Fix warning about unused function
c6a4f9b79 Fix warning about return value
9465d2611 Adjust TransferFunction worklet to get color table as ExecObj argument
11996f133 Remove virtual methods from ColorTable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2261
2020-09-14 17:56:51 -04:00
Kenneth Moreland
6a3ba4291b Fix warning about unused function 2020-09-14 15:26:43 -06:00
Kenneth Moreland
c6a4f9b79c Fix warning about return value 2020-09-14 15:04:03 -06:00
Kenneth Moreland
9465d26110 Adjust TransferFunction worklet to get color table as ExecObj argument
Previously, the `TransferFunction` worklet required you to call
`PrepareForExecution` on the `ColorTable` and give that to the
constructor. Bad things can happen if the `ColorTable` used in the
constructor does not match the device the worklet actually gets invoked
on. Change this to make the `ColorTable` a worklet argument of type
`ExecObj`. The dispatcher will automatically call
`ColorTable::PrepareForInput` and guarantee that the devices match.
2020-09-14 13:38:25 -06:00
Kenneth Moreland
11996f133f Remove virtual methods from ColorTable
Virtual methods are being deprecated, so remove their use from the
ColorTable classes. Instead of using a virtual method to look up a value
in the ColorTable, we essentially use a switch statement. This change
also simplified the code quite a bit.

The execution object used to use pointers to handle the virtual objects.
That is no longer necessary, so a simple `vtkm::exec::ColorTable` is
returned for execution objects. (Note that this `ColorTable` contains
pointers that are specific for the particular device.) This is a non-
backward compabible change. However, the only place (outside of the
`ColorTable` implementation itself) was a single worklet for converting
scalars to colors (`vtkm::worklet::colorconversion::TransferFunction`).
This is unlikely to affect anyone.

I also "fixed" some names in enum structs. There has been some
inconsistencies in VTK-m on whether items in an enum struct are
capitolized or camel case. We seem to moving toward camel case, so
deprecate some old names.
2020-09-14 13:26:16 -06:00
Ben Boeckel
c0caf4fa95 Merge topic 'warnings-from-vtk'
482266b44 Particle: explicitly make the copy ctor and assignment op
1037aa756 AssignerPartitionedDataSet: mark dtor as override

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2259
2020-09-14 13:16:18 -04:00
Ben Boeckel
482266b442 Particle: explicitly make the copy ctor and assignment op
They are disabled because we have a custom destructor.
2020-09-14 10:47:42 -04:00
Kenneth Moreland
9b62c9eef1 Enable storing variable-sized Vecs in UnknownArrayHandle
One of the features of `UnknownArrayHandle` is that it allows you to
query how many `Vec` components each value has without resolve the type
of the array. The functionality to implement this failed if you tried to
store an `ArrayHandle` that stored `Vec`-like objects with `Vec` sizes
that varied from value to value (i.e. an `ArrayHandleGroupVecVariable`).

Storing such an array in `UnknownArrayHandle` might not be the best
idea, but it should probably work. This change allows you to store such
an array. If you try to query the number of components, you will get 0.
2020-09-14 08:39:27 -06:00
Kenneth Moreland
fbb69b7655 Merge topic 'deprecate-arrayhandlevirtual'
e706880d7 Fix unnecessary deprecation warnings in visual studio
f7cc03107 Fix deprecated warnings
b27e4c7ea Ignore files for deprecated virtual classes for SourceInInstall test
284774cf4 Turn on "no virtual" option on some CI builds
cd08fd499 Add changelog for removing virtual methods
63ef84ed7 Optionally remove all use of ArrayHandleVirtual
e11f612ad Deprecate ArrayHandleVirtual

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2256
2020-09-10 14:32:40 -04:00
Kenneth Moreland
6c383b0a73 Merge topic 'unknown-array-dynamic-transfer'
78c7909c8 Enable automatic transformation of Unknown/UncertainArrayHandle

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2258
2020-09-10 12:41:50 -04:00
Ben Boeckel
1037aa756e AssignerPartitionedDataSet: mark dtor as override 2020-09-10 10:03:18 -04:00
Kenneth Moreland
78c7909c84 Enable automatic transformation of Unknown/UncertainArrayHandle 2020-09-09 07:03:34 -06:00
Kenneth Moreland
e706880d7b Fix unnecessary deprecation warnings in visual studio
When using a deprecated `ArrayHandle`, you should get the warning when
you declare it, not when it's used in a templated class or method.
2020-09-09 06:13:08 -06:00
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
nadavi
843307bcf7 fix floating point casting warning in worklet test 2020-09-08 17:47:53 +00:00
nadavi
18263a37ac update float casting to not have warnings on iris 2020-09-08 17:47:53 +00:00
nadavi
89cf93a66b fix OpenMP PRAGMA warnings for auto-associated looping variable types 2020-09-08 17:47:53 +00: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
Li-Ta Lo
e17345a81f Merge branch 'master' into concurrent_union_find 2020-08-31 14:34:29 -06: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
Li-Ta Lo
945e9cf328 some more comments 2020-08-31 09:23:03 -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
Li-Ta Lo
7533538e17 restore CI config files, minor clean up for UnionFind 2020-08-28 10:48:14 -06:00
Li-Ta Lo
31322cd2e1 use CompareAndSwap for setting root 2020-08-28 10:33:24 -06:00
Li-Ta Lo
4cd320c284 put finding and setting root in a loop 2020-08-28 08:53:56 -06:00
Li-Ta Lo
f91fb35d7f added more data race analysis, change GraphGraft to use AtomicArray 2020-08-28 00:04:50 -06:00
Li-Ta Lo
e5f8219477 try fixing CUDA compiler error 2020-08-27 22:35:27 -06:00
Li-Ta Lo
fc754b329f deduplicate UnionFind 2020-08-27 20:07:32 -06:00
Li-Ta Lo
af53fb736f Add unit test for graph connectivity with data from the ECL_CC paper 2020-08-27 17:37:08 -06: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
Li-Ta Lo
17047f456d more comments on things to do 2020-08-27 11:46:31 -06:00
Li-Ta Lo
727e0cb268 single pass algorithm for both Image and Graph connectivity 2020-08-27 11:22:48 -06:00
Li-Ta Lo
19be36ee7a implemented single pass algorithm for image connectivity 2020-08-27 11:03:45 -06:00
Li-Ta Lo
0902cbbad3 save before change to single pass algorithm 2020-08-27 10:17:02 -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
Li-Ta Lo
69de6afa2a add more comments on data race 2020-08-25 13:30:37 -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
Li-Ta Lo
ea2dad5154 extract Unite 2020-08-22 06:15:11 -06: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
Vicente Adolfo Bolea Sanchez
e3d7347080 IBM XL: disable unused-template pragma for xl
Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-08-21 15:40:05 -04:00
Li-Ta Lo
ac6fe7a295 remove unnecessary joining my friend operation 2020-08-21 07:17:13 -06:00
Li-Ta Lo
45fed319ac add more comments on data race during union 2020-08-21 07:15:43 -06:00
Kenneth Moreland
6cbcb9f5d7 Fix behavior of Cuda AtomicLoad with SequentiallyConsistent
According to Allie Vacanti, a sequentially consistent load requires a
full fence on Cuda hardware to be conforming.

Also improved the documentation of `MemoryOrder` based on Allie's
suggestion.

Also removed the `Consume` memory order based on Allie's suggestion. It
is tricky to use correctly, and most implementations just regress to the
safer `Acquired` behavior anyway.
2020-08-20 17:53:47 -06:00
Kenneth Moreland
7573d4ed57 Fix compiler warnings 2020-08-20 17:08:36 -06:00
Kenneth Moreland
147dd24d01 Remove ARM intrinsics in MSVC 2020-08-20 17:08:36 -06:00
Kenneth Moreland
2229c22f40 Avoid invalid Kokkos atomic calls 2020-08-20 17:08:21 -06:00
Li-Ta Lo
2492d7d1d1 add test case from Valentine, more comments in ImageGraft 2020-08-20 15:08:55 -06:00
Kenneth Moreland
3b147878f5 Always use our implementation of Cuda atomics
Previously, if Kokkos was enabled we always used Kokkos atomics.
However, if a user, for some reason, compiled with a version of Kokkos
that was _not_ compiled for Cuda and we turned on our own Cuda device
adapter, that would cause a problem. The old code assumed Kokkos would
create the Cuda version of the atomics, but it would not. Thus, there
would be no atomics for Cuda.

Resolved this problem by switching the order in which we try to define
atomics. Use our version of atomics whenever compiling for a Cuda
device. Otherwise, try to compile the Kokkos version (and if that is not
available, use ours as before.
2020-08-20 14:20:32 -06:00
Kenneth Moreland
9e6fe8fb66 Add memory order semantics to atomic functions
To ensure correctness of an atomic function, it is often necessary to
force a compiler to order operations correctly. However, doing so may
slow things down, so it is helpful to relax these constraints if they
are not necessary. Add the ability to select the correct memory order
constraints in the atomic functions.
2020-08-20 13:40:44 -06:00
Kenneth Moreland
d2ac4b860c Be more careful in casting with Atomic functions
Previously, the atomic functions accepted any type as its operand and
then cast that to the storage type. That could cause some rather
unexpected behavior. For example, casting a floating point number to an
integer might not give you the behavior as expected. So that behavior as
been removed and now the operand has to match the pointer.

However, all the currently supported atomics are unsigned, and there are
many reasons that it might be easier to use signed as operands. (For
example, C literals are signed.) Thus, a second condition that allows
the sign to be swapped has been added so that you don't get annoying
signed/unsigned conversion warnings.
2020-08-20 13:40:44 -06:00
Kenneth Moreland
13056b3af5 Deprecate AtomicInterfaceControl and AtomicInterfaceExecution
Now that we have the functions in `vtkm/Atomic.h`, we can deprecate (and
eventually remove) the more cumbersome classes `AtomicInterfaceControl`
and `AtomicInterfaceExecution`.

Also reversed the order of the `expected` and `desired` parameters of
`vtkm::AtomicCompareAndSwap`. I think the former order makes more sense
and matches more other implementations (such as `std::atomic` and the
GCC `__atomic` built ins). However, there are still some non-deprecated
classes with similar methods that cannot easily be switched. Thus, it's
better to be inconsistent with most other libraries and consistent with
ourself than to be inconsitent with ourself.
2020-08-20 13:40:44 -06:00
Kenneth Moreland
82d6ca9854 Allow Kokkos atomic functions to work without cuda device compiler
If the Kokkos device is enabled, we use the Kokkos atomic functions for
implementation since Kokkos has already ported all of these to each
device.

If Kokkos is compiled with CUDA, then the functions are marked with
`__device__` and `__host__`. Makes sense right?

Unless we are trying to use the atomic functions on host code compiled
only for the host. In that case, modifiers like `__device__` will cause
compiler errors.

So we want to disable Kokkos from using `__device__`, but only if CUDA
is enabled and we are not using the CUDA compiler. Had to hack things up
to get that to work.
2020-08-20 13:40:44 -06:00
Kenneth Moreland
d3503bfaba Implement AtomicInterfaceControl/Execution with free functions
Now that we have atomic free functions (e.g. `vtkm::AtomicAdd()`), we no
longer need special implementations for control and each execution
device. (Well, technically we do have special implementations for each,
but they are handled with compiler directives in the free functions.)

Convert the old atomic interface classes (`AtomicInterfaceControl` and
`AtomicInterfaceExecution`) to use the new atomic free functions. This
will allow us to test the new atomic functions everywhere that atomics
are used in VTK-m.

Once verified, we can deprecate the old atomic interface classes.
2020-08-20 13:40:44 -06:00
Kenneth Moreland
ebbebd7369 Add atomic free functions
Previously, all atomic functions were stored in classes named
`AtomicInterfaceControl` and `AtomicInterfaceExecution`, which required
you to know at compile time which device was using the methods. That in
turn means that anything using an atomic needed to be templated on the
device it is running on.

That can be a big hassle (and is problematic for some code structure).
Instead, these methods are moved to free functions in the `vtkm`
namespace. These functions operate like those in `Math.h`. Using
compiler directives, an appropriate version of the function is compiled
for the current device the compiler is using.
2020-08-20 13:40:43 -06:00
Li-Ta Lo
83b90f9fce time to test on GPU 2020-08-20 10:49:00 -06:00
Vicente Adolfo Bolea Sanchez
afd394377e cmake: split vtkm_filter into common|extra|contour|gradient
There is a limitation in Windows builds using VS2019 where libraries cannot be
bigger than 4GiB. This is normally not an issue but in `VTKm` due to its strong
template usage libraries can reach that size.

The `VTKm` filter library is can easily reach that size and it will halt the
build

This MR tries to avoid reaching those sizes for now by splitting the filter
library into four smaller libraries.

The proposal scheme is:

It splits vtkm-filter into:

  - vtkm-common, Classes that are dependencies of other filter libs.
  - vtkm-contour, Contour class and its instantiations.
  - vtkm-contour, Gradient class and its instantiations.
  - vtkm-extra, Classes other than Contour or Gradient that are
    not dependencies.

Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-08-19 19:20:43 -04:00
Kenneth Moreland
a709f63e72 Merge topic 'base-device-tests'
ed41874cc Consolidate tests for base vtkm code that is device-specific

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2219
2020-08-18 18:53:04 -04:00
Kenneth Moreland
ed41874cc8 Consolidate tests for base vtkm code that is device-specific
Some of the code in the base `vtkm` namespace is device specific. For
example, the functions in `Math.h` are customized for specific devices.
Thus, we want this code to be specially compiled and run on these
devices.

Previously, we made a header file and then added separate tests to each
device package. That was created before we had ways of running on any
device. Now, it is much easier to compile the test a single time for all
devices and use the `ALL_BACKENDS` feature of `vtkm_unit_tests` CMake
function to automatically create the test for all devices.
2020-08-18 14:30:25 -06:00
dpugmire
d13a08b6ae Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into mpiStreamlines2 2020-08-18 16:06:41 -04:00