Commit Graph

2726 Commits

Author SHA1 Message Date
Nick Thompson
321571fabe Make sure operator precedence is correct over macro invocation. 2021-04-12 13:50:27 -04:00
Nick Thompson
94a32bf64c Improve code in response to review. 2021-04-12 13:42:19 -04:00
Nick Thompson
568c0b5d29 Small formatting changes. 2021-04-12 13:05:36 -04:00
Nick Thompson
a8e25da0ab Add __func__ to unit test metadata printed on failure. 2021-04-12 12:54:38 -04:00
Kenneth Moreland
14839a0325 Fix deprecation warnings with MSVC 2021-04-08 09:28:03 -06:00
Kenneth Moreland
5510521a06 Fix VariantArrayHandle::AsVirtual with cast arrays
The both the underlying `UnknownArrayHandle` and `ArrayHandleVirtual`
handle `ArrayHandleCast` specially. This caused problems when passing an
`ArrayHandleCast` to `VariantArrayHandle::AsVirtual`. Solve the problem
by stripping out the cast storage tags and letting these classes handle
it internally.

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

The only problem is that if you use `IsType`, the result can be
unexpected. This is what happened with `CastAndCall`, which was using
`IsType` internally. Changed that to `CanConvert` to properly get the
array handle out.
2021-04-07 16:12:42 -06:00
Kenneth Moreland
68f39b86a8 Deprecate VariantArrayHandle
`VaraintArrayHandle` has been replaced by `UnknownArrayHandle` and
`UncertainArrayHandle`. Officially make it deprecated and point users to
the new implementations.
2021-04-07 16:12:38 -06:00
nadavi
26d9ecb398 split vtkm/Algorithms.h into UpperBound.h, LowerBound.h, and BinarySearch.h 2021-04-07 18:53:09 +00:00
Kenneth Moreland
3813fb515c Make ArrayPortalRecombineVec trivially copyable
Using this internal class is a bit tricky because it requires a pointer
to a C array that is expected to contain portals. Both the C array and
the portals must be defined for the expected device. This is already
handled by the associated Storage. Assuming all of this holds, make sure
the `ArrayPortalRecombineVec` is trivially copyable. This is a
requirement for passing objects to the execution environment.
2021-04-02 07:37:26 -06:00
Kenneth Moreland
26d5168b4d Fix types used for coordinates in ArrayRangeCompute
Was using scalar types for `ArrayRangeCompute` for storage of types like
Cartesian product. It should be `Vec3` types.
2021-03-30 09:37:34 -06:00
Kenneth Moreland
eadaf06f0c Set what string in Error::SetMessage
`vtkm::cont::Error` inherits from `std::exception`. As such, it has a
special `what` string that reports an error message in a standard way.
This is particularly useful when a `vtkm::cont::Error` exception remains
uncaught because the system will print the `what` string before
crashing.

Unfortunately, the `what` string was only being set in the `Error`
constructor that took a message. That is a problem for subclasses like
`ErrorCuda` that used the default constructor and then used
`SetMessage`. The `what` string did not get set in this case.

Change the behavior to capture the stack trace in the default
constructor and update the `what` string if a subclass uses
`SetMessage`.
2021-03-29 06:04:22 -06:00
Li-Ta Lo
9fbb916a00 Merge topic 'fp_atomics2'
b590a8ebb Add floating point atomics

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@acm.org>
Merge-request: !2438
2021-03-16 14:06:24 -04:00
Nick Thompson
d815493986 Merge topic 'write_cellset_extrude'
b1c0f46ac Response to code review.
4e7d85094 Remove default template argument that breaks build.
4cb661006 Implement GetIndices.
2d35ab05a Write CellSetExtrude as CellSetExplicit.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Dave Pugmire <dpugmire@gmail.com>
Merge-request: !2436
2021-03-12 19:32:55 -05:00
Nick Thompson
b1c0f46ac0 Response to code review. 2021-03-12 21:14:50 +00:00
Nick Thompson
4e7d85094e Remove default template argument that breaks build. 2021-03-12 15:37:32 -05:00
Nick Thompson
4cb661006e Implement GetIndices. 2021-03-12 14:40:27 -05:00
Li-Ta Lo
b590a8ebb2 Add floating point atomics 2021-03-11 08:19:51 -07:00
Kenneth Moreland
91d13bdfb2 Merge topic 'reduce-initial-type'
563e23aac Fix unintended cast in TBB Reduce's return value
a7100c845 Do not assume CUDA reduce operator is unary
f3a6931f6 Fix casting issues in TBB functors
cc5b9a016 Add casts to FunctorsGeneral.h
d9c988b20 Allow for different types in basic type operators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2431
2021-03-08 18:06:51 -05:00
Kenneth Moreland
563e23aaca Fix unintended cast in TBB Reduce's return value
It was setting the return value type the same as the initial value.
However, the value type can change based on the array type and the
operator.
2021-03-08 14:12:20 -07:00
Kenneth Moreland
a7100c845a Do not assume CUDA reduce operator is unary
The `Reduce` algorithm is sometimes used to convert an input type to a
different output type. For example, you can compute the min and max at
the same time by making the output of the binary functor a pair of the
input type. However, for this to work with the CUDA algorithm, you have
to be able to also convert the input type to the output type. This was
previously done by treating the binary operator as also a unary
operator. That's fine for custom operators, but if you are using
something like `thrust::plus`, it has no unary operation. (Why would
it?)

So, detect whether the operator has a unary operation. If it does, use
it to cast from the input portal to the output type. If it does not,
just use `static_cast`. Thus, the operator only has to have the unary
operation if `static_cast` does not work.
2021-03-03 09:39:51 -07:00
Kenneth Moreland
f3a6931f6b Fix casting issues in TBB functors 2021-03-03 09:39:51 -07:00
Kenneth Moreland
cc5b9a016f Add casts to FunctorsGeneral.h
If you are using the classes in `FunctorsGeneral.h`, you specify both
the result type and the type of the operands. Presumably you are already
comfortable with any type conversions. So let them keep.
2021-03-03 09:39:51 -07:00
Kenneth Moreland
d9c988b200 Allow for different types in basic type operators
The basic type operators in `Types.h` (i.e. `vtkm::Add`,
`vtkm::Subtract`, `vtkm::Multiply` and `vtkm::Divide`) required the same
type for both arguments. This caused problems when used with `Reduce`
and the initial value type did not match exactly.

Use some tricks from `BinaryOperators.h` to be flexible about using
different types.
2021-03-03 09:39:45 -07:00
dpugmire
21a3137000 kick the builds 2021-03-02 13:47:11 -05:00
dpugmire
565522eb62 Add ArrayHandleSOA to default 2021-03-02 12:09:26 -05:00
Kenneth Moreland
80c1f0a974 Be more conservative about is_trivial support
`std::is_trivial` is part of the C++14 specification. However, we have
encountered multiple compilers that purport to implement C++14 but do
not implement `std::is_trivial` and the like checks correctly.

To avoid such issues, only use `std::is_trivial` on compilers that we
have tested to support it.
2021-03-01 15:12:27 -07:00
mclarsen
1c060d9c50 more missing sstream headers 2021-02-26 13:49:42 -08:00
Kenneth Moreland
91fc69fd06 Merge topic 'implicit-functions-no-virtual'
662998f19 Remove make_ImplicitFunctionFunctor functions
27cc99acb Add documentation for Multiplexer and General implicit functions
6a445ebcf Do not return a reference from ImplicitFunction::PrepareForExecution
b0fcab5d7 Do not capture references to execution objects
096e7457c Fix CUDA issues
8c6623736 Suppress deprecation warnings in deprecated class
a6725b3ac Remove use of deprecated ImplicitFunctions with virtual methods
180d11e7f Add ImplicitFunctionGeneral
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Nickolas Davis <nadavi@sandia.gov>
Merge-request: !2413
2021-02-26 15:19:30 -05:00
mclarsen
ffb0548b92 adding missing header 2021-02-26 07:17:52 -08:00
Kenneth Moreland
1aa0714aec Merge topic 'summit-errors'
aa5c9dba2 Remove problematic lambda functions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2418
2021-02-25 11:41:51 -05:00
Kenneth Moreland
aa5c9dba28 Remove problematic lambda functions
The GCC 7 compiler on summit was failing to compile all of the
code. The problematic parts involved using lambda functions.
I think the problem is that the compiler has a bug where it
has a problem resolving the type of variables captured by
reference. The problem seems similar to this bug reported
to Kokkos:

https://github.com/kokkos/kokkos-kernels/issues/349

Solved the problem by removing the lambdas with either a
named method or just inline code.

I suspect the problem arose (without anyone's knowledge) with
MR !2331, which moved VTK-m to C++14. This GCC error seems to
happen with C++14 but not C++11. (The features of lambdas changed
between these two versions of C++.)
2021-02-24 09:52:59 -07:00
nadavi
bd72d72471 improve regression test error output when args aren't set 2021-02-22 23:36:30 +00:00
Kenneth Moreland
096e7457c3 Fix CUDA issues 2021-02-22 06:40:03 -07:00
Kenneth Moreland
180d11e7f2 Add ImplicitFunctionGeneral 2021-02-22 06:40:02 -07:00
Kenneth Moreland
5ab9ddb637 Update ImplicitFunction tests to use non-virtual objects
There is still a test for the deprecated functionality (for now). The
deprecated test only happens if deprecated virtuals are still compiled,
and warnings are suppressed for this part of the code.
2021-02-22 06:40:02 -07:00
Kenneth Moreland
0cddbef0b9 Deprecated virutal methods in ImplicitFunctions
The `ImplicitFunction` classes are now trivial classes that can be
passed among host and devices. Because of this, we now need to know the
type of the `ImplicitFunction` in order to use it.

The old functionality still exists (when virtual methods are still being
compiled), but will give deprecation warnings. It is also not possible
to get a pointer from `ImplicitFunctionHandle` and cast it back to the
original data type (because the type changed). This is a weird testing
feature that makes little sense in practice.

Also unsupported in the deprecated classes is the ability to change
the object and have those changes reflected in the handle. This is
unfortunate, but it would have been difficult to implement this
feature that is going away and only appears to be used in some of
the tests.
2021-02-22 06:40:02 -07:00
Nickolas Davis
8e757e58ad Merge topic 'point-locator-virtual-removal'
f70ecd435 implement PointLocator without virtual methods

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2403
2021-02-17 15:53:32 -05:00
Kenneth Moreland
75597e240b Merge topic 'array-range-compute-unknown'
04f020ae6 Update Field to use new ArrayRangeCompute features
2a41428fe Add implementation of ArrayRangeCompute for UnknownArrayHandle

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

This replaces the use of `ArrayHandleDecorator` in `CellSetExplicit`.
The two implementation should do the same thing, but the new
`ArrayHandleOffsetsToNumComponents` should be less complex for
compilers.
2021-02-17 10:44:47 -07:00
nadavi
f70ecd4354 implement PointLocator without virtual methods 2021-02-17 17:16:17 +00:00
Kenneth Moreland
04f020ae65 Update Field to use new ArrayRangeCompute features
Reduces the amount of code that has to be generated. Also improves the
number of arrays supported and has better support for deprecated
versions of `GetRange`.
2021-02-17 09:18:36 -07:00
Kenneth Moreland
2a41428fe4 Add implementation of ArrayRangeCompute for UnknownArrayHandle
This allows you to easily compute the range of any ArrayHandle, even if
you don't know the type.

A unit test for ArrayRangeCompute was also added.
2021-02-17 09:18:31 -07:00
Kenneth Moreland
2399741a97 Change Probe filter to use CellLocatorChooser
There was some compile errors with CUDA and the CellLocatorGeneral.
Apparently it added enough to the CUDA kernel to cause issues with
constant memory.
2021-02-15 12:39:12 -07:00
Kenneth Moreland
e61c54f873 Add CellLocatorChooser
`CellLocatorChooser` allows you to select a cell locator at compile
time. Unlike `CellLocatorGeneral`, you have to deduce what cell set
types you might have, but you don't have to have a large switch
statement in the middle of your worklet.
2021-02-15 12:39:11 -07:00
Kenneth Moreland
23c823d4b4 Fix compile errors and warnings related to new CellLocator structure 2021-02-15 12:39:11 -07:00
Kenneth Moreland
47429a3164 Fix export issues with CellLocatorBase 2021-02-15 12:39:11 -07:00
Kenneth Moreland
0a5f5d55c9 Remove virtual methods from cell locators
Deprecated the `CellLocator` class and made all methods of the
other `CellLocator` classes non-virtual. General locators can
still use the `CellLocatorGeneral` class, but this class now
only works with a predefined set of locators. (The functionality
to provide a function to select a locator has been removed.)
2021-02-15 12:39:11 -07:00
Kenneth Moreland
34b6bea013 Merge topic 'device-free-execwholearray'
0797359c5 Make ExecutionWholeArray objects not depend on device type
0bee74438 Support DeviceAdapterId in deprecated ArrayHandle

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Nick Thompson <nathompson7@protonmail.com>
Merge-request: !2405
2021-02-12 20:00:11 -05:00
Caitlin Ross
5336fea028 add XGC storage tags to DefaultTypesVTK 2021-02-10 15:20:35 -05:00
Caitlin Ross
a5689ec84d testing array range for xgc coords 2021-02-10 15:20:35 -05:00
Caitlin Ross
e73a0bccb8 update ArrayRangeCompute to handle ArrayHandleXGC* 2021-02-10 15:20:35 -05:00
Caitlin Ross
46155daaa2 removing ArrayHandleExtrude* 2021-02-10 15:20:35 -05:00
Caitlin Ross
a9711bffb7 update XGC ArrayHandles to new buffer style 2021-02-10 10:18:53 -05:00
Kenneth Moreland
0797359c57 Make ExecutionWholeArray objects not depend on device type
With recent changes to `Arrayhandle`, the type for the associated array
portal is now the same across all devices. This means that almost all
exec objects no longer need to be specialized on the device types. Thus,
clean up the whole array exec objects to no longer need to be templated
on device.
2021-02-09 19:16:51 -07:00
Kenneth Moreland
0bee744384 Support DeviceAdapterId in deprecated ArrayHandle
The original `ArrayHandle` design had the `PrepareFor*` methods
templated on the device adapter tag. This is no longer necessary (at
least for any existing `ArrayHandle`), so support calling `PrepareFor*`
with a `DeviceAdapterId` that is resolved at runtime.
2021-02-09 19:16:51 -07:00
Kenneth Moreland
c62e38bab6 Make locator exec objects not depend on device type
With recent changes to `ArrayHandle`, the type for the associated array
portal is now the same across all devices. This means that almost all
exec objects no longer need to be specialized on the device types. Thus,
clean up the locator exec objects to no longer need to be templated on
device.
2021-02-09 17:20:57 -07:00
Kenneth Moreland
05fc1747e0 Make deprecated tags more descriptive
Also, test to make sure that the deprecated types are still valid.
2021-02-09 09:45:41 -07:00
Kenneth Moreland
b92566cdd1 Convert std::endl to '\n'
Using `std::endl` has a side effect of flushing the stream, which can
have unintended performance consequences.
2021-02-09 08:53:46 -07:00
Kenneth Moreland
b8b958a98b Get rid of CellSetStructured.hxx
One of the MSVC builds was giving template resolution problems for one
of the methods declared non-inline for no discernable reason. It sounds
like a compiler bug. Rather than try to  work around the issue, just
move the declaration inline.

In fact, all the methods are really small (only 1 or 2 lines). Just
delete the .hxx file and simplify things.
2021-02-08 18:43:31 -07:00
Kenneth Moreland
4d8f05baef Update CellSetExtrude to not specify exec types by device
Somewhere during this edit I removed a header file that didn't strictly
need to be there. This caused me to have to add

```cpp
```

in several places in the code.
2021-02-08 16:57:16 -07:00
Kenneth Moreland
3962e73b06 Fix issues with class specialization
C++ has some weird rules about specializing subclasses.
2021-02-08 14:31:45 -07:00
Kenneth Moreland
c55d15f397 Deprecate ArrayHandle::ExecutionTypes
The newer version of `ArrayHandle` no longer supports different types of
portals for different devices. Thus, the `ReadPortalType` and
`WritePortalType` are sufficient for all types of portals across all
devices.

This significantly simplifies supporting execution objects on devices,
and thus this change also includes many changes to various execution
objects to remove their dependence on the device adapter tag.
2021-02-08 12:17:37 -07:00
dpugmire
b4768f06bd Bug fix. Must copy particles. 2021-02-05 12:17:27 -05:00
dpugmire
4773b51ca3 Debug test fail... 2021-02-05 12:04:24 -05:00
dpugmire
aa713b565f Support for dist-memory pathlines. 2021-02-05 09:40:50 -05:00
Kenneth Moreland
7df5c39358 Remove device template argument from AtomicArrayExecutionObject
The actual code for AtomicArrayExecutionObject does not need to be
specialized by the device. The functionality is implemented by calling
the vtkm::Atomic* methods, which are properly implemented on each
device.
2021-02-04 08:47:28 -07:00
Kenneth Moreland
99e613d377 Avoid conversion warnings in RecombineVec copy
Unfortunately, there is no way to specify when copying `RecombineVec`s
whether we wish to allow precision loss in conversions. Because
sometimes we need them, disable the warnings.
2021-02-03 10:06:12 -07:00
Kenneth Moreland
4c524de625 Fix inverted ArrayCopy arguments
Also fix condition where a `UnknownArrayHandle` destination does not
have an underlying `ArrayHandle` set yet.
2021-02-02 17:34:12 -07:00
Kenneth Moreland
ad7033684f Change ArrayCopy of UnknownArrayHandle to limit types
Rather than copy every type to every other type, only copy for the same
base type or copy to/from FloatDefault. This should reduce the amount of
code generated by a lot.

This reduces the size of the .o for ArrayCopy.cxx on my mac from
21MB to 7.7MB.
2021-02-02 17:33:08 -07:00
Kenneth Moreland
916a01d7b9 Add general ArrayCopy between UnknownArrayHandles
Add an overload of `ArrayCopy` that takes `UnknownArrayHandle`s and
copies them for (almost) any `ArrayHandle` type.

The code uses `CastAndCallWithExtractedArray` to reduce the total number
of copy conditions to about 100, which are all precompiled into the
library. On a debug build on my mac, this creates a .o file of 21MB.
That's not great, but not terrible. Hopefully, this can be used to
consolidate copy implementations elsewhere.
2021-02-02 17:33:08 -07:00
Kenneth Moreland
26ea2ab420 Break circular dependency of ArrayCopy.h and UnknownArrayHandle.h
The circular dependency came from UnknownArrayHandle.h needing
VTKmDefaultTypes.h, which needed all the cell set types. Some of those
cell sets used ArrayCopy in templated functions. Changed those functions
to directly deep copy the ArrayHandle.
2021-02-02 17:33:08 -07:00
Kenneth Moreland
990cc9ecea Test copying UnknownArrayHandle 2021-02-02 17:33:08 -07:00
Kenneth Moreland
76634d167e Merge topic 'deprecate-arrayhandle-shrink'
34412ff29 Deprecate ArrayHandle::Shrink
eb90a6080 Update documentation for Storage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2392
2021-02-01 16:07:22 -05:00
Kenneth Moreland
880d26d60a Add test for UnknownArrayHandle::NewInstanceFloatBasic 2021-02-01 10:24:13 -07:00
Kenneth Moreland
d51fdaddf8 Add UnknownArrayHandle::NewInstanceFloatBasic
This provides the ability to convert an array handle of an unknown value
type to an array handle that has `vtkm::FloatDefault` as its base
component type. Thus subsequently lets you pull the components as
`vtkm::FloatDefault` without having to worry about type conflicts.
2021-02-01 09:34:08 -07:00
Kenneth Moreland
34412ff298 Deprecate ArrayHandle::Shrink
This method has been subsumed by Allocate with vtkm::CopyFlag::On.
2021-02-01 08:07:40 -07:00
Kenneth Moreland
eb90a6080c Update documentation for Storage 2021-01-28 14:37:10 -07:00
Kenneth Moreland
8b133288ce Fix deprecation warnings
There was an error that caused deprecation warnings in VTK-m to be
suppressed, which meant that many uses of deprecated features went
unnoticed. This fixes those deprecation warnings.

The majority of the warnings were caused by the use of the deprecated
`Cast`, `CopyTo`, and `ResetTypes` methods of `UnknownArrayHandle` (or
`VariantArrayHandle`). Both `Cast` and `CopyTo` have been subsumed by
`AsArrayHandle` (to make the functionality more clear). `ResetTypes` now
requires a second template argument to define the storage types to try.

Also fixed some issues with `SerializableField` being deprecated.
This class is no longer necessary because `Field` can now be directly
serialized.
2021-01-26 07:56:39 -07:00
Kenneth Moreland
b085cde358 Fix runaway deprecation suppression
Field.h had a runaway deprecation suppression where the pragmas to
suppress deprecation warnings were turned on but not properly turned
off. This caused deprecation warnings to be turned off for anything
including Field.h (directly or indirectly), and consequently lots of use
of deprecated features went unnoticed.
2021-01-25 15:25:12 -07:00
Kenneth Moreland
3a7ba1d569 Fix deprecation warning in MSVC
MSVC tends to give deprecation warnings in templated methods that are
used with deprecated classes rather than where the deprecated thing was
declared. That makes it annoyingly hard to supress them to implement
support of deprecated items.
2021-01-14 17:01:23 -07:00
Kenneth Moreland
11a4c9867e Change Field to hold UnknownArrayHandle rather than VariantArrayHandle
The `VariantArrayHandle` will soon be deprecated for its replacement of
`UnknownArrayHandle`. Thus, `Field` and related classes should start
using the new `UnknownArrayHandle`.
2021-01-14 17:01:22 -07:00
Kenneth Moreland
a6edc832da Merge topic 'soa-array-default'
cecd81d5d Add types appropriate for Ascent
865855ea0 Add changelog for making ArrayHandleSOA a default array
50ff9c22a Add support of `ArrayHandleSOA` as a default storage type
bc09a9cd1 Add precompiled versions of `ArrayRangeCompute` for `ArrayHandleSOA`
77f9ae653 Support `ArrayHandleSOA` only for `Vec` value types

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2349
2021-01-14 12:40:58 -05:00
Kenneth Moreland
7a3f20560a Merge topic 'switch-to-new-arrayhandle'
3228752b2 Fix error message when using deprecated storage
5ef4e7eee Make new style of ArrayHandle the expected style

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2375
2021-01-14 10:14:20 -05:00
Kenneth Moreland
9ed68f5a42 Add default copy constructor for RecombineVec
Some compilers complain if the copy constructor is not explicitly
specified.
2021-01-13 09:19:34 -07:00
Kenneth Moreland
66fbc99b09 Disable ArrayHandleCounting for invalid value types
`ArrayHandleCounting` only works with values that support basic
arithmetic. The concept of counting makes little sense for types that
are not well defined for addition and multiplication like `bool`,
`string` and other custom types.
2021-01-13 09:19:34 -07:00
Kenneth Moreland
0b2dbfdda1 Fix ICE in GCC 4.8 2021-01-13 09:19:34 -07:00
Kenneth Moreland
50d9320135 Add missing types to serialization of UnknownArrayHandle 2021-01-13 09:19:34 -07:00
Kenneth Moreland
ab9c0f7248 Add arithmetic assignment operators to RecombineVec
`RecombineVec` is the class used as the value type for
`ArrayHandleRecombineVec`. It is a `Vec`-like object, but has several
limitations (including arithmetic operators like `+` won't work).
Arithmetic assignment operators are useful so you don't have to create
impossible intermediate values.
2021-01-13 09:19:34 -07:00
Kenneth Moreland
06c59fed13 Update MapFieldMergeAverage/Permuation to use new CastAndCall
These functions now use
`UnknownArrayHandle::CastAndCallWithExtractedArray` to reduce the number
of times the worklet is run.
2021-01-13 09:19:33 -07:00
Kenneth Moreland
f90c2bfd0b Add UnknownArrayHandle::CastAndCallWithExtractedArray
This provides a convenience for calling a function for most
`ArrayHandle` types.
2021-01-13 09:19:33 -07:00
Kenneth Moreland
97324e75cd Enable reinterpreting UnknownArrayHandle to compatible C types
The base C types have several "duplicate" types that the compiler
considers different even though the byte representation is the same. For
example, `char` and `signed char` have the same meaning but are treated
as different types. Likewise, 'long', 'int', and 'long long' are all
different types even though 'long' is the same as either 'int' or 'long
long'.

When pulling extracted components from `UnknownArrayHandle`, there is
little value for creating multiple code paths for types like `char` and
`signed char`. Instead, allow implicit conversion among these types.
2021-01-13 09:19:27 -07:00
Kenneth Moreland
3228752b2d Fix error message when using deprecated storage
When using the old style of storage, you need to declare it as the old
style so that a bridge to the new style can be built in. You get a
compile error message if this is not done. The previous message gave the
wrong instructions.
2021-01-12 07:18:08 -07:00
Kenneth Moreland
5ef4e7eeee Make new style of ArrayHandle the expected style
What was previously declared as `ArrayHandleNewStyle` is now just the
implementation of `ArrayHandle`. The old implementation of `ArrayHandle`
has been moved to `ArrayHandleDeprecated`, and `ArrayHandle`s still
using this implementation must declare `VTKM_ARRAY_HANDLE_DEPRECATED` to
use it.
2021-01-12 07:17:53 -07:00
Kenneth Moreland
b4ca18607c Merge topic 'recombine-vec-array'
f941cb607 Move Fetch specializations to vtkm/exec/arg
439c18cfc Add changedoc for ArrayHandleRecombineVec
9833f3d0d Fix issue with using recombined vec as an output array
7dd9b4252 Add UnknownArrayHandle::ExtractArrayFromComponents
755af739e Add ArrayHandleRecombineVec

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2372
2021-01-11 13:50:57 -05:00
Kenneth Moreland
f941cb607c Move Fetch specializations to vtkm/exec/arg
Some of the special `ArrayHandle`s require specialized versions of
`vtkm::exec::arg::Fetch`. The specializations were not put in the
respective vtkm/exec/arg/Fetch*.h header files because the definition of
the `ArrayHandle`s was not available there. The implementation was in
the ArrayHandle*.h files, but it is hard to find the specialization
there.

Instead, make a secondary header file in vtkm/exec/arg that implements
the Fetch specialization and include it from the ArrayHandle*.h file.
That way, the basic Fetch does not have to include odd `ArrayHandle`
types but the `Fetch` implemenations are still all located together.
2021-01-11 10:47:58 -07:00
Sujin Philip
4fac642273 Merge topic 'kokkos-opt-scan'
e57f5a175 Fix DeviceAdapterAlgorithmGeneral Reduce
1b7fc3d3e Use `Kokkos::parallel_scan` for Scan functionality

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2360
2021-01-08 10:33:12 -05:00
Sujin Philip
e57f5a175d Fix DeviceAdapterAlgorithmGeneral Reduce
It was using `ArrayHandleImplicit` in an unsupported manner.
2021-01-07 16:24:53 -05:00
Sujin Philip
1b7fc3d3e4 Use Kokkos::parallel_scan for Scan functionality 2021-01-07 16:24:39 -05:00
Kenneth Moreland
d91b4f3568 Undeprecate UnknownArrayHandle::GetNumberOfComponents
This method was originally deprecated to avoid confusion with the
indexing of the components in `ExtractComponent`. However, there might
be good reason to want to know the non-flat number of components, so
maybe getting rid of it is not a great idea. Unmark the method as
deprecated, at least for now.
2021-01-07 09:48:25 -07:00
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