Commit Graph

995 Commits

Author SHA1 Message Date
Kenneth Moreland
4758d3d978 Gracefully handle array range requests on empty arrays
Previously, The ArrayRangeCompute code would throw an exception if you
tried to compute the array range on an empty array. This change instead
returns empty ranges.
2017-04-18 14:43:05 -06:00
David C. Lonie
4807b3c472 Silence warnings about unavoidable weak vtables.
- Exception classes cannot be exported due to MSVC's design decisions.
  See http://stackoverflow.com/questions/24511376. We must leave these
  classes as header only and silence the warnings.
- TransferResource in BufferState.h must remain a header-only class since
  there is no vtkm_interop library to compile the class into.
- The VTKDataSetReader hierarchy must similarly remain header-only since
  there is no vtkm_io library.
- The OptionParser Action classes are part of a header-only utility and
  cannot be easily compiled into a library.
-
2017-04-13 14:06:33 -04:00
Robert Maynard
5f55be17e7 Update the TBB grain size to be a more reasonable default.
We not only update the TBB grain size to be a more value, we also specify
a grain size for the 3D scheduler.
2017-04-06 16:34:15 -04:00
Kenneth Moreland
d68b211346 Remove TransportTagReducedValuesIn
Now that the transport takes the input range as one of its arguments,
this functionality can be implemented by the more general
TransportTagArrayIn.
2017-03-24 15:32:27 -06:00
Kenneth Moreland
dc192b793d Add input range to arguments of transport
Previously the arguments to the operator of a vtkm::cont::arg::Transport
were the control object, the input domain object, and the output range.
If you wanted to, for example, check the size of an input array to make
sure it matched the input range, you would have to know the meaning of
the input domain object to query its range. This made it hard to create
generic transports, like TransportTagArrayIn, that accept data from
multiple different input domains but need to know the input range.
2017-03-24 15:14:18 -06:00
Li-Ta Lo
5a50d60573 Merge topic 'unified-memory'
2bdc0be5 add cuda calls for memory advise as per Tom Fogel
6ce8a013 Merge branch 'master' into unified-memory
b470175f new unified memory effort with the new Thrust device
835073da clean up with custom allocator
dfae8f5e Fixing merge issue with contour_tree
82c40a63 First support for unified memory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !729
2017-03-16 15:14:55 -04:00
Li-Ta Lo
2bdc0be5ca add cuda calls for memory advise as per Tom Fogel 2017-03-14 14:19:01 -06:00
Sujin Philip
566d70c450 Merge topic 'fix-windows_h-include-logic'
25f9f88f Fix windows.h include logic

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !722
2017-03-13 09:59:24 -04:00
Sujin Philip
25f9f88f3e Fix windows.h include logic
windows.h was only being included for MSVC, while in UnitTestTimer.cxx, the
Windows function Sleep was being called after check for _WIN32. This was
causing compilation failure in MINGW.

Fixes #122
2017-03-10 16:28:13 -05:00
Li-Ta Lo - 194699
6ce8a0135a Merge branch 'master' into unified-memory 2017-03-09 14:54:03 -07:00
Li-Ta Lo - 194699
b470175f98 new unified memory effort with the new Thrust device 2017-03-09 14:51:45 -07:00
Kenneth Moreland
6fdc7eb8c0 Add Field::GetRange and CoordinateSystem::GetBounds to library
Following what was done with ArrayRangeCompute, the GetRange and
GetBounds methods are embedded into the vtkm_cont library for the most
common type lists.

Also, and probably more importantly, the device adapter is no longer one
of the arguments for either of these methods. It is no longer needed as
ArrayRangeCompute no longer needs it.
2017-03-09 13:18:36 -05:00
Kenneth Moreland
c16236ce69 Use ArrayRangeCompute without specifying a device
Most uses of ArrayRangeCompute just want to get the range of the data
and probably don't have a particular device in mind. Thus, it is better
to use a TryExecute internally use whatever devices are available.

Note that when using TryExecute, the calling code is expected to be able
to support all devices. That might not always be the case. Thus, I am
experimenting a bit with how we incorporate this in a library. The
advantage of having the code compiled in a library is that you only have
to compile it once and the calling code does not need to worry about
CUDA, etc.

However, because ArrayRangeCompute is templated, we can only pre-compile
some subset of array handle types. The most common are compiled into the
code (matching all the predefined ArrayHandles as well as some special
cases). If the code wants to use some other type, it has to include
ArrayRangeCompute.hxx. The only place where this is necessary is a test
that intentially trys to find the range on an uncommon type.

If array portals were to support virtual methods, then we should be able
to modify this code so that we could precompile for all array handle
types.
2017-03-09 13:18:36 -05:00
Kenneth Moreland
8b33f2bc79 Fix device adapter algorithms for small arrays
There were some issues for device adapter algorithms (like scan and
reduce) for empty arrays or arrays of size 1. This adds tests for these
short arrays to the device adapter algorithm tests and fixes these
problems.
2017-03-08 19:05:28 -05:00
Kenneth Moreland
726546419d ArrayHandle reallocations of 0
The basic storage has an implicit invariant that if the size of the
storage is 0 then the array is a null pointer. That invariant was broken
if the array was allocated and then Shrink or Allocate was called with
0. In that case, the array remained allocated by the size was set to 0.

This fixes the problem by making sure a Shrink(0) actually does an
Allocate(0) (to clear out the data) and that the basic storage always
frees its memory when allocating a 0 sized array.
2017-03-08 18:53:06 -05:00
Robert Maynard
d5dfb1f673 Restore ArrayRangeCompute to using a single Reduce call.
We can easily compute the min and max of an array using a single reduction
2017-03-06 16:14:48 -05:00
Sujin Philip
9eddce6c99 Rename StreamCompact to CopyIf
Plus, removes the version that uses one array as both input and stencil.
2017-03-06 11:08:27 -05:00
Robert Maynard
ae9a8fd0a4 Fix CellSet* typeid to consistent across dynamic libraries.
Since we don't have explicit template instantiations for CellSetExplicit
and CellSetSingleType we need to mark them as being exported from all
libraries.
2017-03-01 17:12:46 -05:00
Sujin Philip
57f5881538 Merge topic 'use-c++11=delete'
8c4bbc39 Use C++11 =delete keyword

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !708
2017-02-24 13:31:57 -05:00
Kenneth Moreland
3e77f4e18b Merge topic 'refactor-runtime-device-tracker'
18c4190d Update classes using RuntimeDeviceTracker
200928ef Add a global RuntimeDeviceTracker
a3573117 Compile RuntimeDeviceTracker.cxx with CUDA when appropriate
814b2db1 Add the implementation of RuntimeDeviceTracker to cont library
b9d3206e Move RuntimeDeviceTracker to vtkm::cont

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !707
2017-02-24 10:50:19 -05:00
Sujin Philip
8c4bbc39ad Use C++11 =delete keyword 2017-02-24 09:39:22 -05:00
David Lonie
69fe31005b Merge topic 'verbose_castandcall_errors'
7e34f861 Append newline to ArrayHandle summaries.
6f417a38 Add type information to array summaries and cast/call errors.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !705
2017-02-24 09:03:31 -05:00
Sujin Philip
e5bc34e9f5 Merge topic 'catch-by-reference'
a88807fd Catch all exceptions by reference

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !704
2017-02-23 16:36:00 -05:00
Sujin Philip
a88807fd7e Catch all exceptions by reference 2017-02-23 13:25:01 -05:00
David C. Lonie
7e34f86115 Append newline to ArrayHandle summaries. 2017-02-23 12:48:32 -05:00
Kenneth Moreland
18c4190d85 Update classes using RuntimeDeviceTracker
They now grab the global runtime device tracker. In some cases, I've
added the ability to set/get the tracker to change it from the global.
In others I just removed the local copy, since it was just hooked into
the global tracker.
2017-02-23 09:54:41 -07: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
200928ef35 Add a global RuntimeDeviceTracker
Next up is using this by default pretty much everywhere you want to run
an algorithm but don't care on what device.
2017-02-23 09:19:13 -07:00
Kenneth Moreland
a3573117de Compile RuntimeDeviceTracker.cxx with CUDA when appropriate
The RuntimeDeviceTracker.cxx contains a library method that queries the
CUDA device, which only works if compiled as a CUDA source file.

This set up will allow code that is not compiled with CUDA use a
RuntimeDeviceTracker with other code that does use CUDA.
2017-02-22 16:18:23 -07:00
Kenneth Moreland
81f7ff2391 Make offsets for ArrayHandleGroupVecVariable always input
The offsets for an ArrayHandleGroupVecVariable are always inputs
and cannot be changed, even when the array handle is used as an output.
There was a mistake where the PrepareFor* methods tried to make
the offsets mutable. In the case of an output, the offsets were not
pushed to the execution environment, and the arrays could not be looked
up.
2017-02-22 15:44:06 -07:00
Kenneth Moreland
814b2db18c Add the implementation of RuntimeDeviceTracker to cont library
This allows code to include the RuntimeDeviceTracker without depending
on the device-specific adapters (I think).

Also changed the implementation to use a shared_ptr for the state so you
can pass it around and share the state easier.
2017-02-22 15:25:04 -07:00
Kenneth Moreland
b9d3206ea6 Move RuntimeDeviceTracker to vtkm::cont
Before it was in the vtkm::cont::internal namespace. However, we expect
to be using this feature quite a bit more as we want VTK-m to handle
multiple devices effectively (as in, just figure it out and go).
2017-02-22 13:33:52 -07:00
Kenneth Moreland
6089e7396e Match the two overload of ArrayRangeCompute
There are two versions of ArrayRangeCompute. The first version is a
general version that computes the min and max by running a reduction on
a device. The second version was a specialization for uniform grid
coordinate arrays, which is easily computed without looking at the
values.

The problem was that the generic version of ArrayRangeCompute took two
arguments and the specialization only took one argument (because it does
not need a device). This means that templated code uses the general
version will never use the specialized version. This fix adds a device
argument to the specialized version. The extra argument is not used, but
will properly overload the general version.
2017-02-21 16:22:53 -07:00
David Lonie
a0016456cc Merge topic 'default_device_to_public_header'
7a41621d Move default device selection out of private headers.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !693
2017-02-17 08:26:01 -05:00
David C. Lonie
7a41621d82 Move default device selection out of private headers.
This will make the librarification of vtk-m easier as we tread that
path.

Refs #120.
2017-02-16 13:40:35 -05:00
Kenneth Moreland
c3a9a55307 Merge topic 'group-vec-variable-cont-portal'
17ed7a36 Remove typedef that is no longer used
364f4175 Only print cell arrays that are valid
5b8389f9 Use printSummary_ArrayHandle when testing fancy arrays
873ceefc Implement ArrayHandleGroupVecVariable::GetPortalConst

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !695
2017-02-16 12:43:32 -05:00
Kenneth Moreland
d339025a1b Merge topic 'external-face-more-generic'
dcbbb727 Merge branch 'master' into external-face-more-generic
0703139a Make Keys class do in-place sort
059c7f6d Fix issue with ExternalFaces on CellSetSingleType
876514ba Add better test for external faces
53679dfc Update ExternalFaces to support mixed face types

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Brent Lessley <blessley@cs.uoregon.edu>
Merge-request: !662
2017-02-16 10:28:56 -05:00
Kenneth Moreland
17ed7a3629 Remove typedef that is no longer used
It was a typedef for a Portal. Instead of setting the portal directly,
the portal is just sent to a function, so we don't directly use this
type anymore.

Not a big deal, but it could cause compiler warnings.
2017-02-15 16:59:54 -07:00
Kenneth Moreland
364f417529 Only print cell arrays that are valid
ConnectivityExplicitInternals::PrintSummary blindly attempted to print
all of its arrays regardless of whether they are valid. Trying to print
uninitialized arrays can be invalid in some circumstances. Instead,
check to see of the arrays are valid before printing them out. (This can
give you useful information anyway. There is a difference between an
uninitialized array and one of zero length.)
2017-02-15 15:07:50 -07: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
Robert Maynard
ca302128a9 Merge topic 'benchmarks'
fc68362d Build benchmarks even when testing is not enabled.
31e20859 Fix typo.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !696
2017-02-15 15:10:38 -05:00
Kenneth Moreland
873ceefc17 Implement ArrayHandleGroupVecVariable::GetPortalConst
Previously it was impossible to get an ArrayPortal from an
ArrayHandleGroupVecVariable on the control side (by calling GetPortal or
GetPortalConst). This makes it possible.
2017-02-15 08:26:53 -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
2600b3d890 Merge topic 'leverage_move_constructors'
94bd79b0 Leverage std::move to help FunctionInterface make less copies.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !691
2017-02-15 08:23:14 -05:00
Kenneth Moreland
58bbeb183a Support using empty array handles as input
Previously if you constructed an array handle without allocating it, you
would get an error if you tried to use the array as input. This
conflicted with some recent changes to accept empty vectors.

Now when you try to use an unallocated ArrayHandle as input (calling
PrepareForInput or PrepareForInPlace), it internally calls Allocate(0)
(to establish internal state) and sets up a valid execution ArrayPortal
of size 0.
2017-02-14 15:27:34 -07: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
Tom Fogal
31e20859d4 Fix typo. 2017-02-14 10:29:00 -08:00
Robert Maynard
df437afbbf Remove an unnecessary copy of a string in ErrorExecution constructor 2017-02-14 13:11:27 -05:00
Li-Ta Lo - 194699
835073dae2 clean up with custom allocator 2017-02-13 11:45:17 -07:00