Commit Graph

172 Commits

Author SHA1 Message Date
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
Kitware Robot
cf0cdcf7d1 clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04: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
NAThompson
46faf574fa ReadPortal().Get(idx) is slow in a loop. 2020-05-08 11:30:59 -04:00
Kenneth Moreland
ec34cb56c4 Use new ways to get array portal in control environment
Also fix deadlocks that occur when portals are not destroyed
in time.
2020-02-26 13:10:46 -07:00
Allison Vacanti
3eb91af961 Use ArrayGetValue where possible in worklets.
Replace code such as `myArray.GetPortalControl().Get(0)` with
`vtkm::cont::ArrayGetValue(0, myArray)`, which will just retrieve
the single value without transferring the entire contents of
`myArray` to the host. This should prevent memory thrashing.

Also did some general style clean-ups and fixed loops that called
`GetPortalControl` in the loop body.
2019-08-22 16:42:17 -04:00
Robert Maynard
c7f8275818 Correct signed to unsigned warning conversion found by clang-8 2019-06-19 08:36:19 -04:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Haocheng LIU
415252c662 Introduce asynchronous and device independent timer
The timer class now is asynchronous and device independent. it's using an
similiar API as vtkOpenGLRenderTimer with Start(), Stop(), Reset(), Ready(),
and GetElapsedTime() function. For convenience and backward compability, Each
Start() function call will call Reset() internally and each GetElapsedTime()
function call will call Stop() function if it hasn't been called yet for keeping
backward compatibility purpose.

Bascially it can be used in two modes:

* Create a Timer without any device info. vtkm::cont::Timer time;

  * It would enable timers for all enabled devices on the machine. Users can get a
specific elapsed time by passing a device id into the GetElapsedtime function.
If no device is provided, it would pick the maximum of all timer results - the
logic behind this decision is that if cuda is disabled, openmp, serial and tbb
roughly give the same results; if cuda is enabled it's safe to return the
maximum elapsed time since users are more interested in the device execution
time rather than the kernal launch time. The Ready function can be handy here
to query the status of the timer.

* Create a Timer with a device id. vtkm::cont::Timer time((vtkm::cont::DeviceAdapterTagCuda()));

  * It works as the old timer that times for a specific device id.
2019-02-05 12:01:56 -05:00
Kenneth Moreland
2e426ad547 Run the update-control-signature-tags.sh script 2019-01-11 12:23:10 -07:00
Haocheng LIU
8859636672 Merge worklet testing executables into a device dependent shared library
VTK-m has been updated to replace old per device worklet testing executables with a device
dependent shared library so that it's able to accept a device adapter
at runtime.
Meanwhile, it updates the testing infrastructure APIs. vtkm::cont::testing::Run
function would call ForceDevice when needed and if users need the device
adapter info at runtime, RunOnDevice function would pass the adapter into the functor.

Optional Parser is bumped from 1.3 to 1.7.
2018-11-23 10:13:56 -05:00
Kenneth Moreland
d879188de0 Make DispatcherBase invoke using a TryExecute
Rather than force all dispatchers to be templated on a device adapter,
instead use a TryExecute internally within the invoke to select a device
adapter.

Because this removes the need to declare a device when invoking a
worklet, this commit also removes the need to declare a device in
several other areas of the code.
2018-08-29 19:18:54 -07:00
luz.paz
940c891886 Misc. typos
Found via `codespell` and `grep`
more typos

includes source typo change and a typo that needs further review
follow-up typos


Follow-up typos


Revert a commit
2018-06-14 16:49:11 -04:00
Allison Vacanti
93506d25e2 Change function signatures to use 'using' aliases.
Also cleaned up some lingering type typedefs.
2018-05-25 17:18:41 -04:00
Robert Maynard
b56894dd09 Move VTK-m Cuda backend over to a grid-stride iteration pattern.
This allows for easier host side logic when determining grid and block
sizes, and allows for a smaller library side by moving some logic
into compiled in functions.
2018-04-30 17:29:26 -04:00
Robert Maynard
4b9a8143c8 Correct 'may be used uninitialized in this function' warnings in wavelets 2018-04-24 13:27:51 -04:00
Robert Maynard
da45e81d9b Make sure that WaveletTransform doesn't emit maybe-uninitialized warnings 2018-04-17 14:24:19 -04:00
Robert Maynard
e630ac5aa4 Merge branch 'master' into vtk-m-cmake_refactor 2018-02-23 14:52:00 -05:00
Robert Maynard
182f4707e7 vtkm prefers 'using' over typedef. 2018-02-23 10:47:20 -05:00
Robert Maynard
022c987182 Correct warnings and errors found with MSVC2017+CUDA9 2018-01-31 15:58:45 -05:00
luz.paz
80b11afa24 Misc. typos
Found via `codespell -q 3` via downstream VTK
2018-01-30 06:51:47 -05:00
Robert Maynard
311618a15f Enable highest level of warnings(W4) under MSVC
This will make VTK-m warning level match the one used by VTK. This commit
also resolves the first round of warnings that W4 exposes.
2017-09-22 13:04:28 -04:00
Kenneth Moreland
c3a3184d51 Update copyright for Sandia
Sandia National Laboratories recently changed management from the
Sandia Corporation to the National Technology & Engineering Solutions
of Sandia, LLC (NTESS). The copyright statements need to be updated
accordingly.
2017-09-20 15:33:44 -06:00
Robert Maynard
5dd346007b Respect VTK-m convention of parameters all or nothing on a line
clang-format BinPack settings have been disabled to make sure that the
VTK-m style guideline is obeyed.
2017-05-26 13:53:28 -04:00
Kitware Robot
4ade5f5770 clang-format: apply to the entire tree 2017-05-25 07:51:37 -04:00
Kitware Robot
cbd918b43d worklet/wavelet: fix whitespace issues 2017-05-22 16:47:54 -04:00
Robert Maynard
206556916d Merge topic 'support_3DWavelet_compression'
fecc2e97 code style improvements
7782ff47 Take off a few debug statements; replaced tabs with spaces
3e4095f4 WaveletDWT.h
c4853885 eliminate another warning
d4deced5 get rid of some asserts used for debugging
98cf7f8d got rid of unused variable warnings
33de20da fix print type warnings
7d123455 remove my own note
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !765
2017-05-22 14:01:03 -04:00
Samuel Li
fecc2e976d code style improvements 2017-05-18 11:51:35 -06:00
Kitware Robot
efbde1d54b clang-format: sort include directives 2017-05-18 12:59:33 -04:00
Samuel Li
7782ff471b Take off a few debug statements; replaced tabs with spaces 2017-05-16 15:28:10 -06:00
Samuel Li
3e4095f43e WaveletDWT.h 2017-05-16 15:11:42 -06:00
Samuel Li
c4853885fc eliminate another warning 2017-05-11 12:02:49 -06:00
Samuel Li
d4deced5bf get rid of some asserts used for debugging 2017-05-11 11:56:20 -06:00
Samuel Li
98cf7f8d2d got rid of unused variable warnings 2017-05-11 11:47:51 -06:00
Samuel Li
5510fe61cf no warnings on macs either. fixed a few formalities 2017-05-10 22:51:52 -06:00
Samuel Li
a73bc25939 finish all tests in serial mode 2017-05-09 23:02:51 -06:00
Samuel Li
6c1be79779 pass test on all 1 level DWT/IDWT cases 2017-04-20 11:13:25 -06:00
Samuel Li
a9bf6d9402 better naming 2017-04-19 18:32:51 -06:00
Samuel Li
0f69a0b45e fix an indexing bug 2017-04-19 18:32:10 -06:00
Samuel Li
b619967d69 sync to debug 2017-04-14 17:15:17 -06:00
Samuel Li
f11c1bf928 change new error handling 2017-04-14 14:14:09 -06:00
Samuel Li
fad49bdf80 Merge branch 'master' of gitlab.kitware.com:samuelli/vtk-m 2017-04-14 14:05:40 -06:00
Samuel Li
1179007f05 fix typo 2017-04-14 14:05:36 -06:00
Samuel Li
eaee6c3e4b merge from the latest 2017-04-14 14:00:16 -06:00
Samuel Li
0175ee7a65 sync to debug 2017-04-14 10:42:55 -06:00
Samuel Li
10be50059c sync to debug on another machine 2017-04-13 18:25:14 -06:00
David C. Lonie
fd0e3e0e3e Remove vtable from WaveletFilter.
This header-only class had a virtual destructor, but no other virtual
methods or subclasses.
2017-04-13 14:08:27 -04:00
Samuel Li
14a94e7886 fix a typo; sync to test 2017-04-06 17:57:40 -06:00
Samuel Li
85d09a55d8 add a flag to facilitate testing 2017-03-08 19:29:27 -08:00
Samuel Li
ae3daecdcf Merge branch 'master' of gitlab.kitware.com:samuelli/vtk-m 2017-02-27 21:56:19 -08:00