Commit Graph

95 Commits

Author SHA1 Message Date
Robert Maynard
48dc6509f8 Merge topic 'remove_usage_of_reserved_names'
8114e9e62 VTK-m now doesn't use reserved C++ identifiers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti <allison.vacanti@kitware.com>
Merge-request: !1564
2019-03-04 15:25:25 -05:00
Kenneth Moreland
68b2e5e65c Add move constructors to ArrayHandle subclasses
There is a test to ensure that basic VTK-m classes have proper move
constructors that do not throw exceptions. Some of these are subclasses
of ArrayHandle. Add these move constructors to the
VTK_M_ARRAY_HANDLE_SUBCLASS macros so they get automatically added.
2019-03-01 15:50:16 -07:00
Allison Vacanti
d1db4ef8b3 Clarify intent of TypeString and TypeName functions.
TypeName is used for logging, and is now TypeToString.

TypeString is used for serialization, and is now SerializableTypeString.
2019-03-01 11:47:53 -05:00
Robert Maynard
8114e9e627 VTK-m now doesn't use reserved C++ identifiers
Fixes #340
2019-02-28 15:08:08 -05:00
Robert Maynard
ad98d818ce VTK-m now doesn't clobber external DIY installations
Fixes #334
2019-02-05 13:05:14 -05:00
Robert Maynard
1f86878f78 Make the ArrayHandle move constructors noexcept.
std::containers only activate fast emplace operations if the
T types move operators are noexcept
2018-10-23 16:21:05 -04:00
Sujin Philip
fd89dfc89b Add ArrayHandle Serialization 2018-09-25 13:58:39 -04:00
Allison Vacanti
b124984817 Rename Undefined and Any DeviceAdapterId subclasses for consistency. 2018-08-29 09:05:50 -07:00
Allison Vacanti
7ca3b60fe2 Print bytes size in array handle summaries. 2018-08-23 16:40:25 -04:00
Robert Maynard
554bc3d369 At runtime TryExecute supports a specific deviceId to execute on.
Instead of always using the first enabled device, now TryExecute
can be told which device at runtime to use.
2018-08-07 17:22:18 -04:00
Sujin Philip
259d670ab5 Merge topic 'cuda-per-thread-streams-2'
06dee259f Minimize cuda synchronizations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !1288
2018-07-25 15:07:39 -04:00
Robert Maynard
64958b014b VTK-m now supports passing pointers when invoking worklets.
The original design of invoke and the transport infrastructure
relied on the implementation behavior of vtkm::cont types
such as ArrayHandle that used an internal shared_ptr to managed
state. This allowed passing by value instead of passing by
non-const ref when needing to transfer information to the device.

As VTK-m adds support for classes that use virtuals the ability
to pass by base pointer type allows for us to invoke worklets
using a base type without the risk of type slicing.

Additional by moving over to a non-const ref Invocation we
can update all transports that have 'output' to now be
by ref and therefore support types that can't be copied while
being 'more' correct.
2018-07-06 14:27:36 -04:00
Sujin Philip
06dee259f7 Minimize cuda synchronizations
1. Have a per-thread pinned array for cuda errors
2. Check for errors before scheduling new tasks and at explicit sync points
3. Remove explicit synchronizations from most places

Addresses part 2 of #168
2018-07-03 14:19:06 -04:00
Kenneth Moreland
5f807db2ff Make IsWriteableArrayHandle independent of device
Previously, to query whether an ArrayHandle was writable with
IsWriteableArrayHandle, you had to specify a device adapter. The idea
was that it would look at the portal used for that device adapter.
Instead, check the control pointer, which should give the same
indication without having to have a separate check for every type of
device.
2018-06-23 15:34:30 -06:00
Matt Larsen
715141737f Merge topic 'typos'
efdf8543 Misc. Typos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Matt Larsen <mlarsen@cs.uoregon.edu>
Merge-request: !1113
2018-04-06 18:04:46 -04:00
Robert Maynard
c123796949 VTK-m ArrayHandle can now take ownership of a user allocated memory location
Previously memory that was allocated outside of VTK-m was impossible to transfer to
VTK-m as we didn't know how to free it. By extending the ArrayHandle constructors
to support a Storage object that is being moved, we can clearly express that
the ArrayHandle now owns memory it didn't allocate.

Here is an example of how this is done:
```cpp
  T* buffer = new T[100];
  auto user_free_function = [](void* ptr) { delete[] static_cast<T*>(ptr); };

  vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagBasic>
      storage(buffer, 100, user_free_function);
  vtkm::cont::ArrayHandle<T> arrayHandle(std::move(storage));
```
2018-04-04 11:28:25 -04:00
luz.paz
efdf854306 Misc. Typos
Found via `codespell` and `grep`
2018-03-28 09:45:07 -04:00
Robert Maynard
c026d14b97 DynamicArrayHandle prunes invalid Value/Storage set before cast and call
By pruning the invalid combinations first we reduce the amount of work
the compiler has to do. Additionally it makes for smaller callstacks when
the compiler errors out during a CastAndCall.
2018-03-09 16:14:27 -05:00
Robert Maynard
bf2b41699a Refactor vtk-m ArrayHandle to use mutable over const_cast 2018-02-16 10:00:28 -05:00
Robert Maynard
705528bf17 vtk-m ArrayHandle + basic storage has an optimized PrepareForDevice method
By hard coding the PrepareForDevice to know about all the different VTK-m
devices, we can have a single base class do the execution allocation, and not
have that logic repeated in each child class.
2018-02-16 10:00:28 -05:00
Sujin Philip
334262db16 Fix Field constructors
1. Add option to copy user supplied array in make_ArrayHandle.
2. Replace Field constructors that take user supplied arrays with make_Field.
3. Replace CoordinateSystem constructors that take user supplied arrays with
   make_CoordinateSystem.
2017-12-21 12:48:15 -05:00
Sujin Philip
5842da4921 Remove ArrayHandle CopyInto
Fixes #170
2017-10-27 17:28:59 -04:00
Allison Vacanti
7b66dece45 Add equality operators that handle different handle types.
In generic code, it's a pain to use the equality operators since they
requires the ValueType and Storage to match, else the operator is undefined.
This commit adds operators for such comparisons, as well as a unit test.
2017-10-11 17:25:13 -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
Allison Vacanti
fcee1cd5e9 Deduce device adapter tag in interop::TransferToOpenGL. 2017-08-14 09:36:39 -04:00
Robert Maynard
87e1df76ea Merge topic 'print_summary_handle_uint8'
531205c8 Printing of ArrayHanlde<vtkm::Vec< UInt/Int8 >> now works as intended.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !866
2017-08-09 08:34:47 -04:00
Robert Maynard
531205c82c Printing of ArrayHanlde<vtkm::Vec< UInt/Int8 >> now works as intended.
Now when printing ArrayHandles that contain vec's of UInt8/Int8 you see
the integer representation instead of the ascii representation.
2017-08-08 16:38:20 -04:00
Robert Maynard
b85cdd9080 Convert VTK-m over to use 'using' instead of 'typedef' 2017-08-07 14:05:43 -04:00
David C. Lonie
b2c3e41645 Refactor array transfer logic for basic storage.
The old templated array transfer mechanism generated a lot of code
that ended up doing a simple, type-agnostic memcpy for most devices.
This patch specialized array handles for basic storage and uses a
fast-path array transfer implementation. This reduces the size of the
vtkm_cont library by 27% on gcc (from 6.2MB to 4.5MB).
2017-06-29 13:18:44 -04:00
David C. Lonie
959db03ca0 Add option to print full arrayhandle in summary.
Useful for quickly debugging.
2017-06-13 10:21:41 -04: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
efbde1d54b clang-format: sort include directives 2017-05-18 12:59:33 -04:00
David C. Lonie
cbfe5fddd9 Fix up various issues with ArrayHandles in vtkm_cont. 2017-04-05 15:45:11 -07:00
David C. Lonie
6ecc22bb8c First pass at compiling ArrayHandle into vtkm_cont. 2017-04-05 15:45:01 -07:00
David C. Lonie
7e34f86115 Append newline to ArrayHandle summaries. 2017-02-23 12:48:32 -05:00
David C. Lonie
6f417a386b Add type information to array summaries and cast/call errors.
This isn't always the most human readable type info on some platforms,
but it does greatly assist in tracking down why a cast failed.
2017-02-23 11:20:45 -05:00
Kenneth Moreland
5b8389f955 Use printSummary_ArrayHandle when testing fancy arrays
This makes it easier to see what is going on in the fancy arrays and do
diagnostics.

This change required some changes to printSummary_ArrayHandle to support
more array types.
2017-02-15 14:34:17 -07:00
Kenneth Moreland
3834afdd43 Merge topic 'empty-array'
58bbeb18 Support using empty array handles as input
6d5de0c3 Change make_ArrayHandle work with empty std::vector

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !694
2017-02-15 10:23:26 -05:00
Robert Maynard
94bd79b09c Leverage std::move to help FunctionInterface make less copies. 2017-02-14 17:02:32 -05:00
Kenneth Moreland
6d5de0c34b Change make_ArrayHandle work with empty std::vector
When make_ArrayHandle gets an std::vector, it converts it to an
ArrayHandle by getting a pointer to the vector's internal array.
However, when the vector is of size 0, there is no array and it is
invalid to get a pointer. Instead, make a special case for empty
vectors.
2017-02-14 14:49:41 -07:00
David C. Lonie
f601e38ba8 Simplify exception hierarchy.
Remove the ErrorControl class such that all subclasses now inherit from
error. Renamed all exception classes via s/ErrorControl/Error/.

See issue #57.
2017-02-07 15:42:38 -05:00
Robert Maynard
2dc23cf1a8 Correct compilation errors on Windows with CUDA. 2017-01-19 14:02:35 -05:00
Robert Maynard
0a34a4027c vtkm_cont now contains explicit instantiations of common ArrayHandles.
To help reduce compile and library size the vtkm_cont library now holds
common instantiations.
2017-01-16 09:17:38 -05:00
Robert Maynard
3c07c77fa7 Introduce vtkm_cont library to reduce weak vtable creation.
This reduces the number of weak vtables vtkm generates, resulting in
a reduction of binary sizes for projects that include vtkm classes in
multiple translation units.
2017-01-16 09:17:38 -05:00
Robert Maynard
d8d6fd1741 StorageTags are now always exported to resolve future dynamic_cast issues.
Class that need to be passed across dynamic library boundaries such as
DynamicArrayHandle need to be properly export. One of 'tricks' of this
is that templated classes such as PolymorphicArrayHandleContainer need
the Type and Storage types to have public visibility.

This makes sure that all vtkm storage tags have public visibility so
in the future we can transfer dynamic array handles across libraries.
2017-01-16 09:17:38 -05:00
Robert Maynard
8223eacc34 De-virtualize classes that have no need of a vtable.
This is desired to help reduce the amount of weak vtables we generate,
for more information on why this is desired see:
https://gitlab.kitware.com/vtk/vtk-m/issues/103
2016-12-08 11:21:04 -05:00
Kenneth Moreland
fdaccc22db Remove exports for header-only functions/methods
Change the VTKM_CONT_EXPORT to VTKM_CONT. (Likewise for EXEC and
EXEC_CONT.) Remove the inline from these macros so that they can be
applied to everything, including implementations in a library.

Because inline is not declared in these modifies, you have to add the
keyword to functions and methods where the implementation is not inlined
in the class.
2016-11-15 22:22:13 -07:00
Kenneth Moreland
e6686e8be7 Merge branch 'master' into rendering-library 2016-09-09 13:59:15 -06:00
Robert Maynard
4f65da41b9 Remove usage of BOOST_CONCEPT_CHECK.
Instead manually verify the iterator type ourselves inside CopyInto.
2016-09-09 09:43:09 -04:00