Commit Graph

1616 Commits

Author SHA1 Message Date
Robert Maynard
dd85fc1366 Document why we certain classes member variables need to be const ref. 2016-01-19 09:29:55 -05:00
Robert Maynard
6fb86da8f9 DynamicArrayHandle Casting methods now holds by const * const.
This is to make it more clear to developers that the handle is a
reference that could be NULL.
2016-01-19 09:29:55 -05:00
Robert Maynard
c1560e2d3f Perform less unnecessary copies when deducing a worklets parameters.
One of the causes of the large library size and slow compile times has been
that vtkm has been creating unnecessary copies when not needed. When the
objects being copied use shared_ptr this causes a bloom in library size. I
presume this bloom is caused by the atomic increment/decrement that is
required by shared_ptr.

For testing I used the following example:
```
struct ExampleFieldWorklet : public vtkm::worklet::WorkletMapField
{
  typedef void ControlSignature( FieldIn<>, FieldIn<>, FieldIn<>,
                                 FieldOut<>, FieldOut<>, FieldOut<> );
  typedef void ExecutionSignature( _1, _2, _3, _4, _5, _6 );

  template<typename T, typename U, typename V>
  VTKM_EXEC_EXPORT
  void operator()( const vtkm::Vec< T, 3 > & vec,
                   const U & scalar1,
                   const V& scalar2,
                   vtkm::Vec<T, 3>& out_vec,
                   U& out_scalar1,
                   V& out_scalar2 ) const
  {
    out_vec = vec * scalar1;
    out_scalar1 = scalar1 + scalar2;
    out_scalar2 = scalar2;
  }

  template<typename T, typename U, typename V, typename W, typename X, typename Y>
  VTKM_EXEC_EXPORT
  void operator()( const T & vec,
                   const U & scalar1,
                   const V& scalar2,
                   W& out_vec,
                   X& out_scalar,
                   Y& ) const
  {
  //no-op
  }
};

int main(int argc, char** argv)
{
  std::vector< vtkm::Vec<vtkm::Float32, 3> > inputVec;
  std::vector< vtkm::Int32 > inputScalar1;
  std::vector< vtkm::Float64 > inputScalar2;

  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleV =
    vtkm::cont::make_ArrayHandle(inputVec);

  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleS1 =
    vtkm::cont::make_ArrayHandle(inputVec);

  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleS2 =
    vtkm::cont::make_ArrayHandle(inputVec);

  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleOV;
  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleOS1;
  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleOS2;

  std::cout << "Making 3 output DynamicArrayHandles " << std::endl;
  vtkm::cont::DynamicArrayHandle out1(handleOV), out2(handleOS1), out3(handleOS2);

  typedef vtkm::worklet::DispatcherMapField<ExampleFieldWorklet> DispatcherType;

  std::cout << "Invoking ExampleFieldWorklet" << std::endl;
  DispatcherType dispatcher;

  dispatcher.Invoke(handleV, handleS1, handleS2, out1, out2, out3);

}
```

Original vtkm would generate a binary of size 4684kb and would perform 91
ArrayHandle copies or assignments. With this branch the binary size is
reduced to 2392kb and will perform 36 copies or assignments.
2016-01-19 09:20:49 -05:00
Robert Maynard
8cf9b979c7 Don't use DeviceAdapter inside DataSetBuilderExplicit.
No need to use the device adapter, just do a manual host side copy.
2016-01-19 08:56:50 -05:00
Kenneth Moreland
6d9d7fac83 Merge branch 'dynamic-cast' into 'master'
Improvements to Dynamic casts

Some improvements with how DynamicArrayHandle and
DynamicCellSet perform casting to concrete classes.

See merge request !317
2016-01-18 18:37:18 -05:00
Kenneth Moreland
c62937d612 Fix warning about uninitialized value. 2016-01-18 15:58:07 -07:00
Kenneth Moreland
ed43dad6ca Simplify and unify cast interface.
Previously, DynamicArrayHandle and DynamicCellSet had slightly different
interfaces to their CastTo feature. It was a bit confusing and not all
that easy to use.

This change simplifies and unifies them by making each class have a single
CopyTo method that takes a reference to a cast object (an ArrayHandle or
CellSet, respectively) and fills that object with the data contained if
the cast is successfull. This interface gets around having to declare
strange types.

Each object also has a Cast method that has to have a template parameter
specified and returns a reference of that type (if possible).

In addition, the old behavior is preserved for DynamicArrayHandle (but
not DynamicCellSet). To avoid confusion, the name of that cast method is
CastToTypeStorage. However, the method was chaned to not take parameters
to make it consistent with the other Cast method.

Also, the IsType methods have been modified to reflect changes in
cast/copy. IsType now no longer takes arguments. However, an alternate
IsSameType does the same thing but does take an argument.
2016-01-18 15:58:04 -07:00
Kenneth Moreland
92d2ad6a72 Consolidate dynamic_cast calls.
Previously in DynamicArrayHandle the dynamic_cast was contained in a
method that was reimplemented for every different instance of
DynamicArrayHandleBase. Change that to put the dynamic_cast in a
function outside of the class so that there is only one implementation
created per ArrayHandle type.

Similarly, DynamicCellSet had its dynamic_cast in a method plus there
was a second version in the functors used for the CastAndCall method.
Consolidate all of these into a function outside of either much like
DynamicArrayHandle.
2016-01-18 15:55:02 -07:00
Robert Maynard
61ed34e154 Merge topic 'remove_fill_via_copy'
4bb3cce0 Use the DataSetBuilderExplicitIterative helper where it is useful.
eba2fb49 Fixed some warnings in the DataSetBuilder code.
dd312516 Fix issue found be moving over to  DataSetBuilderExplicit.
e7456fa1 Update vtkm tests and examples to use DataSetBuilders.
449c425a Allow DataSetBuilderExplicit to create CellSetSingleType.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !318
2016-01-18 17:17:40 -05:00
Robert Maynard
4bb3cce016 Use the DataSetBuilderExplicitIterative helper where it is useful. 2016-01-18 16:19:48 -05:00
Robert Maynard
eba2fb493f Fixed some warnings in the DataSetBuilder code. 2016-01-18 15:04:18 -05:00
Robert Maynard
dd312516f6 Fix issue found be moving over to DataSetBuilderExplicit.
Mainly issue dealing with dimensionality of cell sets and what that represents.
Have added in code to allow user to specify a custom dimensionality so that
tests continue to work properly.
2016-01-15 16:16:38 -05:00
Robert Maynard
e7456fa120 Update vtkm tests and examples to use DataSetBuilders. 2016-01-15 15:44:56 -05:00
Robert Maynard
449c425a23 Allow DataSetBuilderExplicit to create CellSetSingleType.
If you have only a single cell shape, you can now efficiently create
a vtkm::cont::DataSet whose CellSet is vtkm::cont::CellSetSingleType.
2016-01-15 15:06:09 -05:00
Robert Maynard
9da2c081a6 Merge topic 'reduce_placeholder_name_length'
c8551cb7 Reduce the name length on Args<1>, etc to help reduce symbol size.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !312
2016-01-15 10:12:10 -05:00
Robert Maynard
c8551cb758 Reduce the name length on Args<1>, etc to help reduce symbol size. 2016-01-15 08:32:50 -05:00
Robert Maynard
e39c7819aa Merge topic 'more_worklets_not_templated_on_deviceadapter'
956cedfd Turn off the benchmarking ExternalsFaces.
18b866d6 Threshold worklet is not templated on device adapter.
dbee9275 ExternalFaces worklet is not templated on device adapter.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !315
2016-01-15 08:25:18 -05:00
Kenneth Moreland
f71b59e733 Merge branch 'cuda-timer-bug' into 'master'
Synchronize the CUDA timer on both the start and end events

Previously, the timer for CUDA devices only called cudaEventSynchronize
at the end event when asking for the elapsed time. This, however, could
allow time to pass from when the timer was reset to when the start event
happened that was not recorded in the timer. This added synchronization
should make sure that all time spent in CUDA is recorded.

See merge request !291
2016-01-14 18:22:08 -05:00
Kenneth Moreland
1d1334e2ea Merge branch 'dataset-builder-fixes' into 'master'
DataSetBuilder fixes

There were some compiler warnings and testing issues with the
recently merged DataSetBuilder branch. This fixes some of
those problems.

See merge request !316
2016-01-14 18:03:40 -05:00
Kenneth Moreland
0b2823ba55 Make UnitTestArrayHandleCartesianProduct faster
Reduce the number of conditions UnitTestArrayHandleCartesianProduct
tries so that it is faster. All the conditions are pretty similar, so it
should be OK to reduce some.
2016-01-14 15:22:33 -07:00
Kenneth Moreland
427f3cf57d Make Rectilinear and Regular builder tests faster
Previously UnitTestDataSetBuilderRectilinear and
UnitTestDataSetBuilderRegular did an exhaustive test of all possible
grid sizes within a certain amount of dimensions and with some number of
ways to build point arrays. This created hundreds of thousands of cases
that were checked, and it was running a long time. At best it wasted
time and at worst ctest reported the test as timed out.

It is not really necessary to perform an exhaustive test. The tests are
changed to do 10 trials using random values for dimensions and fill
methods.
2016-01-14 15:15:19 -07:00
Robert Maynard
f4d2b63fcb Merge topic 'vertex_clustering_not_templated_on_device'
12ddcfdd VertexClustering worklet is not templated on device adapter.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !314
2016-01-14 16:15:10 -05:00
Kenneth Moreland
e0184e6648 Fixed warnings about sign conversion. 2016-01-14 14:01:28 -07:00
Robert Maynard
956cedfd17 Turn off the benchmarking ExternalsFaces. 2016-01-14 15:56:10 -05:00
Robert Maynard
18b866d6e0 Threshold worklet is not templated on device adapter.
This should help reduce the amount of code generation, when building the
Threshold worklet for all device adapters.
2016-01-14 15:55:22 -05:00
Robert Maynard
dbee92752e ExternalFaces worklet is not templated on device adapter.
This should help reduce the amount of code generation, when building the
ExternalFaces worklet for all device adapters.
2016-01-14 15:55:12 -05:00
Robert Maynard
12ddcfdda7 VertexClustering worklet is not templated on device adapter.
This should help reduce the amount of code generation, when building the
VertexClustering worklet for all device adapters.
2016-01-14 15:42:27 -05:00
Dave Pugmire
a5972e6a15 Merge topic 'dataset-builder2'
f86382f0 Fix support for CoordinateSystems using ArrayHandleCartesianProduct.
d6a2a142 Add toleranced compare for values. Add tests for vtkm::Float32,Float64,Id typed arrays.
5d438353 Add toleranced comparisions for bounds validation. Also, add vtkm::Float32 and vtkm::Float64 to the testing for rectilinear and regular datasets.
b225ae97 Rectilinear coordinates (created with DataSetBuilderRectilinear) are now converted to vtkm::FloatDefault. This reduces the number of types to consider when casting inside CoordinateSystem, and was felt by all to be a reasonable restriction.
d755e43d Use ArrayHandleCompositeVector to represent separated point arrays for DataSetBuilderExplicit.h.
c7b0ffb8 Add tests for DataSetBuilderExplicit. Added cont/testing/ExplicitTestData.h which includes several explicit datasets.  These datasets come from VTK data generated in VisIt.  The new unit tests build datasets in several different ways and do some basic validation.
b4d04fff Add specialization of printSummary_ArrayHandle for UInt8. It prints them as characters, which are a little hard to understand to this computer scientist.
bd929c20 Fix compiler warnings.
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !262
2016-01-14 14:57:02 -05:00
Robert Maynard
10d59c176b StructuredPointsReader supports multiple visit fields. 2016-01-14 13:10:24 -05:00
Robert Maynard
735462f891 Update the io readers to handle visit style structured points files. 2016-01-14 10:13:24 -05:00
Robert Maynard
719ee34a60 Merge topic 'dynamic_cell_set_use_default'
4e94617f Make DynamicCellSet use VTKM_DEFAULT_CELL_SET_LIST_TAG.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !309
2016-01-14 08:37:36 -05:00
Robert Maynard
020975930c Merge topic 'generalize-marchingcubes-input'
15e1f80d Generalize MarchingCubes input with additional template parameters.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !304
2016-01-13 13:49:13 -05:00
Robert Maynard
ede404191e Merge topic 'better_compiler_detection'
f5f9939f Update all of vtkm to understand it can only identify as one compiler.
c706c826 Configure.h can only state a machine is a one compiler.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !307
2016-01-13 13:49:07 -05:00
Chuck Atkins
86bb45b9ad Simplify the ifdef conditions used for vector pragma definitions 2016-01-13 12:48:03 -05:00
Robert Maynard
a06becd241 Merge topic 'use_vectorization_helpers_everywhere'
b8e5923a FunctorsTBB now uses VTKM_VECTORIZATION_X macros everywhere.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Chuck Atkins <chuck.atkins@kitware.com>
Merge-request: !306
2016-01-13 12:13:34 -05:00
Robert Maynard
4e94617f89 Make DynamicCellSet use VTKM_DEFAULT_CELL_SET_LIST_TAG.
It was previously using vtkm::cont::CellSetListTagCommon which would
break the ability for people to specify a custom value for
VTKM_DEFAULT_CELL_SET_LIST_TAG.
2016-01-13 11:05:58 -05:00
Kenneth Moreland
3f446ad261 Add ErrorControlCuda for better CUDA error checking.
Add lots of checks to CUDA calls in the timer to try to identify any
problems that might be showing up on the dashboard.

Also adding some print statements around the sleep function in the
device adapter testing. For some reason the problem just went away with
them.
2016-01-12 15:19:54 -07:00
Kenneth Moreland
f582729803 Synchronize the CUDA timer on both the start and end events
Previously, the timer for CUDA devices only called cudaEventSynchronize
at the end event when asking for the elapsed time. This, however, could
allow time to pass from when the timer was reset to when the start event
happened that was not recorded in the timer. This added synchronization
should make sure that all time spent in CUDA is recorded.
2016-01-12 15:13:56 -07:00
Chuck Atkins
429350ab41 Merge topic 'fix-gcc-pragma'
ccdb7bb6 Fix incorrect vectorization pragma for GCC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !308
2016-01-12 12:26:42 -05:00
Chuck Atkins
ccdb7bb6cf Fix incorrect vectorization pragma for GCC 2016-01-12 11:10:20 -05:00
Robert Maynard
f5f9939f26 Update all of vtkm to understand it can only identify as one compiler. 2016-01-12 11:05:40 -05:00
Robert Maynard
c706c8269b Configure.h can only state a machine is a one compiler.
It used to be possible for vtk-m to say it was multiple compilers, for example
it could be both GCC and PGI, Clang and MSVC ( yes possible ), or Intel and
Clang.

This logical restructure now makes that impossible, and instead prefers a system
where we choose the most specialized version of the compiler over the most
general, where general is GCC / Clang.
2016-01-12 11:05:40 -05:00
Robert Maynard
b8e5923ae1 FunctorsTBB now uses VTKM_VECTORIZATION_X macros everywhere. 2016-01-12 08:43:06 -05:00
Robert Maynard
02d10e38c4 Merge topic 'fix-gcc-pragma'
9e9e3caf Fix a misplaced '\' for GCC pragmas in Configure.h.in

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !305
2016-01-11 15:23:51 -05:00
Chuck Atkins
9e9e3caf3c Fix a misplaced '\' for GCC pragmas in Configure.h.in 2016-01-11 14:52:41 -05:00
T.J. Corona
15e1f80ddd Generalize MarchingCubes input with additional template parameters. 2016-01-08 14:56:10 -05:00
Robert Maynard
360694b54c Merge topic 'reset_type_and_storage_in_single_call'
b70a000a Allow resetting the Type and Storage of a DynamicArrayHandle in a single call.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !302
2016-01-08 12:25:39 -05:00
Robert Maynard
34ad520987 Merge topic 'marching_cubes_normal_generation_option'
82a573f7 MarchingCubes is now able to not generate normals.
502e7c28 Merge branch 'cleanup_scatter_counting_uses' into marching_cubes_normal_generation_option
8079dc28 MarchingCubes generate step now requires a ScatterCounting object.
4cd2f582 Add a default constructor for ScatterCounting.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !300
2016-01-08 11:50:10 -05:00
Robert Maynard
b70a000ac0 Allow resetting the Type and Storage of a DynamicArrayHandle in a single call.
vtkm::filter has the use case where we need to reset both the type and
storage of an array handle, by doing both at the same time we can reduce
the number of temporary objects, and invalid conversions of arrays.
2016-01-08 11:47:59 -05:00
Robert Maynard
82a573f712 MarchingCubes is now able to not generate normals. 2016-01-08 10:42:49 -05:00