Commit Graph

7958 Commits

Author SHA1 Message Date
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
Kenneth Moreland
c907ce6419 Merge topic 'new-arrayhandle-macro'
b526c4c91 Make VTKM_ARRAY_HANDLE_NEW_STYLE macro

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2237
2020-08-25 21:59:07 -04:00
Kenneth Moreland
b526c4c914 Make VTKM_ARRAY_HANDLE_NEW_STYLE macro
While in the transition between two types of `ArrayHandle`
implementations, we need to declare when an `ArrayHandle` is implemented
with the new style. To consolidate, create a
`VTKM_ARRAY_HANDLE_NEW_STYLE` to override the default `ArrayHandle`
implementation with the `ArrayHandleNewStyle` implementation.
2020-08-25 13:02:19 -06:00
Dave Pugmire
83f792b64c Merge topic 'tossMemstream2'
2351e4775 Add particle messenger test.
c9041ec41 Add unit test for particle messenger.
63b31ffb2 Replace MemStream with the diy serialization code.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2236
2020-08-25 14:55:03 -04:00
Dave Pugmire
2351e4775d Add particle messenger test. 2020-08-25 11:49:59 -04:00
Dave Pugmire
c9041ec41a Add unit test for particle messenger. 2020-08-25 11:39:14 -04:00
Dave Pugmire
63b31ffb24 Replace MemStream with the diy serialization code. 2020-08-25 11:38:01 -04:00
Kenneth Moreland
cdc41cc987 Merge topic 'vtk-test-files-in-repo'
a8fa14335 Move UnitTestVTKDataSetReader files to git-lfs
571aa9f3d Simplify getting test file names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2234
2020-08-25 11:27:07 -04:00
Kenneth Moreland
82f2e37959 Merge topic 'conversion-warning'
b5ed6e725 Fix some conversion warnings

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

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

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

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2218
2020-08-25 07:53:37 -04:00
Kenneth Moreland
6f6d4dd3df Merge topic 'arrayhandlesoa-use-buffer'
9941db6df Convert ArrayHandleSOA to use Buffer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2211
2020-08-24 21:52:23 -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
Ben Boeckel
16abba7136 Merge topic 'clang-format-9-real'
cf0cdcf7d clang-format: reformat the repository with clang-format-9

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2233
2020-08-24 14:31:38 -04:00
Kitware Robot
cf0cdcf7d1 clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Ben Boeckel
1ea2e77ec2 Merge topic 'clang-format-9'
af7567342 clang-format: reformat the repository with clang-format-9
72f76d235 clang-format: update configuration for 9.0

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2216
2020-08-24 13:56:57 -04:00
Kitware Robot
af75673424 clang-format: reformat the repository with clang-format-9 2020-08-24 11:47:55 -04:00
Ben Boeckel
72f76d2355 clang-format: update configuration for 9.0 2020-08-24 11:47:55 -04:00
Robert Maynard
db3b281da3 Merge topic 'correct_clang_cuda_warnings'
b48c19f25 Correct warnings found by using clang as the host compiler for cuda

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !2232
2020-08-24 10:01:47 -04:00
Robert Maynard
b48c19f251 Correct warnings found by using clang as the host compiler for cuda 2020-08-24 08:57:38 -04:00
Kenneth Moreland
0370029f92 Merge topic 'free-atomic-functions'
6cbcb9f5d Fix behavior of Cuda AtomicLoad with SequentiallyConsistent
7573d4ed5 Fix compiler warnings
147dd24d0 Remove ARM intrinsics in MSVC
2229c22f4 Avoid invalid Kokkos atomic calls
3b147878f Always use our implementation of Cuda atomics
9e6fe8fb6 Add memory order semantics to atomic functions
d2ac4b860 Be more careful in casting with Atomic functions
13056b3af Deprecate AtomicInterfaceControl and AtomicInterfaceExecution
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2223
2020-08-22 00:21:01 -04:00
Vicente Bolea
42009394fc Merge topic 'fix-xl-warnings'
e3d734708 IBM XL: disable unused-template pragma for xl

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2230
2020-08-21 17:36:52 -04:00
Vicente Adolfo Bolea Sanchez
e3d7347080 IBM XL: disable unused-template pragma for xl
Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-08-21 15:40:05 -04:00
Robert Maynard
111ff949d9 Merge topic 'VTKmConfig_only_modify_non_aliased_targets'
1d6d81292 VTKmConfig: Only modify vtkm::cuda when it is an installed target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2231
2020-08-21 13:31:15 -04:00
Robert Maynard
6db300ce77 Merge topic 'updates_to_gitlabci'
c73bc0a93 CI: add clang+cuda and correct missing cuda packages on centos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2229
2020-08-21 12:03:47 -04:00
Robert Maynard
1d6d812922 VTKmConfig: Only modify vtkm::cuda when it is an installed target 2020-08-21 11:59:24 -04:00
Robert Maynard
c73bc0a93f CI: add clang+cuda and correct missing cuda packages on centos 2020-08-21 08:31:27 -04:00
Kenneth Moreland
6cbcb9f5d7 Fix behavior of Cuda AtomicLoad with SequentiallyConsistent
According to Allie Vacanti, a sequentially consistent load requires a
full fence on Cuda hardware to be conforming.

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

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

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

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

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

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

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

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

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

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

That can be a big hassle (and is problematic for some code structure).
Instead, these methods are moved to free functions in the `vtkm`
namespace. These functions operate like those in `Math.h`. Using
compiler directives, an appropriate version of the function is compiled
for the current device the compiler is using.
2020-08-20 13:40:43 -06:00
Robert Maynard
14333ded1b Merge topic 'update_to_support_CMAKE_CUDA_ARCHITECTURES'
96fc02ebc VTK-m when using CMake 3.18 can propagate cuda flags cleanly

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2149
2020-08-20 14:02:09 -04:00
Robert Maynard
96fc02ebca VTK-m when using CMake 3.18 can propagate cuda flags cleanly 2020-08-20 13:12:05 -04:00
Robert Maynard
074c8b1100 Merge topic 'properly_suppress_warning_when_using_clang_as_cuda_compiler'
78a663102 Correct cuda compiler flag ordering for clang as CUDA host compiler

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2226
2020-08-20 10:04:13 -04:00
Robert Maynard
78a6631026 Correct cuda compiler flag ordering for clang as CUDA host compiler 2020-08-20 08:34:23 -04:00
Vicente Bolea
1b0de59ffd Merge topic 'fix-501-windows-library-limit'
afd394377 cmake: split vtkm_filter into common|extra|contour|gradient

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2186
2020-08-19 20:45:52 -04:00
Vicente Adolfo Bolea Sanchez
afd394377e cmake: split vtkm_filter into common|extra|contour|gradient
There is a limitation in Windows builds using VS2019 where libraries cannot be
bigger than 4GiB. This is normally not an issue but in `VTKm` due to its strong
template usage libraries can reach that size.

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

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

The proposal scheme is:

It splits vtkm-filter into:

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

Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-08-19 19:20:43 -04:00
Robert Maynard
62c2938b0e Merge topic 'make_sure_cuda_kokkos_builds_use_sccache'
da1fec67b Kokkos CUDA builds now use sccache for CUDA compilation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2222
2020-08-19 11:56:14 -04:00