Commit Graph

148 Commits

Author SHA1 Message Date
Kenneth Moreland
5c1352872a Remove VTKm_BUILD_SHARED_LIBS from Configure.h
It is not really necessary.
2016-09-08 07:58:04 -06:00
Kenneth Moreland
7e0ec48cab Enable building shared libraries 2016-09-07 16:48:09 -06:00
Kenneth Moreland
0c8919dc6a Add VTKM_OVERRIDE macro
This is using the C++11 override keyword to make the compiler check to
ensure that we are correctly overriding virtual methods when we mean to.
Currently this will not compile without C++11. However, we are planning
on moving to C++11 very soon, and we can fix the macro if we don't.
2016-09-07 16:47:39 -06:00
Robert Maynard
1881d375f5 Explicitly error out if vtk-m is used with a non c++11 compiler. 2016-09-01 09:45:43 -04:00
Robert Maynard
12810165bb Switch over to c++11 type_traits. 2016-08-31 16:11:26 -04:00
Robert Maynard
0f545c53e3 Merge topic 'now_can_build_with_cxx11'
a6609311 Silence auto_ptr deprecation warnings with older boosts ( < 1.61 )
6d38f44d Update ListTag and DispatcherBase to leverage C++11 features.
ea0d84a8 Remove VTK-m Variadic defines and replace them with a single CXX11 define
77121d18 Add support to VTK-m to build with C++11

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !475
2016-08-05 16:03:35 -04:00
Sujin Philip
746d6fc7b2 Fix configuration of vectorization
1. Re-enable vectorization setup in cmake
2. Set vectorization flags to empty when "none" is specified.
2016-08-03 16:07:21 -04:00
Robert Maynard
a6609311fa Silence auto_ptr deprecation warnings with older boosts ( < 1.61 ) 2016-08-03 15:38:38 -04:00
Robert Maynard
6d38f44d6c Update ListTag and DispatcherBase to leverage C++11 features. 2016-08-03 15:38:38 -04:00
Robert Maynard
ea0d84a810 Remove VTK-m Variadic defines and replace them with a single CXX11 define 2016-08-03 15:38:38 -04:00
Robert Maynard
4ca6ce2ad6 nvcc doesn't have troubles with boost shared_ptr optimizations 2016-07-19 13:26:23 -04:00
Robert Maynard
76cd2ac4da More corrections needed to suppress false positive host / device warnings. 2016-06-30 16:04:37 -04:00
Kenneth Moreland
eb8ca27932 VTKM_SUPPRESS_EXEC_WARNINGS was in the wrong place
The VTKM_SUPPRESS_EXEC_WARNINGS should go before the template keyword,
but on a couple of methods in FunctionInterfaceDetailPre.h.in it was
after the template keyword.
2016-06-27 13:08:35 -06:00
Kenneth Moreland
4c272b5b43 Remove thrust warnings about type conversion
Add pragmas to disable warnings 4244 and 4800 on Visual Studio when
compiling third party libraries. This gets around some warnings inside
the thrust library.
2016-06-27 07:50:17 -06:00
Kenneth Moreland
5d67b918dc Use CMakePackageConfigHelpers to make config files
This is a little tricky since they don't seem to have considered that
you will have files in both the source and build directory or that the
file locations will not match exactly with the install locations.
2016-06-21 18:03:21 -06:00
Robert Maynard
a2f5278f12 Disable VTKM_ASSUME when inside CUDA code compiled with VisualStudio.
We have found a bug inside NVCC/VS where it will generate bad PTX code when
it encounters __assume.
2016-06-09 13:29:14 -04:00
Kenneth Moreland
4ae3a20dfc Add test to check that all source files are part of the build system
The test is a simple CMake script that finds all files in the build
directory with certain extensions (.h, .cxx, etc.) and makes sure that
the filename is listed somewhere in the CMakeLists.txt file of the same
directory. If the filename is listed in the CMakeLists.txt file, then
there is a good chance it is being addressed by the build.

This should help catch when header files are not being installed. It also
should help verify that test builds are being done on all files. It will
also highlight dead source files.
2016-06-02 10:23:37 -06:00
Robert Maynard
08b888f703 Improve the compile speed and binary output by tweaking FunctionInterface. 2016-05-04 14:48:42 -04:00
Kenneth Moreland
ab765be785 Merge branch 'msvc-warnings' into 'master'
Fix MSVC Warnings

Fix some warnings that were happening with the MSVC compiler.

See merge request !409
2016-05-04 13:53:39 -04:00
Kenneth Moreland
e27e955931 Turn off warning for fill_n on MSVC
MSVC has a warning for using "unsafe" algorithms such as fill_n that can
easily overrun the end of unchecked pointers. The problem is that there
are lots of valid uses of these algorithms, and the signal that this is
a valid use is MSVC-specific. Even less fortunate is the fact that if
another header violates the warning, it is impossible to suppress it
because it happens in a system header file (xutility), which was included
far before the actual offending code occured. Even less fortunate than
that, a boost header we (indirectly) use sets off this warning, cannot
be suppressed, and is not going to be fixed
(https://svn.boost.org/trac/boost/ticket/11426). The best solution is to
turn off this problematic warning for everybody.
2016-05-04 07:58:25 -06:00
Robert Maynard
e5d3095102 Solve the ParametricCoordinates issue by using VTKM_ASSUME. 2016-04-28 11:15:43 -04:00
Robert Maynard
d22c7794f8 Merge topic 'windows_long_symbol_warning_suppression'
6154e19a Explicitly disable warning C4503 when building with MSVC.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !401
2016-04-26 21:31:48 -04:00
Robert Maynard
6154e19a66 Explicitly disable warning C4503 when building with MSVC. 2016-04-26 12:43:22 -04:00
Kenneth Moreland
cc497e6a1b Remove cont/Assert.h and exec/Assert.h
These asserts are consolidated into the unified Assert.h. Also made some
minor edits to add asserts where appropriate and a little bit of
reconfiguring as found.
2016-04-20 15:41:14 -06:00
T.J. Corona
c24d439532 Change max # of cells associated with a point in a 3-D grid from 6 to 8. 2016-04-13 17:44:29 -04:00
Robert Maynard
3eec5e86df ICC: disable vectorization as both ivdep and simd generate bad code.
We are disabling the entire vectorization hints for ICC as it generates
both bad code, and dramatically decreases compile time.

The compiler does not check for aliasing or dependencies that might cause
incorrect results after vectorization, and it does not protect against illegal
memory references. #pragma ivdep overrides potential dependencies, but the
compiler still performs a dependency analysis, and will not vectorize if it
finds a proven dependency that would affect results. With #pragma simd, the
compiler does no such analysis, and tries to vectorize regardless.
2016-03-23 14:10:18 -04:00
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