Commit Graph

69 Commits

Author SHA1 Message Date
Kitware Robot
cf0cdcf7d1 clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Kenneth Moreland
d3503bfaba Implement AtomicInterfaceControl/Execution with free functions
Now that we have atomic free functions (e.g. `vtkm::AtomicAdd()`), we no
longer need special implementations for control and each execution
device. (Well, technically we do have special implementations for each,
but they are handled with compiler directives in the free functions.)

Convert the old atomic interface classes (`AtomicInterfaceControl` and
`AtomicInterfaceExecution`) to use the new atomic free functions. This
will allow us to test the new atomic functions everywhere that atomics
are used in VTK-m.

Once verified, we can deprecate the old atomic interface classes.
2020-08-20 13:40:44 -06:00
Kenneth Moreland
f6b13df513 Support coordinates of both float32 and float64
Previously there were issues if the coordinate system was using floating
point values that were not FloatDefault. This remedies that issue.
2020-07-14 08:53:01 -06:00
Kenneth Moreland
56bec1dd7b Replace basic ArrayHandle implementation to use Buffers
This encapsulates a lot of the required memory management into the
Buffer object and related code.

Many now unneeded classes were deleted.
2020-06-25 14:02:26 -06:00
Kenneth Moreland
8f7b0d18be Add Buffer class
The buffer class encapsulates the movement of raw C arrays between
host and devices.

The `Buffer` class itself is not associated with any device. Instead,
`Buffer` is used in conjunction with a new templated class named
`DeviceAdapterMemoryManager` that can allocate data on a given
device and transfer data as necessary. `DeviceAdapterMemoryManager`
will eventually replace the more complicated device adapter classes
that manage data on a device.

The code in `DeviceAdapterMemoryManager` is actually enclosed in
virtual methods. This allows us to limit the number of classes that
need to be compiled for a device. Rather, the implementation of
`DeviceAdapterMemoryManager` is compiled once with whatever compiler
is necessary, and then the `RuntimeDeviceInformation` is used to
get the correct object instance.
2020-06-25 14:01:39 -06:00
Kenneth Moreland
4f9fa08fa1 Remove ArrayHandleStreaming capabilities
The `ArrayHandleStreaming` class stems from an old research project
experimenting with bringing data from an `ArrayHandle` in parts and
overlapping device transfer and execution. It works, but only in very
limited contexts. Thus, it is not actually used today. Plus, the feature
requires global indexing to be permutated throughout the worklet
dispatching classes of VTK-m for no further reason.

Because it is not really used, there are other more promising approaches
on the horizon, and it makes further scheduling improvements difficult,
we are removing this functionality.
2020-03-24 15:01:56 -06:00
Robert Maynard
8377806778 Merge topic 'introduce_mapfield_3d_scheduling'
1f1688483 Initial infrastructure to allow WorkletMapField to have 3D scheduling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !1938
2020-02-27 08:02:52 -05:00
Robert Maynard
1f1688483e Initial infrastructure to allow WorkletMapField to have 3D scheduling 2020-02-25 15:23:41 -05:00
Kenneth Moreland
b2fdf236e7 Fix deadlocks in device adapters and low level tests
The new Token functionality makes it easy for a thread to deadlock
itself if it does not detach a token after it is done.
2020-02-25 09:39:27 -07:00
Kenneth Moreland
ad0a53af71 Convert execution preparation to use tokens
Marked the old versions of PrepareFor* that do not use tokens as
deprecated and moved all of the code to use the new versions that
require a token. This makes the scope of the execution object more
explicit so that it will be kept while in use and can potentially be
reclaimed afterward.
2020-02-25 09:39:19 -07:00
Allison Vacanti
1480efaeba Add perf logging to DeviceAdapterAlgorithmSerial. 2019-09-03 14:19:10 -04:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Allison Vacanti
56cc5c3d3a Add support for BitFields.
BitFields are:
- Stored in memory using a contiguous buffer of bits.
- Accessible via portals, a la ArrayHandle.
- Portals operate on individual bits or words.
- Operations may be atomic for safe use from concurrent kernels.

The new BitFieldToUnorderedSet device algorithm produces an ArrayHandle
containing the indices of all set bits, in no particular order.

The new AtomicInterface classes provide an abstraction into bitwise
atomic operations across control and execution environments and are used
to implement the BitPortals.
2019-04-11 08:27:17 -04:00
Robert Maynard
1d20ae4f7b Move DeviceAdapterTag to vtkm/cont 2019-04-04 11:58:51 -04:00
Robert Maynard
45422478cf Refactor VirtualObjectHandle to support new virtual design 2018-10-15 17:38:54 -04:00
Allison Vacanti
024a75821d Make DeviceAdapterId constructor protected.
This forces users to use a defined tag, since they shouldn't need
to create their own.
2018-08-24 16:38:08 -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
Robert Maynard
e031e64967 ExecutionArrayInterfaceBasic<T> explicitly construct DeviceAdapterId objects
Rather than implicitly presume the `VTKM_DEVICE_ADAPTER_` macros can
convert to DeviceAdapterId.
2018-07-25 12:04:30 -04:00
Robert Maynard
86b9ab9969 Refactor ExecutionArrayInterfaceBasic to use inheriting constructors 2018-07-25 12:03:48 -04:00
Kenneth Moreland
91df123055 Remove VTKM_EXEC modifiers from CPU devices
Having VTKM_EXEC on algorithms for CPU devices was problematic because
the algorithms were specific to the CPU, but during a CUDA compile it
would try to compile device code (for no reasons since it was never
called on a device).

Remove these identifiers for the idea that a device implementation knows
specifically what function modifiers to use and does not need the VTK-m
defined catch-alls.
2018-07-11 16:45:30 -06:00
Robert Maynard
8276e35cf4 Mark classes that should not be derived from as final. 2018-06-15 10:49:59 -04:00
Robert Maynard
e28244f345 Re-implement DeviceAdapterRuntimeDetector to avoid ODR violations.
The previous implementation of DeviceAdapterRuntimeDetector caused
multiple differing definitions of the same class to exist and
was causing the runtime device tracker to report CUDA as disabled
when it actually was enabled.

The ODR was caused by having a default implementation for
DeviceAdapterRuntimeDetector and a specific specialization for
CUDA. If a library had both CUDA and C++ sources it would pick up
both implementations and would have undefined behavior. In general
it would think the CUDA backend was disabled.

To avoid this kind of situation in the future I have reworked VTK-m
so that each device adapter must implement DeviceAdapterRuntimeDetector
for that device.
2018-05-15 13:08:34 -04:00
Robert Maynard
8808b41fbd Merge branch 'master' into vtk-m-cmake_refactor 2018-03-29 22:51:26 -04:00
Robert Maynard
ee69c7a4b7 Remove VS2013 workarounds from VTK-m. 2018-02-23 15:39:39 -05:00
Robert Maynard
e630ac5aa4 Merge branch 'master' into vtk-m-cmake_refactor 2018-02-23 14:52:00 -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
Robert Maynard
d70c31d449 Serial ScanInclusive now makes sure to always use WrappedBinaryOperator.
By using WrappedBinaryOperator we will not get warnings on vs2017 when
scanning <32bit arrays, and at the same time also properly support
fancy arrays.
2018-01-30 11:57:13 -05:00
Robert Maynard
ef611239f6 Don't allow DeviceTaskTypes to construct tasks from rvalues. 2018-01-18 13:55:37 -05:00
Robert Maynard
7d7c6ab1ab Don't allow DeviceTaskTypes to construct tasks from rvalues. 2018-01-18 13:51:30 -05:00
Robert Maynard
9c668b61e0 Simplify how we built the list of source files for vtkm_cont 2018-01-17 17:13:50 -05:00
Robert Maynard
0660c67fef Merge branch 'master' into vtk-m-cmake_refactor 2018-01-16 15:42:28 -05:00
Matthew Letter
e17cfddfc8 added vtkm_cont_EXPORTS flag into the build
cuda, serial, and tbb were missing the vtkm_cont_EXPORTS flag
2018-01-08 14:00:58 -05:00
Robert Maynard
afc19ab0fc Setup symbol visibility controls for VTK-m 2018-01-08 14:00:57 -05:00
Robert Maynard
93bc0198fe Suppress false positive warnings about calling host device functions. 2018-01-02 10:40:49 -05:00
Matthew Letter
fac43bd812 Merge branch 'master' into cmake_refactor 2017-11-28 13:36:02 -07:00
Sujin Philip
8c242cef91 Switch from faux to true virtuals 2017-11-06 15:25:29 -05:00
Robert Maynard
27d1275249 Correct issues on windows with debug tests timing out.
The tests actually raised a std assert which was causing a timeout as it
required user intervention to click through.
2017-10-31 13:35:13 -04:00
Robert Maynard
ed8f4111ef Update all the code to work with CMake 3.3
Obviously this does mean that CUDA is not supported with 3.3.
2017-10-27 15:30:14 -04:00
Robert Maynard
56c7362258 A thought on what CMake 3.9 would mean to VTK-m. 2017-10-27 15:29:51 -04:00
Allison Vacanti
6c2f22b5ce Overcome narrowing warning on MSVC. 2017-10-11 17:24:04 -04:00
Allison Vacanti
1018d981a0 Check for overlap in CopySubRange.
Some parallel copy implementations will not handle this sanely.
2017-10-11 16:52:32 -04:00
Allison Vacanti
825f351d04 Use std::copy in serial Copy implementation.
I had assumed that the compiler would be clever enough to turn the
iterative implementation of Copy into a memcpy, but inspecting the
disassembly on a release GCC build shows that this is not the case,
likely because it can't assume that the memory ranges do not overlap.

Replacing the loop with std::copy speeds things up (about 30-50%) for
most data types, though there is a slight (usually < 5%) slowdown for
Vec types. The uint8 copy improved by a factor of 8.

Comparison:
| Speedup | iteration            | std::copy            | Benchmark (Type) |
|---------|----------------------|----------------------|------------------|
|   1.363 | 0.001590 +- 0.000087 | 0.001166 +- 0.000049 | Copy 2097152 values (vtkm::Float32) |
|   1.487 | 0.003429 +- 0.000185 | 0.002305 +- 0.000146 | Copy 2097152 values (vtkm::Float64) |
|   1.379 | 0.001568 +- 0.000072 | 0.001137 +- 0.000093 | Copy 2097152 values (vtkm::Int32) |
|   1.420 | 0.003410 +- 0.000173 | 0.002402 +- 0.000101 | Copy 2097152 values (vtkm::Int64) |
|   1.303 | 0.001564 +- 0.000083 | 0.001201 +- 0.000078 | Copy 2097152 values (vtkm::UInt32) |
|   7.204 | 0.002441 +- 0.000104 | 0.000339 +- 0.000029 | Copy 2097152 values (vtkm::UInt8) |
|   0.987 | 0.006602 +- 0.000266 | 0.006688 +- 0.000291 | Copy 2097152 values (vtkm::Vec< vtkm::Float32, 4 >) |
|   0.965 | 0.010065 +- 0.000528 | 0.010427 +- 0.000617 | Copy 2097152 values (vtkm::Vec< vtkm::Float64, 3 >) |
|   0.979 | 0.003327 +- 0.000191 | 0.003398 +- 0.000142 | Copy 2097152 values (vtkm::Vec< vtkm::Int32, 2 >) |
|   0.851 | 0.001579 +- 0.000090 | 0.001856 +- 0.000098 | Copy 2097152 values (vtkm::Vec< vtkm::UInt8, 4 >) |
2017-10-11 16:52:32 -04:00
Robert Maynard
34361dd15a DeviceAdapterAlgorithmSerial ReduceByKey handles zero size key/values 2017-10-10 10:12:59 -04:00
Allison Vacanti
75f88b4c46 Add versioning to VTKM installed include/share dirs. 2017-10-02 11:39:10 -04:00
Robert Maynard
311618a15f Enable highest level of warnings(W4) under MSVC
This will make VTK-m warning level match the one used by VTK. This commit
also resolves the first round of warnings that W4 exposes.
2017-09-22 13:04:28 -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
0b36596fd5 Merge topic '173_tbb_unique'
3b03177c Add TBB specialization of Unique.
94d668dd Add serial version of Unique.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !933
2017-09-20 14:35:08 -04:00
Allison Vacanti
81979ae08f Specialize CopyIf for serial backend. 2017-09-19 11:08:22 -04:00
Allison Vacanti
94d668dddf Add serial version of Unique.
Rather than falling back to the parallel-oriented algorithm in
DeviceAdapterGeneral, use std::unique.
2017-09-18 12:16:12 -04:00
Robert Maynard
f68635941e Convert VTK-m over to use 'using' instead of 'typedef' 2017-08-17 10:47:25 -04:00