Commit Graph

122 Commits

Author SHA1 Message Date
Robert Maynard
3b06784146 Merge topic 'stop_icc_15_from_icing'
3f7d9429 Disable vectorization on debug Intel Compiler builds.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !363
2016-03-16 15:27:24 -04:00
Robert Maynard
3f7d9429c3 Disable vectorization on debug Intel Compiler builds.
The intel compiler generates internal compiler errors when you use
pragma simd and haven't defined NDEBUG.
2016-03-16 15:15:05 -04:00
Robert Maynard
8818cfc600 Disable vectorization when building with ICC 14.0
We have found that ICC 14.0 produces bad simd code that causes
vtkm worklets to throw SIGBUS signals. This issue was resolved in
ICC 15.0
2016-03-16 13:27:04 -04:00
Robert Maynard
55280637f8 Correct the VTKM_THIRDPARTY_PRE_INCLUDE/POST_INCLUDE for MSVC.
We now properly suppress a collection of warnings from thirdparty headers on
windows.
2016-03-11 09:59:49 -05:00
Robert Maynard
8c579b7742 Setup VTKM_THIRDPARTY_PRE_INCLUDE/POST_INCLUDE for MSVC.
We now suppress a collection of warnings from thirdparty headers on windows.
2016-03-10 13:31:21 -05:00
Robert Maynard
821096cfd7 Perform necessary copies when deducing a worklets parameters.
As part of the work to reduce the number of copies of array handles the CUDA
backend was broken. The transportation of stack allocated classes to CUDA
relies on all member variables being value based, not references/pointers.
This correct the issue of sending references to host side memory to CUDA, at
the cost of two copies of the Invocation object.

When we move to C++11 we need to revisit this work and see if std::move
can help reduce the cost of these copies.
2016-01-26 15:08:46 -05:00
Robert Maynard
8070586ea7 Merge topic 'less_temporary_copies'
4153c2c7 Found a few more places where we don't need to return by value.
dd85fc13 Document why we certain classes member variables need to be const ref.
6fb86da8 DynamicArrayHandle Casting methods now holds by const * const.
c1560e2d Perform less unnecessary copies when deducing a worklets parameters.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !320
2016-01-20 12:02:57 -05:00
Kenneth Moreland
9ccd7fa9c7 Change Regular to Uniform
There was an inconsistency in naming classes where axes-aligned grids
with even spacing were sometimes called "uniform" and sometimes called
"regular". Maintain consistency by always calling them uniform.
2016-01-19 15:54:05 -07:00
Robert Maynard
8973ca8f08 Merge topic 'simplify-vectorize-pragma-logic'
86bb45b9 Simplify the ifdef conditions used for vector pragma definitions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !310
2016-01-19 14:59:27 -05:00
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
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
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
Chuck Atkins
ccdb7bb6cf Fix incorrect vectorization pragma for GCC 2016-01-12 11:10:20 -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
Chuck Atkins
9e9e3caf3c Fix a misplaced '\' for GCC pragmas in Configure.h.in 2016-01-11 14:52:41 -05:00
Kenneth Moreland
ea69785009 Disable warning push/pop on older compilers
Older GCC compilers (earlier than 4.6) do not support the diagnostic
pragmas that push and pop the warning levels. This change just disables
the warnings we need to for third party libraries and leaves them off.
This means you might miss some legit warnings on older compilers, but
most developers use newer compilers anyway, and the push/pop should
still work there.
2015-12-14 10:54:02 -07:00
Robert Maynard
68e3032b4e Properly detect OSX Intel Compiler as Intel not Clang. 2015-12-03 14:41:07 -05:00
Robert Maynard
05e8f592cd Disable vectorization pragma's if we detect the compiler doesn't support them. 2015-12-03 13:44:52 -05:00
Robert Maynard
bfb6c26a98 Simplify the design of vectorization support.
Remove the configured file variables, as that causes problems
when using an installed version of VTK-m.
2015-12-01 11:37:41 -05:00
Robert Maynard
514ea09afc Teach VTK-m how to enable vectorization for gcc, clang, and icc. 2015-11-23 12:44:05 -05:00
Kenneth Moreland
1a538ca196 Merge branch 'scatter-worklets' into 'master'
Scatter in worklets

Add the functionality to perform a scatter operation from input to output in a worklet invocation. This allows you to, for example, specify a variable amount of outputs generated for each input.

See merge request !221
2015-11-11 13:09:47 -05:00
Kenneth Moreland
bf03243516 Add ability to multiply any Vec by vtkm::Float64.
This has been requested on the mailing list to make it easier to
interpolate integer vectors.

There are a couple of downsides to this addition. First, it implicitly
casts doubles back to whatever the vector type is, which can cause a
loss of precision. Second, it makes it more likely to get overload
errors when multiplying with Vec. In particular, the operator to cast
Vec of size 1 to the component class had to be removed.
2015-11-07 06:33:50 -07:00
Kenneth Moreland
b0c5a32611 Add Scatter parameters to Invocation.
We are passing in execution objects with the Invocation when the Worklet
is scheduled, but we are not using it yet.
2015-11-06 18:05:20 -07:00
Kenneth Moreland
dc11d9a917 Merge branch 'cuda-default-constructors' into 'master'
CUDA default constructors, destructors, and assignment operators

Several classes exclusively work in the control environment. However, CUDA likes to add __device__ to constructors, destructors, and assignment operators it automatically creates. This in turn causes warnings about the __device__ function using host-only classes (like boost::shared_ptr). Solve this problem by adding explicit methods for all of these.


See merge request !245
2015-10-22 15:22:43 -04:00
Kenneth Moreland
e028f2af99 Supress some warnings about copies in FunctionInterface. 2015-10-21 07:55:59 -06:00
Robert Maynard
8de216c088 Propagate vtkm::Id3 scheduling down to the ThreadIndex classes.
This now allows for even more efficient construction of uniform point
coordinates when running under the 3d scheduler, since we don't need to go
from 3d index to flat index to 3d index, instead we stay in 3d index
2015-10-20 09:29:41 -04:00
Kenneth Moreland
99ce66c6fe Change Fetches to use ThreadIndices instead of Invocation.
Previously, all Fetch objects received an Invocation object in their
Load and Store methods. The point of this was that it allowed the Fetch
to get data from any of the execution objects. However, every Fetch
either just got data directly from its associated execution object or
else used a secondary execution object (the input domain) to get indices
into their own execution object.

This left two potential areas for improvement. First, pulling data out
of the Invocation object was unnecessarily complicated. It would be much
nicer to get data directly from the associated execution object. Second,
when getting index information from the input domain, it was often the
case that extra computations were necessary (particularly on structured
cell sets). There was no way to share the index information among
Fetches, and therefore the computations were replicated.

This change removes the Invocation from the Fetch Load and Store.
Instead, it passes the associated execution object and a new object type
called the ThreadIndices. The ThreadIndices are customized for the input
domain and therefore have all the information needed for a redirected
lookup. It is also a thread-local object so it can cache computed
indices and save on computation time.
2015-10-07 17:01:42 -06:00
Tyson Neuroth
0bd27169b5 ConnectivityStructuredInternals computes FlatToLogicalCellIndex faster.
By caching the CellDimensions and the size of a XY slice of cells we can
improve the performance of flat index to i,j,k for cells.
2015-09-25 17:07:11 -04:00
Robert Maynard
778d670ed3 FunctionInterface suppresses warnings on calling host function from host/device 2015-09-21 15:26:28 -04:00
Robert Maynard
00b732056d Make a define to suppress false positive host/device warnings 2015-09-21 14:25:15 -04:00
Kenneth Moreland
fd21a12f4a Merge branch 'xcode-7-warnings' into 'master'
Xcode 7 warnings

The XCode 7 compiler has a new warning for unused typedefs. The Boost code we use has some instances where this warning gets issued. Suppress these warnings.

See merge request !199
2015-09-17 18:12:31 -04:00
Kenneth Moreland
b15940c1e3 Declare new VTKM_STATIC_ASSERT
This is to be used in place of BOOST_STATIC_ASSERT so that we can
control its implementation.

The implementation is designed to fix the issue where the latest XCode
clang compiler gives a warning about a unused typedefs when the boost
static assert is used within a function. (This warning also happens when
using the C++11 static_assert keyword.) You can suppress this warning
with _Pragma commands, but _Pragma commands inside a block is not
supported in GCC. The implementation of VTKM_STATIC_ASSERT handles all
current cases.
2015-09-17 14:40:39 -06:00
Kenneth Moreland
9b22a72d6c Only suppress unused-local-typedef warning when it exists
The recently added pragma to suppress warnings about unused local
typedefs caused lots of dashboard failures because many GCC and clang
compiler do not have this warning so did not recognized the pragma to
suppress it. Now only use the pragma on clang compilers with a large
enough version.

I also discovered that the check for VTKM_CLANG was wrong (at least for
the most modern versions of XCode). Fixed that as well as some uses of
VTKM_CLANG that were wrong.
2015-09-17 07:44:56 -06:00
Robert Maynard
cf32b430dc Teach Configure.h to store if TBB and CUDA are enabled. 2015-09-17 09:28:21 -04:00
Kenneth Moreland
27c4f47411 Boost generates warnings for XCode 7
XCode 7 added a warning for unused typedefs. VTK-m proper does not have
any instances of this, but there are several cases in the Boost code
that we are using. Add an exception to the third party pragmas to
supporess this warning.
2015-09-16 23:32:39 -06:00
Hendrik Schroots
801d4dd1e5 Merge topic 'make_cont_export_macro_be_device_host'
0d6dfb1e Make it possible to use Cuda TextureMemory from device/host method.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !181
2015-09-04 13:50:13 -04:00
Robert Maynard
23b435d031 Update VTK-m to export to Configure.h if we have opengl interop enabled.
At the same time I rearranged the CMakeLists.txt so that the configuration
for Configure.h is later so that it catches all CMake Variables.
2015-09-04 11:43:10 -04:00
Robert Maynard
0d6dfb1e40 Make it possible to use Cuda TextureMemory from device/host method. 2015-09-03 11:52:40 -04:00
Robert Maynard
1906e273d2 Merge branch 'make_cont_export_macro_be_device_host' into 'master'
Revert the VTKM_EXEC_EXPORT changes.

Figuring out a better approach.

See merge request !180
2015-09-02 23:38:45 -04:00
Robert Maynard
8d5765f55f Revert the VTKM_EXEC_EXPORT changes. 2015-09-02 20:01:22 -04:00
Kenneth Moreland
08f9c04fab Add specialization of topology map fetch for regular point coords
In the special case where you are loading the point coordinates for a
structured grid in a point to cell map (an important use case), create a
VecRectilinearPointCoordinates rather than build a Vec of the values.
This will activate the cell specalizations in previous commits.

These changes also added some flat-to-logical index conversion and vice
versa in ConnectivityStructuredInternals. This change also fixed a bug
in getting cells attached to points in 2D grids. (Actually, technically
someone else fixed it and checked it in first. The changes were merged
during a rebase.)

I also added a specalization to Vec for 1D that implicitly converts
between the 1D Vec and the component. This can be convenient when
templating on the Vec length.
2015-09-02 13:54:51 -07:00
Jeremy Meredith
2ae2df9a8f Merge branch 'newtopology' into 'master'
adding cell-to-point topology support and worklet

This adds code to support a cell-to-point topological mapping worklet.

For explicit cell set, there is code to calculate a cell-to-point topology from the canonical point-to-cell topology.  (It is not parallelized at this point.)  Most of the required code for structured grids was already in place.

See merge request !154
2015-09-02 13:34:54 -04:00
Robert Maynard
c8e0e2ca62 VTKM_EXEC_EXPORT now functions as __device__ __host__ 2015-09-02 11:30:16 -04:00
Jeremy Meredith
52458e853f fixing some warnings 2015-09-01 14:03:12 -04:00
Jeremy Meredith
50cfa823ba applying indexing fixes for structured grids 2015-09-01 12:56:32 -04:00
Jeremy Meredith
4a6c9d540f add more fixes to structured indexing 2015-09-01 12:33:26 -04:00
Jeremy Meredith
8999567dd2 fixing 2d structured connectivity calc for logical point indices. 2015-08-28 16:48:24 -04:00
Jeremy Meredith
fc12fbf590 fixing bug in 2d point indexing and adding missing 3d cell-to-point count. 2015-08-28 14:01:26 -04:00
Kenneth Moreland
827b58a8f2 Merge branch 'shape-specific-functions' into 'master'
Shape specific functions

These changes support creating methods that are specific to cell shape in worklets (issue #27).

See merge request !149
2015-08-28 13:21:21 -04:00