Commit Graph

2726 Commits

Author SHA1 Message Date
Kenneth Moreland
cecd81d5db Add types appropriate for Ascent 2021-01-07 08:15:17 -07:00
Kenneth Moreland
50ff9c22aa Add support of ArrayHandleSOA as a default storage type 2021-01-06 13:20:58 -07:00
Kenneth Moreland
bc09a9cd15 Add precompiled versions of ArrayRangeCompute for ArrayHandleSOA 2021-01-06 13:20:58 -07:00
Kenneth Moreland
77f9ae653d Support ArrayHandleSOA only for Vec value types
Previously, `ArrayHandleSOA` worked with any value type that supported
`VecTraits`. That means that `ArrayHandleSOA` worked with scalar types
like `Float32`. However, for scalar types, the behavior is essentially
the same as `ArrayHandleBasic`, but with lots of extra templating and
code generation.

Although there is nothing _wrong_ with allowing `ArrayHandleSOA` holding
a scalar, there is no real reason to either (other than likely template
convenience). Generally, there is nothing wrong with supporting it, but
if you want to support `ArrayHandleSOA` in places where types are not
known (e.g. `Field`), then templating tends to iterate over the cross of
all supported types with all supported storage. That means such code
will automatically generate a bunch of code for `ArrayHandleSOA` with
scalars even if there is no reason for those code paths.

So, we can just disable the use of `ArrayHandleSOA` with scalars to
allow us to use `ArrayHandleSOA` as a default storage without creating
all these useless code paths.
2021-01-06 13:20:58 -07:00
Kenneth Moreland
9833f3d0da Fix issue with using recombined vec as an output array
`ArrayHandleRecombineVec` is used when calling
`ExtractArrayFromComponents` from `UnkownArrayHandle`. It needs special
handling with the `Fetch` for an output array.
2021-01-04 14:21:32 -07:00
Kenneth Moreland
7dd9b4252a Add UnknownArrayHandle::ExtractArrayFromComponents
This method allows you to extract an `ArrayHandle` from
`UnknownArrayHandle` when you only know the base component type.

Also removed the `Read/WritePortalForBaseComponentType` method
from `UnknownArrayHandle`. This functionality is subsumed by
`ExtractArrayFromComponents`.
2021-01-04 14:17:24 -07: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
5610d674d8 Print TestEqualResult messages in VTK_TEST_ASSERT
Some of the `test_equal` functions return a `TestEqualResult`
instead of a `bool` to capture more information about what
the error was. Unfortunately, using this was awkward because
you couldn't just call the `test_equal_*` inside of a
`VTKM_TEST_ASSERT`. Rather, you would have to do the comparison
and then check it.

This change adds an overload to `VTKM_TEST_ASSERT` that specifically
takes a `TestEqualResult`, checks its condition, and prints out
the contained messages. Thus, your command can just look like
`VTKM_TEST_ASSERT(test_equal_ArrayHandles(...));` and it will
provide the additional information.
2020-12-22 17:17:10 -07:00
Kenneth Moreland
84bfcc238c Move test_equal_* classes to top namespace
These helper functions were in vtkm::cont::testing, but that made them
hard to discover (and I personally kept forgetting about them). Move
them to the top namespace so that IDE of test_equal will helpfully
remind us of these other test functions.
2020-12-22 13:46:02 -07:00
Kenneth Moreland
16471fcaff Fix ArrayHandleView compile error caused by merge error
Recent merge requests !2354 and !2356 both edited ArrayHandleView. Git
successfully merged the changes, but the changes were still incompatible
with each other, causing an unexpected compile error on master. This
fixes the issue.
2020-12-22 07:47:33 -07:00
Kenneth Moreland
39715c92da Merge topic 'arrayhandleview-use-buffer'
1ed8b1f68 Convert ArrayHandleView to new buffer-style array

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2356
2020-12-22 09:32:16 -05:00
Kenneth Moreland
e56c6af41c Merge topic 'array-handle-stride'
7935716f8 Fix warning in VecFlat
8dfd01942 Add changelog for extract component
03c3f9e17 Update `MapField` helper functions to use extracted array components
67507185c Add ability to extract components in `UnknownArrayHandle`
0f24f82da Disable resizing of `ArrayHandleStride`
760553725 Add ArrayExtractComponent function
0ab3edd87 Add VecFlat class
73af6e679 Add ArrayHandleStride

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2354
2020-12-22 09:27:32 -05:00
Kenneth Moreland
1ed8b1f688 Convert ArrayHandleView to new buffer-style array 2020-12-21 07:51:42 -07:00
Kenneth Moreland
3eeeb1cb08 Merge topic 'arrayhandlegroupvecvariable-use-buffer'
802d78828 Convert ArrayHandleGroupVecVariable to new buffer-style arrays

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2357
2020-12-18 16:06:35 -05:00
Kenneth Moreland
a5d57e7440 Convert ArrayHandleConcatenate to new buffer-style arrays 2020-12-17 14:58:09 -07:00
Kenneth Moreland
802d788289 Convert ArrayHandleGroupVecVariable to new buffer-style arrays 2020-12-17 14:06:56 -07:00
Kenneth Moreland
599c2f6391 Convert ArrayHandlePermutation to new buffer-style array 2020-12-17 09:00:03 -07:00
Kenneth Moreland
03c3f9e178 Update MapField helper functions to use extracted array components
Previously, the `MapFieldMergeAverage` and `MapFieldPermutation` helper
function had to iterate over every possible type and create a separate
code path. This change uses the new extract component functionality to
create separate code paths only for different component types. This both
requires less code (the common filter library dropped from 66MB to 42MB
on my Mac) and covers more cases (such as `Vec`s larger than 4
components).

To make the implementation easier, `UnknownArrayHandle` now can create a
new `UnknownArrayHandle` of the same `ValueType` but with the basic
storage (so you can work with read-only storage) and the ability to
allocate the unknown array.
2020-12-16 17:23:35 -07:00
Kenneth Moreland
67507185ce Add ability to extract components in UnknownArrayHandle
This allows you to handle just about every type of array with about 10
basic types. It allows you to ignore both the size of `Vec`s and the
actual storage of the data.
2020-12-16 17:23:27 -07:00
Kenneth Moreland
0f24f82dad Disable resizing of ArrayHandleStride
The typical use case of `ArrayHandleStride` is to flexibly point into
another array, often looking at a single component in an array. It is
typical that multiple things will be accessing the same array, and bad
things could happen as they all try to resize. There was some code to
try to figure out what the size of the original array was, but it was
fragile.

It is safer for now to disable the behavior altogether. If a use case
pops up, we can reintroduce the code.
2020-12-16 17:22:44 -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
73af6e6795 Add ArrayHandleStride 2020-12-16 17:22:44 -07:00
Robert Maynard
004f320e20 Merge topic 'expand_kokkos_device_to_support_hip'
7475c318b VTK-m now uses CMake's future HIP lang for Kokkos+HIP

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2351
2020-12-16 08:58:17 -05:00
Kenneth Moreland
fd07c241e2 Merge topic 'release-read-only'
7811cc4b1 Add standard support for read-only storage
a6b9d5c49 Add tests for ReleaseResources of fancy arrays

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2345
2020-12-14 10:03:20 -05:00
Robert Maynard
7475c318be VTK-m now uses CMake's future HIP lang for Kokkos+HIP 2020-12-11 09:13:12 -05:00
Kenneth Moreland
1323dfeca6 Merge topic 'arrayhandlemultiplexer-use-buffer'
a61d07a6d Convert ArrayHandleMultiplexer to new buffer-style array

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2346
2020-12-10 16:58:33 -05:00
Kenneth Moreland
7811cc4b1e Add standard support for read-only storage
Many of the fancy `ArrayHandle`s are read-only and therefore connot
really create write portals. Likewise, many `ArrayHandle`s (both read-
only and read/write) have no way to resize themselves. In this case,
implementing the `CreateWritePortal` and `ResizeBuffers` methods in the
`Storage` class was troublesome. Mostly they just threw an exception,
but they also sometimes had to deal with cases where the behavior was
allowed.

To simplify code for developers, this introduces a pair of macros:
`VTKM_STORAGE_NO_RESIZE` and `VTKM_STORAGE_NO_WRITE_PORTAL`. These can
be declared in a `Storage` implementation when the storage has no viable
way to resize itself and create a write portal, respectively.

Having boilerplate code for these methods also helps work around
expected behavior for `ResizeBuffers`. `ResizeBuffers` should silently
work when resizing to the same size. Also `ResizeBuffers` should behave
well when resizing to 0 as that is what `ReleaseResources` does.
2020-12-10 13:39:28 -07:00
Kenneth Moreland
a6b9d5c497 Add tests for ReleaseResources of fancy arrays
The `ReleaseResources` method should work for all arrays (even if it
effectively does not do anything). However, the implementation of
`ReleaseResources` is generally to call `Allocate` with 0. Several fancy
arrays balk at this because it is resizing a read-only array. There
should be an exception for this.
2020-12-10 12:33:32 -07:00
Kenneth Moreland
90050b96e4 Remove ArrayManagerExecution
This class was used indirectly by the old `ArrayHandle`, through
`ArrayHandleTransfer`, to move data to and from a device. This
functionality has been replaced in the new `ArrayHandle`s through the
`Buffer` class (which can be compiled into libraries rather than make
every translation unit compile their own template).

This commit removes `ArrayManagerExecution` and all the implementations
that the device adapters were required to make. None of this code was in
any use anymore.
2020-12-08 13:18:44 -07:00
Kenneth Moreland
1968590232 Delete the default implementation of ArrayTransfer
`ArrayTransfer` is used with the old `ArrayHandle` style to move data
between host and device. The new version of `ArrayHandle` does not use
`ArrayTransfer` at all because this functionality is wrapped in `Buffer`
(where it can exist in a precompiled library).

Once all the old `ArrayHandle` classes are gone, this class will be
removed completely. Although all the remaining `ArrayHandle` classes
provide their own versions of `ArrayTransfer`, they still need the
prototype to be defined to specialize. Thus, the guts of the default
`ArrayTransfer` are removed and replaced with a compile error if you try
to compile it.
2020-12-08 12:56:16 -07:00
Kenneth Moreland
a61d07a6d0 Convert ArrayHandleMultiplexer to new buffer-style array 2020-12-08 12:18:19 -07:00
Kenneth Moreland
df1dd51f8c Convert ArrayHandleZip to new buffer-style array 2020-12-07 08:52:38 -07:00
Kenneth Moreland
9a2dd4a089 Merge topic 'arrayhandletransform-use-buffer'
78aa463da Fix compile error when template parameter shadows superclass
905b5a02b Call PrepareForControl to get transform for undefined device
650e416cc Convert ArrayHandleTransform to new buffer-style-array
76880dd8c Enable ExecutionObjectBase::PrepareForExecution for DeviceAdapterId
b0146b1e4 Fix issue with CreateBuffers function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2341
2020-12-03 19:17:40 -05:00
Kenneth Moreland
78aa463da6 Fix compile error when template parameter shadows superclass
I'm too lazy to look up the C++ spec, but it seems like template
parameter names would shadow the same names from a superclass.
Apparently that is not the case for Visual Studio. The `Storage` for the
cast array inherits from the `Storage` of the transform array. The
latter declares a private type named `SourceStorage`, and that is being
used instead of the former's `SourceStorage` template parameter. You
then get an error for accessing a private member that you did not want
in the first place.

Fix the problem by changing the name of the template parameter.
2020-12-03 09:49:21 -07:00
Sujin Philip
2d920535af Merge topic 'kokkos_opt-reduce'
7f61058b8 Use kokkos reduce functionality

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2340
2020-12-03 10:24:31 -05:00
Sujin Philip
7f61058b8a Use kokkos reduce functionality 2020-12-02 17:53:11 -05:00
Kenneth Moreland
905b5a02be Call PrepareForControl to get transform for undefined device
A relatively new convention is to use `DeviceAdapterTagUndefined` when
referring to the host. When getting the transform functor for the
control, detect when the device is undefined and call
`PrepareForControl` instead of `PrepareForExecution` with the undefined
device.
2020-12-02 15:05:23 -07:00
Kenneth Moreland
650e416cca Convert ArrayHandleTransform to new buffer-style-array 2020-12-02 12:14:06 -07:00
Kenneth Moreland
76880dd8c2 Enable ExecutionObjectBase::PrepareForExecution for DeviceAdapterId
Previously, the implementation of `ExecutionObjectBase` required you to
call `PrepareForExecution` with a specific `DeviceAdapterTag`. If you
passed in a `DeviceAdapterId`, which is the superclass of all device
adapter tags, you would get a compile error.

As we move to the new `ArrayHandle` style, it is more common to handle a
straight `DeviceAdapterId` without templating. Perhaps there will be a
time when the templated version is removed.
2020-12-02 12:14:06 -07:00
Kenneth Moreland
b0146b1e48 Fix issue with CreateBuffers function
A C++ quirk requires one of the forms of `CreateBuffersImpl` to be pre-
declared in a prototype to resolve a circular dependency.
2020-12-02 12:14:06 -07:00
Kenneth Moreland
ea3f101953 Merge topic 'bridge-old-and-new-style-arrayhandle'
1fb4c0499 Rename ArrayHandle::FakeBuffer to BufferAsStorageWrapper
05fea4d17 Bridge old-style ArrayHandle to new-style
62c509520 Save host portal for ArrayHandleVirtual in array instead of portal
bc3a7d8e2 Restore composite of transform in UnitTestParticleDensity.cxx

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2339
2020-12-02 14:12:41 -05:00
Kenneth Moreland
1fb4c0499e Rename ArrayHandle::FakeBuffer to BufferAsStorageWrapper
It's not fake so much as only containing metadata referencing to self.
Using the `Buffer` to shallow copy to a new `ArrayHandle` works fine.
2020-12-02 10:22:33 -07:00
nadavi
b883b2d92b support adding images to the gitlab ci archive for regression tests 2020-12-02 16:24:08 +00:00
Kenneth Moreland
05fea4d170 Bridge old-style ArrayHandle to new-style
The new-style `ArrayHandle` uses `Buffer` objects to manage data. Thus,
when one is decorating the other, it expects to find the `Buffer`
objects, which the old-style `ArrayHandle`s do not have. To make the two
work together, fake buffers in the old-style arrays.

The buffers in old-style arrays are empty, but have metadata that points
back to the `ArrayHandle.
2020-12-01 16:24:49 -07:00
Kenneth Moreland
62c5095209 Save host portal for ArrayHandleVirtual in array instead of portal
Previously, when you got a host/control portal from
`ArrayHandleVirtual`, you got a version of an `ArrayPortal` that manged
its own reference to the virtual structure that was implementing the
portal. This was not done for device/execution portals because those
objects could not do the appropriate resource management from the
execution environment.

Rather than releasing the host object to the portal, keep the host
object managed by `StorageVirtual`. This allows the control and
execution portals to be the same type, which we will need to be friendly
with new array objects.
2020-11-30 16:40:28 -07:00
Sujin Philip
755b136354 Merge topic 'kokkos-use-explicit-syncs'
89e19ce7f Don't require CUDA_LAUNCH_BLOCKING

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2333
2020-11-30 14:28:20 -05:00
Sujin Philip
89e19ce7fa Don't require CUDA_LAUNCH_BLOCKING
1. The code now works without CUDA_LAUNCH_BLOCKING set by using explicit
   synchronizations where required.
2. The code has also been modified to use thread specific memory spaces,
   which for Kokkos' Cuda backend means per thread streams.
2020-11-30 13:12:39 -05:00
Kenneth Moreland
a77a1f7f48 Merge topic 'arrayhandlecompositevec-use-buffer'
fb130d42d Remove test for ArrayHandleCompositeVector with bad lengths
7cbf40d5b Back out of using a composite of transform arrays
7ff1a690d Support ArrayHandleCompositeVector with 1 component
5391e353a Convert ArrayHandleExtractComponent to new buffer-style array
22fac15b3 Convert ArrayHandleCompositeVector to new buffer-style array

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2330
2020-11-28 13:37:27 -05:00
Kenneth Moreland
553f97650c Merge topic 'swizzle-uses-transform'
35ca89531 Simplify ArrayHandleSwizzle

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2334
2020-11-28 13:33:40 -05:00
Nick Thompson
2addc19eac Merge topic 'less_verbose_logging'
5d4c3f0c6 Less verbose logging.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2329
2020-11-25 13:54:23 -05:00
Kenneth Moreland
35ca89531c Simplify ArrayHandleSwizzle
As we update the `ArrayHandle`s to the new buffer style, simplify
`ArrayHandleSwizzle` by implementing it on top of
`ArrayHandleTransform`. Also, introduce some C++11 template concepts to
handle variable arguments better.

In this conversion, some features have been removed. Previously if the
swizzle dropped some components, you were still allowed to write to the
array. This would be an in place write that would only update the passed
components. This feature has been removed and if any components are
dropped, the array becomes read only. If all components are swizzled,
then the array becomes writable (through templating).

Another lost feature is that the swizzle map is no longer checked for
correctness. The array handle just assumes that the indices are correct.

It should be noted that it does not look like `ArrayHandleSwizzle` is
actually used anywhere. If it is not used by any customers, we may
want to consider deprecating the class.
2020-11-25 09:28:49 -07:00
Kenneth Moreland
fb130d42de Remove test for ArrayHandleCompositeVector with bad lengths
The old version of `ArrayHandleCompositeVector` would check (at
construction) to make sure that all the arrays had the same length. This
check has been removed because (1) it did not always catch all problems
(such as if the input arrays change), (2) debug builds check for out-of-
range array accesses anyway, and (3) it required a lot of extra template
expansion.

Because that check has been removed, also remove the part of the
`ArrayHandleCompositeVector` test that checks this check.
2020-11-23 17:41:07 -07:00
Kenneth Moreland
7ff1a690de Support ArrayHandleCompositeVector with 1 component
When `ArrayHandleCompositeVector` has only 1 component, it is supposed
to have a special template that uses the base value type rather than a
`Vec` of that type. However, the `Storage` with the value type was
missing. I'm not sure how we weren't getting compile errors before, but
moving to the new buffer arrays seems to bring about the expected error.
2020-11-23 17:17:31 -07:00
Kenneth Moreland
5391e353a0 Convert ArrayHandleExtractComponent to new buffer-style array 2020-11-23 15:45:31 -07:00
Kenneth Moreland
22fac15b32 Convert ArrayHandleCompositeVector to new buffer-style array 2020-11-23 14:56:17 -07:00
Kenneth Moreland
b7a09f5ecb Re-introduced deprecated StorageImplicit.h
The `StorageImplicit.h` header is no longer used. However, just removing
it causes compiles to fail if they include it. To make the transition
better, re-add this file, but cause a deprecation warning if it is
included.
2020-11-23 08:12:09 -07:00
Kenneth Moreland
51c954c857 Merge topic 'arrayhandledecorator-use-buffer'
f80071894 Convert ArrayHandleDecorator to new buffer-style arrays

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2324
2020-11-20 16:20:11 -05:00
Nick Thompson
5d4c3f0c61 Less verbose logging. 2020-11-20 15:12:23 -05:00
Kenneth Moreland
f800718947 Convert ArrayHandleDecorator to new buffer-style arrays
It should be noted that a break in backward compatibility is introduced.
The implementation class passed to `ArrayHandleDecorator` changed the
specification of `AllocateSourceArrays`. Thus, decorators that were
previously allocatable now no longer will be until that method is
updated to the new form.
2020-11-19 12:29:16 -07:00
Robert Maynard
1c7fbc70c3 Merge topic 'remove_filter_hxx_usages'
7eaedfe84 Reduce compiler memory usage by removing auto hxx inclusion

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !2313
2020-11-19 10:59:43 -05:00
Robert Maynard
7eaedfe84b Reduce compiler memory usage by removing auto hxx inclusion
A large portion of the VTK-m filters are now compiled into the
vtkm_filter library. These pre-built filters now don't include
the respective hxx file to remove the amount of template
instantiation users do.

To verify that this removal reduces compiler memory ( and maybe time)
I profiled the compiler while it building filter tests in debug mode.
Here is a selection of results:

```
CleanGrid           10.25s => 9.01s,  901MB => 795MB
ExternalFaces       13.40s => 5.96s, 1122MB => 744MB
ExtractStructured    4.69s => 4.75s,  492MB => 492MB
GradientExplicit    22.97s => 5.88s, 1296MB => 740MB
```
2020-11-19 09:59:25 -05:00
Kenneth Moreland
5e3ae70a6b Merge topic 'arrayhandlegroupvec-use-buffer'
41784b31f Allow ArrayHandleGroupVec with odd component array size
d472e05ea Convert ArrayHandleGroupVec to new buffer-style array

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2317
2020-11-18 17:36:46 -05:00
Nick Thompson
0ac1b816c8 Merge topic 'less_verbose_tests_2'
275abf2f2 Revert change the removes printing of seed.
3b2c10339 Less verbose unit tests.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2321
2020-11-18 15:12:32 -05:00
Kenneth Moreland
41784b31ff Allow ArrayHandleGroupVec with odd component array size
The array given to `ArrayHandleGroupVec` should really have a number of
values that divides evenly among the `Vec`s. Previously, if this was not
the case, an error exception was thrown. These changes allow this
condition. Extra components are dropped and a warning is logged.
2020-11-18 11:15:50 -07:00
Kenneth Moreland
8d3f376646 CreateBuffers improvements suggested by Rob Maynard 2020-11-18 08:25:53 -07:00
Nick Thompson
3b2c103397 Less verbose unit tests. 2020-11-18 08:35:37 -05:00
Kenneth Moreland
c072e4ed29 Add a CreateBuffers helper function
Most `ArrayHandle` implementations must create an
`std::vector<vtkm::cont::internal::Buffer>` object. It is most helpful
to create it in the constructor when initializing the superclass (so the
superclass does not have to create it's own). Added a `CreateBuffers`
convenience function to make it easy to build these vectors.
2020-11-17 16:20:15 -07:00
Kenneth Moreland
d472e05eae Convert ArrayHandleGroupVec to new buffer-style array 2020-11-17 12:36:05 -07:00
Kenneth Moreland
e9410f27cb Add constexpr to GetNumberOfBuffers
This should always be a constant value.
2020-11-17 12:25:11 -07:00
Kenneth Moreland
07d6c06c73 Convert ArrayHandleCartesianProduct to new buffer-style array 2020-11-17 12:17:28 -07:00
Nick Thompson
64ff684218 Use TypeToString to demangle symbol in UnknownArrayHandle. 2020-11-16 14:58:52 -05:00
Kenneth Moreland
d82fc92a10 Fix for serializable type names that change base C types
MR !2311 fixed an issue where some base C types were not recognized by
`SerializableTypeString`. However, the fix was such that different types
with the same layout had the same string. For example `char` and
`signed char` both were given the string `I8`. That meant that the
serialization/deseralization would work, but the deserialization could
change the type. That could cause problems if two arrays were expected
to have the same type but did not.

This change undoes much of MR !2311 and redoes it so that the types are
correct.
2020-11-12 16:59:56 -07:00
Kenneth Moreland
88eed2bbeb Make sure all C scalar types are in TypeListScalarAll
C++ template considers some types different even though they have the
exact same format. For example `int`, `long`, and `long long` all match
different types even though they all represent either signed 32-bit ints
or signed 64-bit ints.

List all these possible types in
`TypeListScalarAll`.
2020-11-12 16:18:56 -07:00
Kenneth Moreland
ec4a434dcf Include all int types in SerializableTypeString
Previously, `SerializableTypeString` was specialized only for the VTK-m
defined int types (`Int8`, `UInt8`, `Int16`, etc.). You would think this
would cover all the base int types, but in fact C++ defines multiple int
types that have the exact same bit layout. These duplicates will not
match each other when matching template specializations. For example,
`char` is either the same as `signed char` or `unsigned char`, but will
match neither. Likewise, `long` is the same as either `int` or `long
long`, but all these types will match different template
specializations.

Now all integer types are covered.
2020-11-11 08:07:14 -07:00
Kenneth Moreland
d9fe6a546f Fix ArrayHandleCast serializable type name
The specialization for SerializableTypeString for ArrayHandleCast tried
to get the serialization for the base type and the storage tag. This is
wrong since the storage tag itself is not seralizable nor has a type
string. Instead, just record the type name for the sub ArrayHandle
itself.
2020-11-11 07:48:24 -07:00
Kenneth Moreland
339a461f5c Avoid warning about uninitialized member 2020-11-10 16:39:57 -07:00
Kenneth Moreland
2f04dc3aef Simplify creating metadata in Buffer objects
Previously you had to create a special virtual object to place in the
`Buffer`'s metadata. This added a lot of difficulty that is probably
unnecessary.

Instead, just have `Buffer` hold an arbitrary object and some simple
functions to copy and delete it. There may be issues with type safety
across translation units, but we'll deal with that when/if we run into
it.
2020-11-10 16:22:05 -07:00
Kenneth Moreland
132a07225d Merge topic 'precompiled-field-get-range'
a88e0d914 Reintroduce ArrayRangeCompute.hxx as deprecated
7d681fb58 Deprecate templated versions of Field::GetRange

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2296
2020-11-10 13:49:45 -05:00
Kenneth Moreland
a88e0d9149 Reintroduce ArrayRangeCompute.hxx as deprecated
ArrayRangeCompute.hxx was removed, but other code may be including it.
The file was replaced. It now just includes its replacement
(ArrayRangeComputeTemplate.h) and forces a deprecation warning.
2020-11-10 09:58:50 -07:00
Kenneth Moreland
917ad80a85 Merge topic 'arrayhandlediscard-use-buffer'
cc729f422 Convert ArrayHandleDiscard to new buffer-style arrays

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2309
2020-11-10 09:46:08 -05:00
Kenneth Moreland
8d73a86623 Merge topic 'separate-cont-exec-variant'
e3dfa4891 Do not attempt to move non-trivial objects in Variant
8e11b3ecd Remove ArrayPortalCheck
21db210a7 Make separate exec and cont versions of Variant

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2274
2020-11-10 09:33:13 -05:00
Kenneth Moreland
cc729f422b Convert ArrayHandleDiscard to new buffer-style arrays 2020-11-09 15:45:45 -07:00
Kenneth Moreland
8dfc682014 Convert ArrayHandleReverse to new buffer-style arrays 2020-11-09 14:22:52 -07:00
Kenneth Moreland
8e11b3ecd1 Remove ArrayPortalCheck
This portal only works on the control environment, which means it cannot
work with the new `ArrayHandle` type. Recent changes to
`ArrayHandleMultiplexer` also do not allow this, so just remove it
rather than try to fix it.
2020-11-09 12:48:10 -07:00
Kenneth Moreland
21db210a73 Make separate exec and cont versions of Variant
The `Variant` class is templated to hold objects of other types.
Depending on whether those objects of are meant to be used in the
control or execution side, the methods on `Variant` might need to be
declared with (or without) special modifiers. We can sometimes try to
compile the `Variant` methods for both host and device and ask the
device compiler to ignore incompatibilities, but that does not always
work.

To get around that, create two different implementations of `Variant`.
Their API and implementation is exactly the same except one declares its
methods with `VTKM_CONT` and the other its methods `VTKM_EXEC`.
2020-11-09 12:48:10 -07:00
Kenneth Moreland
7d681fb585 Deprecate templated versions of Field::GetRange
Instead, always use precompiled versions of range computing. This means
you won't be able to specify the type. Currently, types are limited to
scalars vecs up to size 4.

The main motivation for this change is to allow you to include Field.h
with a non-device compiler. This is an important feature for our
customers.

I plan in the future to implement a mechanism to pull out a component of
most ArrayHandle's as a single array. This would enable us to support a
precompiled version that can compute the range of arbitrarily sized
Vecs.
2020-11-09 12:28:29 -07:00
Kenneth Moreland
7a12c5e524 Add missing logging for some TBB device algorithms
Some of the algorithms listed near the end of
DeviceAdapterAlgorithmTBB.h were missing the entry in the performance
log letting us know it was called.
2020-10-28 18:28:27 -06:00
Kenneth Moreland
b33c54bf61 Add ScheduleTask to performance log
When `DeviceAdapterAlgorithm::ScheduleTask` was called directly (i.e.
not through `Schedule`), nothing was added to the log. Adding
`VTKM_LOG_SCOPE` to these methods so that all scheduling is added to the
performance log.
2020-10-25 17:22:38 -06: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
Robert Maynard
0277ff1440 Merge topic 'functor_general_work_with_hip'
882d9be58 FunctorsGeneral updated to work with HIP

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2295
2020-10-21 09:11:14 -04:00
Robert Maynard
882d9be583 FunctorsGeneral updated to work with HIP 2020-10-20 15:52:29 -04:00
Kenneth Moreland
28ecf3636d Change interface of atomic compare and swap
The old atomic compare and swap operations (`vtkm::AtomicCompareAndSwap`
and `vtkm::exec::AtomicArrayExecutionObject::CompareAndSwap`) had an
order of arguments that was confusing. The order of the arguments was
shared pointer (or index), desired value, expected value. Most people
probably assume expected value comes before desired value. And this
order conflicts with the order in the `std` methods, GCC atomics, and
Kokkos.

Change the interface of atomic operations to be patterned off the
`std::atomic_compare_exchange` and `std::atomic<T>::compare_exchange`
methods. First, these methods have a more intuitive order of parameters
(shared pointer, expected, desired). Second, rather than take a value
for the expected and return the actual old value, they take a pointer to
the expected value (or reference in `AtomicArrayExecutionObject`) and
modify this value in the case that it does not match the actual value.
This makes it harder to mix up the expected and desired parameters.
Also, because the methods return a bool indicating whether the value was
changed, there is an additional benefit that compare-exchange loops are
implemented easier.

For example, consider you want to apply the function `MyOp` on a
`sharedValue` atomically. With the old interface, you would have to do
something like this.

```cpp
T oldValue;
T newValue;
do
{
  oldValue = *sharedValue;
  newValue = MyOp(oldValue);
} while (vtkm::AtomicCompareAndSwap(sharedValue, newValue, oldValue) != oldValue);
```

With the new interface, this is simplfied to this.

```cpp
T oldValue = *sharedValue;
while (!vtkm::AtomicCompareExchange(sharedValue, &oldValue, MyOp(oldValue));
```
2020-10-20 08:39:22 -06: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
Kenneth Moreland
c60cae3b87 Add scope logs for building locators 2020-10-13 12:41:25 -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
Robert Maynard
22dfb4776e Remove unused functions from TestingDeviceAdapter 2020-10-09 14:13:45 -04:00
Sujin Philip
c26e193fec Use kokkos provided routines for sort and copy 2020-10-08 13:46:43 -04: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
d0c9fb2741 Correct missing VTKM_EXEC_CONT in UnitTestArrayHandleExtrude 2020-09-25 09:37:46 -04: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
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
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
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
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
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
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
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
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
80cf0b3658 Fix more signed/unsigned vtkm::Id/std::size_t warnings in kokkos adapter 2020-08-27 07:59:03 -06: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
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
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
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
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
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
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
9bf49101ca Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into mpiStreamlines2 2020-08-17 16:35:40 -04:00
Kenneth Moreland
38a6fe22f8 Merge topic 'arraycopy-with-buffer'
8983154e9 Add DeepCopy to ArrayHandle
694ba7e92 Change ArrayCopy to deep copy Buffer objects where possible

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2212
2020-08-14 15:48:51 -04:00
Sujin Philip
0beb0f650b Merge topic 'add-kokkos-backend'
2d1b609b3 Use Ubuntu instead of rhel8 for cuda+kokkos
769248583 Make sure we use c++14 when using CUDA 11+
64efa6401 Kokkos: make sure we don't pass multiple rdc flags
b2f4c8e5e Switch -O3 to -O2 on Linux with Cuda 10
db57ed26a Fix warnings
452f61e29 Add Kokkos backend

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2164
2020-08-14 09:35:46 -04:00
Kenneth Moreland
8983154e9e Add DeepCopy to ArrayHandle
`ArrayHandle::DeepCopy` creates a new `ArrayHandle` of the same type and
deep copies the data into it.

This functionality is similar to `ArrayCopy`. However, it can be used
without having to compile for the device on which the copy happens.
2020-08-13 16:56:06 -06:00
Kenneth Moreland
694ba7e92c Change ArrayCopy to deep copy Buffer objects where possible
Now that the data in an `ArrayHandle` is stored in `Buffer` objects, we
now have a more efficient way of doing deep copies of memory. Rather
than call `Algorithm::Copy`, which iterates over the array and copies
each item, `ArrayCopy` now uses the `Buffer` interface to do direct
device-to-device (or host-to-host) mem copies. This should be more
efficent and take less time to compile.

Note that this direct `Buffer` copy only works if the two `ArrayHandle`s
are of the same type. If they are different, `ArrayCopy` still has to
fall back to using `Algorithm::Copy`.

Also note that not all `ArrayHandle`s are using the new `ArrayHandle`
interface (and therefore not using `Buffer` objects). Thus, a fallback
is still available for old `ArrayHandle` types.
2020-08-13 16:56:06 -06:00
dpugmire
c806403e2a distributed memory support for streamline and particleadvect filters. 2020-08-13 09:53:57 -04:00
Kenneth Moreland
6dbf304000 Merge topic 'num-buffers-runtime-selectable'
72475177d Make number of buffers in an ArrayHandle runtime selectable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2206
2020-08-12 18:23:59 -04:00
Sujin Philip
db57ed26a2 Fix warnings 2020-08-12 13:55:24 -04:00
Sujin Philip
452f61e290 Add Kokkos backend 2020-08-12 13:55:24 -04:00
Robert Maynard
477d225415 Always have VTK-m tests enable vtkmdiy mpi environment 2020-08-11 17:02:19 -04:00
Kenneth Moreland
72475177d8 Make number of buffers in an ArrayHandle runtime selectable
This has no real change in the operation, but it will simplify code as
we convert `ArrayHandle`s to the new type. We will be able to write
simple runtime code rather than complex metaprogramming to determine the
number of buffers to use.
2020-08-11 13:25:06 -06:00
Robert Maynard
f22dd9f571 Allow VTK-m Buffer to have ownership transferred 2020-08-06 10:31:57 -04:00
Kenneth Moreland
5f541d2515 Drop log message when ignoring copy in move
For `make_ArrayHandle` and `make_Field` when it is determined that the
data can be safely moved, just silently move instead of copy instead of
printing a log message saying the copy flag will be ignored.

Also fix an issue with `make_ArrayHandle` when the data was not moved
when it could have been.
2020-07-23 17:59:50 -06:00
Kenneth Moreland
4c56797c5d Remove ArrayHandleSOA constructors with ambiguous move semantics
Also correct some constructors/functions that should be
deprecated.
2020-07-23 17:54:42 -06:00
Kenneth Moreland
0d484505e7 Fix bad gcc compiler warning about static definition (again) 2020-07-23 17:53:15 -06:00
Kenneth Moreland
e23989bde1 Use data method to get pointer from std::vector
Do not use `&v.front()` to get the pointer from an `std::vector`. That
behavior is undefined when the vector is empty. Instead, use `v.data()`.
2020-07-23 11:02:40 -06:00
Kenneth Moreland
2e243cbbac Fix issue with using std::string in ArrayHandle
The recent version of ArrayHandleBasic allocates typeless arrays without
any initialization. This can cause issues with types that require a
constructor. The UnitTestVariantArrayHandle was trying to create an
ArrayHandle with an std::string, and the uninitialized strings were
causing crashes on some platforms.
2020-07-23 11:02:38 -06:00
Kenneth Moreland
46f253b927 Fix compiler issue with MSVC 2020-07-23 10:53:42 -06:00
Kenneth Moreland
d1a4aecc59 Improvements to moving data into ArrayHandle
We have made several improvements to adding data into an `ArrayHandle`.

## Moving data from an `std::vector`

For numerous reasons, it is convenient to define data in a `std::vector`
and then wrap that into an `ArrayHandle`. It is often the case that an
`std::vector` is filled and then becomes unused once it is converted to an
`ArrayHandle`. In this case, what we really want is to pass the data off to
the `ArrayHandle` so that the `ArrayHandle` is now managing the data and
not the `std::vector`.

C++11 has a mechanism to do this: move semantics. You can now pass
variables to functions as an "rvalue" (right-hand value). When something is
passed as an rvalue, it can pull state out of that variable and move it
somewhere else. `std::vector` implements this movement so that an rvalue
can be moved to another `std::vector` without actually copying the data.
`make_ArrayHandle` now also takes advantage of this feature to move rvalue
`std::vector`s.

There is a special form of `make_ArrayHandle` named `make_ArrayHandleMove`
that takes an rvalue. There is also a special overload of
`make_ArrayHandle` itself that handles an rvalue `vector`. (However, using
the explicit move version is better if you want to make sure the data is
actually moved.)

## Make `ArrayHandle` from initalizer list

A common use case for using `std::vector` (particularly in our unit tests)
is to quickly add an initalizer list into an `ArrayHandle`. Now you can
by simply passing an initializer list to `make_ArrayHandle`.

## Deprecated `make_ArrayHandle` with default shallow copy

For historical reasons, passing an `std::vector` or a pointer to
`make_ArrayHandle` does a shallow copy (i.e. `CopyFlag` defaults to `Off`).
Although more efficient, this mode is inherintly unsafe, and making it the
default is asking for trouble.

To combat this, calling `make_ArrayHandle` without a copy flag is
deprecated. In this way, if you wish to do the faster but more unsafe
creation of an `ArrayHandle` you should explicitly express that.

This requried quite a few changes through the VTK-m source (particularly in
the tests).

## Similar changes to `Field`

`vtkm::cont::Field` has a `make_Field` helper function that is similar to
`make_ArrayHandle`. It also features the ability to create fields from
`std::vector`s and C arrays. It also likewise had the same unsafe behavior
by default of not copying from the source of the arrays.

That behavior has similarly been depreciated. You now have to specify a
copy flag.

The ability to construct a `Field` from an initializer list of values has
also been added.
2020-07-23 10:53:38 -06:00
Kenneth Moreland
744edbf428 Merge topic 'gcc-static-function-warning'
b1f648bfd Remove gcc warning about static declared function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2193
2020-07-22 15:20:45 -04:00
Li-Ta Lo
537557ef91 Merge topic 'worket_invoker_dispatcher2'
0dcc6cc16 reverse #include on CellNeighborhood
2489da125 restore comment, add needed #include
f33318247 Reverse Invoker, Dispatcher and Worklet dependency

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2192
2020-07-22 14:20:35 -04:00
Kenneth Moreland
b1f648bfdf Remove gcc warning about static declared function
While compiling UnitTestVariantArrayHandle, some versions of gcc
(between 6 and 8, I think) gave a warning like the following:

```
../vtkm/cont/StorageVirtual.h:227:12: warning: 'vtkm::Id vtkm::cont::internal::detail::StorageVirtualImpl<T, S>::GetNumberOfValues() const [with T = std::__cxx11::basic_string<char>; S = vtkm::cont::StorageTagImplicit<{anonymous}::UnusualPortal<std::__cxx11::basic_string<char> > >]' declared 'static' but never defined [-Wunused-function]
```

This warning makes no sense because it is refering to a method that is
not declared static. (In fact, it overrides a virtual method.)

I believe this is an obscure bug in these versions of gcc. I found a
[stackoverflow post] that seems to have the same problem, but no
workaround was found.

The warning originated from code that had little effect. It was part of
a test with a custom ArrayHandle storage type that was already disabled
for other reasons. Just removed the code.

[stackoverflow post]: https://stackoverflow.com/questions/56615695/how-to-fix-declared-static-but-never-defined-on-member-function
2020-07-22 08:28:28 -06:00
Li-Ta Lo
f333182476 Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
dpugmire
246be1b7f0 Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into generalizeField 2020-07-21 15:03:08 -04:00
Li-Ta Lo
567b1fedd2 Merge topic 'cell_neighbor'
9cd70a7dc Install WorkletNeighborhood.h
f66c782b1 Extract WorkletNeighborhood base class
760c51ed6 install ThreadIndicesNeighborhood.h
e52b8fa88 Add CellNeighborhood

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2181
2020-07-21 13:45:40 -04:00
dpugmire
31c97bed89 Generalize fields for particle advection 2020-07-20 21:15:46 -04:00
Kenneth Moreland
502c310cf8 Merge topic 'deprecate-arrayhandlevirtualcoordinates'
c689a68c5 Suppress bad deprecation warnings in MSVC
a3f23a03b Do not cast to ArrayHandleVirtual in VariantArrayHandle::CastAndCall
f6b13df51 Support coordinates of both float32 and float64
453e31404 Deprecate ArrayHandleVirtualCoordinates
be7f06bbe CoordinateSystem data is VariantArrayHandle

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2177
2020-07-16 17:25:43 -04:00
Li-Ta Lo
e52b8fa88a Add CellNeighborhood 2020-07-15 14:41:32 -06:00
Kenneth Moreland
c689a68c5c Suppress bad deprecation warnings in MSVC
The Microsoft compiler has this annoying and stupid behavior where if
you have a generic templated method/function and that method is
instantiated with a deprecated class, then the compiler will issue a
C4996 warning even if the calling code is suppressing that warning
(because, for example, you are implementing other deprecated code and
the use is correct). There is no way around this other than suppressing
the warnings for all uses of the templated method.
2020-07-14 16:25:04 -06:00
Kenneth Moreland
a3f23a03b6 Do not cast to ArrayHandleVirtual in VariantArrayHandle::CastAndCall
We are moving to deprecate `ArrayHandleVirtual`, so we are removing the
feature where `VariantArrayHandle::CastAndCall` automatically casts to
an `ArrayHandleVirtual` if possible.

The big reason to make this change now (as opposed to later when
`ArrayHandleVirtual` is deprecated) is to improve compile times.
This prevents us from having to compile an extra code path using
`ArrayHandleVirtual`.
2020-07-14 08:53:03 -06:00
Kenneth Moreland
f6b13df513 Support coordinates of both float32 and float64
Previously there were issues if the coordinate system was using floating
point values that were not FloatDefault. This remedies that issue.
2020-07-14 08:53:01 -06:00
Kenneth Moreland
453e314044 Deprecate ArrayHandleVirtualCoordinates
We are in the process of deprecating virtual classes in VTK-m
(that run in the execution environment).
2020-07-14 08:51:47 -06:00
Kenneth Moreland
be7f06bbe7 CoordinateSystem data is VariantArrayHandle
`CoordinateSystem` differed from `Field` in that its `GetData`
method returned an `ArrayHandleVirtualCoordinates` instead of
a `VariantArrayHandle`. This is probably confusing since
`CoordianteSystem` inherits `Field` and has a pretty dramatic
difference in this behavior.

In preparation to deprecate `ArrayHandleVirtualCoordinates`, this
changes `CoordiantSystem` to be much more like `Field`. (In the
future, we may change the `CoordinateSystem` to point to a `Field`
rather than be a special `Field`.)

A method named `GetDataAsMultiplexer` has been added to
`CoordinateSystem`. This method allows you to get data from
`CoordinateSystem` as a single array type without worrying
about creating functors to handle different types and without
needing virtual methods.
2020-07-14 08:50:39 -06:00
Robert Maynard
29bac212c7 Merge topic 'extrude-fix'
a428d75e0 adding CellSetExtrude to DefaultTypesVTK
235d9ce14 add GetThreadIndex to ThreadIndicesExtrude classes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2172
2020-07-13 14:24:58 -04:00
Kenneth Moreland
85bdc030ba Merge topic 'fix-multiplexer-cuda'
18b5be92d Fix issue with CUDA and ArrayHandleMultiplexer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2168
2020-07-09 08:25:55 -04:00
Caitlin Ross
a428d75e02 adding CellSetExtrude to DefaultTypesVTK 2020-07-08 14:51:41 -04:00
Kenneth Moreland
cbf9868915 Fix potential deadlock in ArrayHandle::PrepareForOutput
`ArrayHandle::PrepareForOutput` often has to reallocate the array to the
specified size. Previously, this allocation was not happening with the
`Token` that is passed to `PrepareForOutput`. If the `ArrayHandle` is
already attached or enqueued for that `Token`, then the allocation would
deadlock.

You can now pass a `Token` object to `Allocate`, which is what
`PrepareForOutput` does.
2020-07-07 18:30:38 -06:00
Kenneth Moreland
18b5be92d6 Fix issue with CUDA and ArrayHandleMultiplexer
When you try to call the `Reduce` operation in the CUDA device adapter
with a sufficently complex interator type, you get a compile error
that says `error: cannot pass an argument with a user-provided
copy-constructor to a device-side kernel launch`.

This appears to be a bug in either nvcc or Thrust. I believe it is
related to the following reported issues:

* https://github.com/thrust/thrust/issues/928
* https://github.com/thrust/thrust/issues/1044

Work around this problem by making a special condition for calling
`Reduce` with an `ArrayHandleMultiplexer` that calls the generic
algorithm in `DeviceAdapterAlgorithmGeneral` instead of the algorithm in
Thrust.
2020-07-06 13:51:36 -06:00
Kenneth Moreland
42219f8d61 Fix buffer leak in BufferInfo 2020-06-29 16:36:21 -06:00
Kenneth Moreland
a47fd42bc1 Pin user provided memory in ArrayHandle
Often when a user gives memory to an `ArrayHandle`, she wants data to be
written into the memory given to be used elsewhere. Previously, the
`Buffer` objects would delete the given buffer as soon as a write buffer
was created elsewhere. That was a problem if a user wants VTK-m to write
results right into a given buffer.

Instead, when a user provides memory, "pin" that memory so that the
`ArrayHandle` never deletes it.
2020-06-25 14:02:46 -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
Kenneth Moreland
8f7b0d18be Add Buffer class
The buffer class encapsulates the movement of raw C arrays between
host and devices.

The `Buffer` class itself is not associated with any device. Instead,
`Buffer` is used in conjunction with a new templated class named
`DeviceAdapterMemoryManager` that can allocate data on a given
device and transfer data as necessary. `DeviceAdapterMemoryManager`
will eventually replace the more complicated device adapter classes
that manage data on a device.

The code in `DeviceAdapterMemoryManager` is actually enclosed in
virtual methods. This allows us to limit the number of classes that
need to be compiled for a device. Rather, the implementation of
`DeviceAdapterMemoryManager` is compiled once with whatever compiler
is necessary, and then the `RuntimeDeviceInformation` is used to
get the correct object instance.
2020-06-25 14:01:39 -06:00
Li-Ta Lo
365b1bb25c use make_ArrayHandleZip 2020-06-25 09:51:06 -06:00
Li-Ta Lo
980c4864ac Merge branch 'master' into standard_normal 2020-06-24 14:38:50 -06:00
Li-Ta Lo
beba90b6f7 Merge topic 'uniform_real'
143e3d39a remove unused type alias
01a448663 Merge branch 'master' into uniform_real
c67e5bb12 fixe warnings about implicit type conversion
1e4294392 Add deterministic seed to avoid potential spurious failure
5b0e309b9 the random source is still 64 bits
cc3061bab Avoid calling ReadPortal() all the time
9bf6dea22 remove inline initialization of seed
e69308047 Add statistics base testing, add Flot32 RNG

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2148
2020-06-24 16:36:36 -04:00
Kenneth Moreland
f6a8993469 Make tests that throw an STL exception fail
If a test throws any unexpected exception, the test is supposed to
detect that and fail. For the STL exceptions, the test failed to return
an error code. Fix that.
2020-06-23 16:25:09 -06:00
dpugmire
0654d1853d fix cuda compile, export function. 2020-06-19 10:57:30 -04:00
dpugmire
6d1930bc20 forgot the storage tags 2020-06-18 19:41:37 -04:00
dpugmire
03e3198977 move funcs to cxx, remove storage template 2020-06-18 19:37:09 -04:00
dpugmire
bac9664104 Move array copy to cxx 2020-06-18 17:53:19 -04:00
dpugmire
35ed68911e fix compile error. 2020-06-18 15:59:09 -04:00
dpugmire
1a7823c604 code cleanup. 2020-06-18 15:50:25 -04:00
dpugmire
02d8c3782d Add unittest for particlearraycopy 2020-06-18 15:45:36 -04:00
dpugmire
24451a3de2 Create a function for copying fields from particle arrays. 2020-06-18 14:54:18 -04:00
Li-Ta Lo
01a4486638 Merge branch 'master' into uniform_real 2020-06-18 11:46:18 -06:00
Li-Ta Lo
2aea7534bd Add ArrayHandleRandomStandardNormal 2020-06-17 15:48:09 -06:00
Kenneth Moreland
8a1df977a7 Add common superclass to VariantArrayHandleBase
Many of the operations of `VariantArrayHandleBase` are not dependent on
the TypeList parameter of the class. Still others can operate just as
well by providing a type list to a method. Thus, it is convenient to
create a superclass that is not templated. That allows us to pass around
a `VariantArrayHandle` when the type list does not matter.

This superclass is called `VariantArrayHandleCommon` because "base" was
already taken.
2020-06-17 15:38:20 -06:00
Kenneth Moreland
c35abc732f Rename IsInValidArrayHandle to IsInvalidArrayHandle
This makes it clear that it returns true for an invalid array handle.
The previous name implied that it was looking for an ArrayHandle in some
"valid" set, which is the opposite.
2020-06-17 15:38:19 -06:00
Li-Ta Lo
1e42943928 Add deterministic seed to avoid potential spurious failure 2020-06-17 13:36:15 -06:00
Li-Ta Lo
5b0e309b95 the random source is still 64 bits 2020-06-17 12:58:03 -06:00
Li-Ta Lo
cc3061bab1 Avoid calling ReadPortal() all the time 2020-06-17 12:53:11 -06:00
Li-Ta Lo
9bf6dea226 remove inline initialization of seed 2020-06-17 12:47:54 -06:00
Li-Ta Lo
e69308047b Add statistics base testing, add Flot32 RNG 2020-06-17 12:01:10 -06:00
Kenneth Moreland
f8a09d6de5 Handle read-only portals in ArrayHandleMultiplexer
The ArrayPortalMultiplexer always called Set on the delegate portals.
However, sometimes the portals were not supported. Instead, only call
when the delegate is supported.

Probably the "right" thing to do would be to check all posible portals
for support, but that sounds like it would slow down the compile.
2020-06-16 00:15:11 -06:00
Kenneth Moreland
ed2f4aabf7 Detect when VariantArrayHandle::AsMultiplexer fails
Previously, the VariantArrayHandle::AsMultiplexer operation silently
failed and returned an invalid ArrayHandleMultiplexer. This is now
changed to throw an exception if the desired ArrayHandleMultiplexer
cannot hold the VariantArrayHandle's array.
2020-06-16 00:12:24 -06:00
NAThompson
b3cb8e834c Nuke the ostream overload. 2020-06-12 16:07:16 -04:00
NAThompson
b55ce7369e Demangle symbols in PrintSummary. 2020-06-12 15:23:16 -04:00
Kenneth Moreland
22f227a91e Merge topic 'ordered-async-access'
de3bda373 Use deque instead of list for ArrayHandle queue
498d44548 Pass Token::Reference by value
c32c9e8e8 Fix deadlock when changing device during read
99e14ab8a Add proper enqueuing of Tokens for ArrayHandle

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2130
2020-06-11 21:55:27 -04:00
Kenneth Moreland
de3bda3738 Use deque instead of list for ArrayHandle queue 2020-06-11 15:47:41 -06:00
Kenneth Moreland
498d445483 Pass Token::Reference by value
There is no point in passing Token::Reference by reference since (being
just a simple reference itself) it is no larger than a pointer.
2020-06-11 11:51:42 -06:00
Li-Ta Lo
c04b8440eb Merge topic 'uniform_real'
c0dee7402 make it explicit that we are using 64-bit unsigned integer in bit op
34f350588 Added changelog
e9f584a91 ArrayHandleRandomUniformReal

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2116
2020-06-11 08:41:38 -04:00
Sujin Philip
b7d0c94f1b Merge topic 'diy-mpi-nompi'
934f085e0 Build diy as a library
f0a37ac6a Merge branch 'upstream-diy' into diy-mpi-nompi
7687aabf8 diy 2020-06-05 (b62915aa)
6ca2b9f87 Point to new version of Diy

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2123
2020-06-08 21:25:54 -04:00
Kenneth Moreland
c32c9e8e8d Fix deadlock when changing device during read
Because ArrayHandle currently only supports one device at a time, it is
possible that a `PrepareForInput` might actually need to wait for write
access so that it could move the data between devices. However, we don't
want the `Token` to be attached for writing because that could block
other read operations.

To get around this, add a hack to WaitToWrite to allow it to attach for
reading instead of writing.
2020-06-08 18:15:13 -06:00
Kenneth Moreland
99e14ab8a6 Add proper enqueuing of Tokens for ArrayHandle
An issue that was identified for the thread safety of `ArrayHandle` is
that if several threads are waiting to use an `ArrayHandle`, there might
be an expectation of the order in which the operations happen. For
example, if one thread is modifying the contents of an `ArrayHandle` and
another is reading those results, we would need the first one to start
before the second one.

To solve this, a queue is added to `ArrayHandle` such that when waiting
to read or write an `ArrayHandle` the `Token` has to be at the top of
the queue in addition to other requirements being met.

Additionally, an `Enqueue` method is added to add a `Token` to the queue
without blocking. This allows a control thread to queue the access and
then spawn a thread where the actual work will be done. As long as
everything is enqueued on the main thread, the operations will happen in
the expected order.
2020-06-08 16:49:02 -06:00
Sujin Philip
934f085e09 Build diy as a library
Support both mpi and nompi versions simultaneously.
2020-06-08 15:57:51 -05:00
Kenneth Moreland
7be44c847f Enable setting invalid value in probe filter
Initially, the probe filter would simply not set a value if a sample was
outside the input `DataSet`. This is not great as the memory could be
left uninitalized and lead to unpredictable results. The testing
compared these invalid results to 0, which seemed to work but is
probably unstable.

This was partially fixed by a previous change that consolidated to
mapping of cell data with a general routine that permuted data. However,
the fix did not extend to point data in the input, and it was not
possible to specify a particular invalid value.

This change specifically updates the probe filter so that invalid values
are set to a user-specified value.
2020-06-03 15:29:37 -06:00
Li-Ta Lo
c0dee74028 make it explicit that we are using 64-bit unsigned integer in bit op 2020-06-03 11:43:14 -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
Robert Maynard
a652f7fe1e Update vtk-m doxygen to generate less warnings 2020-06-01 16:58:32 -04:00
Robert Maynard
97a2408fc4 Correct warnings for using TBB 2020 deprecated functions 2020-06-01 16:58:32 -04:00
NAThompson
fe4f71ab92 Deprecate DataSetFieldAdd. 2020-05-27 15:27:47 -04:00
Robert Maynard
cf9b74d7ff Merge topic 'improve_flying_edge_perf'
251bd82b8 Significantly improve FlyingEdges performance across all devices
fa9373801 Rework FlyingEdges::Pass1 to handle NUMA and CUDA requirements.
769a10b47 FlyingEdge Normal and Point generation occurs in Pass4
93d87e06f Optimize StructuredPointGradient for non boundary points.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2080
2020-05-27 08:47:09 -04:00
Ben Boeckel
0488aab201 docs: update gitlab links to include /-/ component 2020-05-26 14:48:49 -04:00
Allison Vacanti
ac3fa0f252 Merge topic 'cuda_fixes'
6c98cbc6e Add missing Algorithm::Synchronize() in timer test.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2094
2020-05-25 19:18:16 -04:00
Robert Maynard
251bd82b80 Significantly improve FlyingEdges performance across all devices
We now use SumYAxis when executing with CUDA for better memory patterns.
Instead of using the heavy Pass4/Pass4WithNormals, CUDA now uses a
2 pass approach with the second pass outputting the normals and
coordinates using with significantly less warp divergence
2020-05-22 15:53:49 -04:00
Kenneth Moreland
5498ecd35b Properly handle global (whole mesh) fields in data set filters
Generally, fields that have a WHOLE_MESH association might be valid even
if the structure of the mesh changes. Thus, it makes sense for filters
to pass this data pretty much all the time.

Also cleaned up some code and comments to make the relationship between
`MapFieldOntoOutput` and `DoMapField` more clear.
2020-05-21 08:34:34 -06:00
Kenneth Moreland
b1f288aaea Add non-templated base class to Keys class.
The only reason Keys has a template is so that it can hold a UniqueKeys
array and provide the key for each group. If that is not needed and you
want to implement a library function that takes a keys object, you can
now grab the Keys superclass KeysBase. KeysBase is not templated, so you
can pass it to a standard method in a library.
2020-05-21 08:34:07 -06:00
Kenneth Moreland
06f5119c29 Fix deprecation warning
This came up when updating VTK-m in VTK.
2020-05-18 18:41:47 -06:00
Kenneth Moreland
72cd0107ee Deprecate Execute with policy
The version of `Filter::Execute` that takes a policy as an argument is now
deprecated. Filters are now able to specify their own fields and types,
which is often why you want to customize the policy for an execution. The
other reason is that you are compiling VTK-m into some other source that
uses a particular types of storage. However, there is now a mechanism in
the CMake configuration to allow you to provide a header that customizes
the "default" types used in filters. This is a much more convenient way to
compile filters for specific types.

One thing that filters were not able to do was to customize what cell sets
they allowed using. This allows filters to self-select what types of cell
sets they support (beyond simply just structured or unstructured). To
support this, the lists `SupportedCellSets`, `SupportedStructuredCellSets`,
and `SupportedUnstructuredCellSets` have been added to `Filter`. When you
apply a policy to a cell set, you now have to also provide the filter.
2020-05-18 12:38:41 -06:00
Allison Vacanti
6c98cbc6e4 Add missing Algorithm::Synchronize() in timer test. 2020-05-17 12:53:14 -04:00
Nick
9aa350ee3d Fix bad whitespace. 2020-05-14 18:13:03 -04:00
Nick
9991179e6d Do not use auto return type; it's not supported until C++14. 2020-05-14 18:10:32 -04:00
Nick
9471041484 Merge branch 'master' into deprecate_read_portal_get 2020-05-14 14:04:44 -04:00
Nickolas Davis
3a42ebf7bd Merge topic 'image-io'
24d022b02 Implement and test ImageReader and ImageWriter capabilities in the io library

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !1967
2020-05-13 19:20:42 -04:00