Commit Graph

227 Commits

Author SHA1 Message Date
Kenneth Moreland
e05588a199 Add changelog for Tuple 2020-03-16 17:12:17 -06:00
Kenneth Moreland
5773ea3e13 Add porting layer for future std features
Currently, VTK-m is using C++11. However, it is often useful to use
features in the `std` namespace that are defined for C++14 or later. We
can provide our own versions (sometimes), but it is preferable to use
the version provided by the compiler if available.

There were already some examples of defining portable versions of C++14
and C++17 classes in a `vtkmstd` namespace, but these were sprinkled
around the source code.

There is now a top level `vtkmstd` directory and in it are header files
that provide portable versions of these future C++ classes. In each
case, preprocessor macros are used to select which version of the class
to use.
2020-03-16 17:12:16 -06:00
Kenneth Moreland
10e8a4a7f9 Remove locking control ArrayPortals
Previously, when a ReadPortal or a WritePortal was returned from an
ArrayHandle, it had wrapped in it a Token that was attached to the
ArrayHandle. This Token would prevent other reads and writes from the
ArrayHandle.

This added safety in the form of making sure that the ArrayPortal was
always valid. Unfortunately, it also made deadlocks very easy. They
happened when an ArrayPortal did not leave scope immediately after use
(which is not all that uncommon).

Now, the ArrayPortal no longer locks up the ArrayHandle. Instead, when
an access happens on the ArrayPortal, it checks to make sure that
nothing has happened to the data being accessed. If it has, a fatal
error is reported to the log.
2020-03-16 07:10:10 -06:00
Vicente Adolfo Bolea Sanchez
9d0da855b3 ConvertNumComponentsToOffsets using ScanExtented vs. ScanExclusive
This commit also:
- Removes a corner case not longer used at ArrayPortalGroupVecVariable::get
- Changes doc regarding the number of offset elements in the input
  array handler of ConvertNumComponentsToOffsets.
- Updates invokation of make_ArrayGroupVectVariable in multiple files
- Adds its corresponding changelog entry
2020-03-05 10:57:34 -05:00
Robert Maynard
aa820aecc3 Add changelog for mask and scatter 3d scheduling support 2020-02-27 08:25:54 -05:00
Kenneth Moreland
6b089be03e Add ArrayPortalToken object and implement Read/WritePortal
To get a portal to access ArrayHandle values in the control
environment, you now use the ReadPortal and WritePortal methods.
The portals returned are wrapped in an ArrayPortalToken object
so that the data between the portal and the ArrayHandle are
guaranteed to be consistent.
2020-02-26 13:10:37 -07:00
Kenneth Moreland
1149a0f7fb Add change log for scoping tokens 2020-02-25 09:39:26 -07:00
Robert Maynard
7a6430e3d8 Add CODEOWNERS to vtk-m to improve merge request reviewer suggestions 2020-02-11 12:53:07 -05:00
Allison Vacanti
539f6e5ad7 Port benchmarking framework to Google Benchmark. 2020-01-08 10:58:51 -05:00
Kenneth Moreland
4a52a3f7a9 Shorter StorageTag for ArrayHandleZip 2020-01-07 07:01:34 -07:00
Kenneth Moreland
4a626b2e93 Shorter storage tag for ArrayHandleView 2020-01-07 07:01:13 -07:00
Kenneth Moreland
4c8c28d1f1 Shorter storage tag for ArrayHandleReverse
Also discovered that many C++ compilers have trouble giving warnings
for partial specialization of classes marked as deprecated. Fix
the problem by instead deprecating the items in the class.
2020-01-07 07:01:12 -07:00
Kenneth Moreland
1ec716e5d2 Shorten storage tag for ArrayHandlePermutation 2020-01-07 07:01:10 -07:00
Kenneth Moreland
ca0ad1dc22 Shorten storage tag for ArrayHandleIndex 2020-01-07 07:01:10 -07:00
Kenneth Moreland
7bd5802dd8 Shorter storage tag for ArrayHandleGroupVecVariable 2020-01-07 07:01:09 -07:00
Kenneth Moreland
74df1b3857 Shorten storage tag for ArrayHandleGroupVec 2020-01-07 07:01:08 -07:00
Kenneth Moreland
1f5846b49e Shorten storage tag for ArrayHandleCounting 2020-01-07 07:01:07 -07:00
Kenneth Moreland
31898fd887 Shorten tag name for ArrayHandleConstant 2020-01-07 07:01:06 -07:00
Kenneth Moreland
b2f07511fb Shorten storage tags for ArrayHandleConcatenate 2020-01-07 07:01:05 -07:00
Kenneth Moreland
2688fc7d50 Shorten tag name for ArrayHandleCompositeVector 2020-01-07 07:01:05 -07:00
Kenneth Moreland
8516fa7ac6 Shorten tag name for ArrayHandleCartesianProduct 2020-01-07 07:01:04 -07:00
Kenneth Moreland
591d1ba264 Make ArrayHandleUniformPointCoordinates storage type shorter 2020-01-07 07:01:03 -07:00
Kenneth Moreland
944a3c4c14 Make ArrayHandleCast storage type shorter 2020-01-07 07:00:55 -07:00
Allison Vacanti
07283f74c1 Merge topic 'binary_search_algorithms'
44c4f0838 Add vtkm/Algorithms.h header with device-friendly binary search algorithms.
6d4e37e95 Fix brigand for CUDA 10.2.
84eedc885 Make BinaryOperators/Predicates more flexible.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1920
2019-12-26 10:48:21 -05:00
Allison Vacanti
88bf38afe2 Add support for ArrayHandleDecorator resizing.
Fixes #428.
2019-12-20 17:03:36 -05:00
Allison Vacanti
44c4f0838f Add vtkm/Algorithms.h header with device-friendly binary search algorithms. 2019-12-20 12:35:10 -05:00
Allison Vacanti
813f5a422f Fixup custom portal iterator logic.
The convenience functions `ArrayPortalToIteratorBegin()` and
`ArrayPortalToIteratorEnd()` wouldn't detect specializations of
`ArrayPortalToIterators<PortalType>` since the specializations aren't
visible when the `Begin`/`End` functions are declared.

Since the CUDA iterators rely on a specialization, the convenience
functions would not compile on CUDA.

Now, instead of specializing `ArrayPortalToIterators` to provide custom
iterators for a particular portal, the portal may advertise custom
iterators by defining `IteratorType`, `GetIteratorBegin()`, and
`GetIteratorEnd()`. `ArrayPortalToIterators` will detect such portals
and automatically switch to using the specialized portals.

This eliminates the need for the specializations to be visible to the
convenience functions and allows them to be usable on CUDA.
2019-12-17 15:39:51 -05:00
Kenneth Moreland
80d2948300 Add List changelog 2019-12-04 17:21:32 -07:00
Kenneth Moreland
9ff1f5d8a9 Merge topic 'deprecation'
f62b50259 Refactor deprecated macros
fec1c4995 Re-enable Visual Studio warning 4996
ed4d0d50c Add VTKM_DEPRECATED macro

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !1902
2019-12-04 09:01:17 -05:00
Kenneth Moreland
f62b50259e Refactor deprecated macros
Previously we relied on CMake's compiler detection module to build the
macros for using the deprecated attribute. However, CMake created macros
for pre-C++14 versions of the feature, which do not work in all cases.
Also, we have the need to be able to suppress deprecation warnings when
we are implementing a deprecated thing. Since we have to query compilers
ourself, we might as well figure out if the deprecated attribute we want
is supported.

Worst case is that we won't support deprecation warnings everywhere we
could. That will not create incorrect code and we can always add that
later.
2019-11-06 14:47:59 -07:00
Kenneth Moreland
ed4d0d50c3 Add VTKM_DEPRECATED macro
The `VTKM_DEPRECATED` macro allows us to remove (and usually replace)
features from VTK-m in minor releases while still following the conventions
of semantic versioning. The idea is that when we want to remove or replace
a feature, we first mark the old feature as deprecated. The old feature
will continue to work, but compilers that support it will start to issue a
warning that the use is deprecated and should stop being used. The
deprecated features should remain viable until at least the next major
version. At the next major version, deprecated features from the previous
version may be removed.
2019-11-06 09:58:53 -07:00
Kenneth Moreland
5676cd1758 Add changelog for ListTagRemoveIf 2019-11-02 11:08:34 -06:00
Robert Maynard
552d473496 Initial documentation on how to cut a VTK-m release 2019-10-17 09:16:57 -04:00
Robert Maynard
3c54de5fdb Add release notes for v1.5.0 2019-10-15 13:40:46 -04:00
Robert Maynard
c3f0060cc5 ExecutionSignatures are now optional for simple worklets
If a worklet doesn't explicitly state an ExecutionSignature, VTK-m
assumes the worklet has no return value, and each ControlSignature
argument is passed to the worklet in the same order.

For example if we had this worklet:
```cxx
struct DotProduct : public vtkm::worklet::WorkletMapField
{
  using ControlSignature = void(FieldIn, FieldIn, FieldOut);
  using ExecutionSignature = void(_1, _2, _3);

  template <typename T, vtkm::IdComponent Size>
  VTKM_EXEC void operator()(const vtkm::Vec<T, Size>& v1,
                            const vtkm::Vec<T, Size>& v2,
                            T& outValue) const
  {
    outValue = vtkm::Dot(v1, v2);
  }
};
```

It can be simplified to be:

```cxx
struct DotProduct : public vtkm::worklet::WorkletMapField
{
  using ControlSignature = void(FieldIn, FieldIn, FieldOut);

  template <typename T, vtkm::IdComponent Size>
  VTKM_EXEC void operator()(const vtkm::Vec<T, Size>& v1,
                            const vtkm::Vec<T, Size>& v2,
                            T& outValue) const
  {
    outValue = vtkm::Dot(v1, v2);
  }
};
2019-10-08 11:14:11 -04:00
Allison Vacanti
3886b7dfb8 Refactor CellSetExplicit to remove NumIndices.
See #408 for details.
2019-09-30 12:27:13 -04:00
Robert Maynard
8520d70e0d Compile most frequently used VTK-m filters into a library
VTK-m now provides the following filters with the default policy
as part of the vtkm_filter library:
  - CellAverage
  - CleanGrid
  - ClipWithField
  - ClipWithImplicitFunction
  - Contour
  - ExternalFaces
  - ExtractStructured
  - PointAverage
  - Threshold
  - VectorMagnitude

By building these as a library we hope to provide faster compile
times for consumers of VTK-m when using common configurations.
2019-09-18 12:06:13 -04:00
Allison Vacanti
024b8a3067 Fix formatting of CodingConventions.md.
The current page has some issue:

https://gitlab.kitware.com/vtk/vtk-m/blob/master/docs/CodingConventions.md
2019-09-12 15:16:30 -04:00
Li-Ta Lo
d8cbc990f5 Merge topic 'tangle_source'
05b679250 Merge branch 'master' into tangle_source
a6c044df9 added changelog
0d818701c put VTKM_SOURCE_EXPORT in .cxx
e0aae7d86 remove EXPORT from .cxx
4d7de67ee use VTKM_SOURCE_EXPORT
cd49136d5 add copyright notice, add installation of header
0c094a568 used the Tangle source
aeb8877a9 add newline at EOF, minor change based review
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1804
2019-09-12 11:18:52 -04:00
Robert Maynard
fc28908788 Merge topic 'vtkm_supports_dropping_unused_symbols'
1bfcce19d VTK-m builds with separate function sections to allow smaller binaries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti <allison.vacanti@kitware.com>
Merge-request: !1831
2019-09-11 15:12:36 -04:00
Allison Vacanti
f8c60bd958 Merge topic '412_ArrayHandleDecorator'
885cce391 Add ArrayPortalDecorator.
29ea46fa5 Refactor IsWritableArrayHandle to use PortalSupportsSets.
dc98517b9 Clean up ArrayHandleCounting.
0dad55a04 Remove return statements in functions that return void.
abdd458b8 Remove unused member variable in Algorithm functor.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !1828
2019-09-11 14:34:57 -04:00
Li-Ta Lo
05b6792500 Merge branch 'master' into tangle_source 2019-09-11 12:06:58 -06:00
Robert Maynard
1bfcce19dd VTK-m builds with separate function sections to allow smaller binaries
Consumers of VTK-m when enabling of dropping of unused functions
will see VTK-m functions dropped. Previously this didn't happen
as VTK-m didn't build object files with the correct flags for this.

By allowing the linker to remove unused symbols we see a significant
saving the file size of VTK-m tests, examples, and benchmarks.
An OpenMP build of the tests and benchmarks goes from 168MB to
141MB which is roughly a 16% filesize reduction.

Initially I had presumed that these changes would increase link times.
But in measurements the total wall time for compilation of VTK-m has
stayed about the same ( seeing a decrease of 1.5% ). Presumably the
increased computation is offset by the reduction in file writing.
2019-09-11 13:34:25 -04:00
Allison Vacanti
885cce3914 Add ArrayPortalDecorator. 2019-09-11 12:50:59 -04:00
Li-Ta Lo
a6c044df9a added changelog 2019-09-11 10:19:54 -06:00
Robert Maynard
e37c2061cf vtkm_add_target_information now supports multiple targets
Instead of having to be called for each target you can now
pass multiple targets at once. Do note that if you pass multiple
targets you will need to pass all the sources from those targets
that need to be 'device' compiled.
2019-09-11 09:17:52 -04:00
Kenneth Moreland
6c136b978e Remove vtkm::BaseComponent
This functionality has been superseded by VecTraits::BaseComponentType.
The new functionality also supports replacing the BaseComponentType.
2019-09-09 13:01:03 -06:00
Kenneth Moreland
07c59fcf72 Update filters with secondary fields to use new policy method
Rather than do a CastAndCall on all possible field types when calling a
worklet with two fields (where they all typically get cast to the same
type as the primary field), use the new mechanism with
ArrayHandleMultiplexer to create one code path.

Also update the ApplyPolicy to accept the Field type, which is used to
determine any additional storage types to support.
2019-09-09 08:19:16 -06:00
Kenneth Moreland
3039a18baf Add ability to get an array from a Field for a particular type
This is done through a new version of ApplyPolicy. This version takes
a type of the array as its first template argument, which must be
specified.

This requires having a list of potential storage to try. It will use
that to construct an ArrayHandleMultiplexer containing all potential
types. This list of storages comes from the policy. A StorageList
item was added to the policy.

Types are automatically converted. So if you ask for a vtkm::Float64 and
field contains a vtkm::Float32, it will the array wrapped in an
ArrayHandleCast to give the expected type.
2019-09-09 08:19:15 -06:00
Kenneth Moreland
6323d6803e Add recursive component queries to VecTraits
Added a BaseComponentType to VecTraits that recursively finds the base
(non-Vec) type of a Vec. This is useful when dealing with potentially
nested Vec's (e.g. Vec<Vec<T, M>, N>) and you need to keep the structure
but know the base type.

Also added a couple of templates for keeping the structure but changing
the type. These are ReplaceComponentType and ReplaceBaseComponentType.
These allow you to create new Vec's with the same structure as the query
Vec but with differen component types.
2019-09-09 08:19:15 -06:00