Commit Graph

650 Commits

Author SHA1 Message Date
mclarsen
0e7e51a1ce resolving merge conflict 2018-09-12 18:58:33 -07:00
mclarsen
1c2f78ca92 refactoring ray tracing 2018-09-10 19:25:42 -07:00
Kenneth Moreland
2b05487398 Add ExecutionAndControlObjectBase
This is a subclass of ExecutionObject and a superset of its
functionality. In addition to having a PrepareForExecution method, it
also has a PrepareForControl method that gets an object appropriate for
the control environment. This is helpful for situations where you need
code to work in both environments, such as the functor in an
ArrayHandleTransform.

Also added several runtime checks for execution objects and execution
and cotnrol objects.
2018-09-08 11:54:28 -06:00
Kenneth Moreland
98a0a20feb Allow ArrayHandleTransform to work with ExecObject
This change allows you to set a subclass of
vtkm::cont::ExecutionObjectBase as a functor
used in ArrayHandleTransform. This latter class will then detect that
the functor is an ExecObject and will call PrepareForExecution with the
appropriate device to get the actual Functor object.

This change allows you to use virtual objects and other device dependent
objects as functors for ArrayHandleTransform without knowing a priori
what device the portal will be used on.
2018-09-05 13:11:04 -06:00
Kenneth Moreland
d879188de0 Make DispatcherBase invoke using a TryExecute
Rather than force all dispatchers to be templated on a device adapter,
instead use a TryExecute internally within the invoke to select a device
adapter.

Because this removes the need to declare a device when invoking a
worklet, this commit also removes the need to declare a device in
several other areas of the code.
2018-08-29 19:18:54 -07:00
Kenneth Moreland
9841d0e2c5 Add ArrayHandleView
Adds a fancy array handle that restricts access to an array to some
window of values. It takes a start offset and a size and represents the
values between that start offset and size past that.
2018-08-29 13:54:31 -07:00
Allison Vacanti
b124984817 Rename Undefined and Any DeviceAdapterId subclasses for consistency. 2018-08-29 09:05:50 -07:00
Allison Vacanti
716f393c32 Add DeviceAdapterId::GetName. 2018-08-28 14:14:49 -07: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
Allison Vacanti
669ccb9130 Refactor CellSetExplicit to store connectivity in a shared_ptr.
This addresses issue #268 by ensuring that the CellToPoint validity
flag survives FunctionInterface's value copies.
2018-08-23 11:13:13 -04:00
Robert Maynard
c4fa66aff4 Merge topic 'better_runtime_device_representation'
554bc3d36 At runtime TryExecute supports a specific deviceId to execute on.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !1334
2018-08-08 12:41:32 -04:00
luz.paz
7f9b54a31a Misc. typos
Found via `codespell -q 3`
2018-08-07 17:50:41 -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
3533975694 Remove usages of std::vector from OpenMP reduction algorithm
The OpenMP Device Reduction algorithm previously used a std::vector<T>
to store the reduction results of each thread. This caused problems
when T=bool as the types became a proxy type which isn't usable
with vtkm BinaryOperators.

Additionally by fixing this issue in the FunctorsOpenMP we
can remove a workaround in FunctorsGeneral that caused
compile failures when using complex BinaryOperators
such as MinAndMax.
2018-08-06 13:08:33 -04:00
Haocheng LIU
1fcbca3eed Replace std::random_shuffle with std::shuffle
std::random_shuffle is deprecated in C++14 because it's using std::rand
which uses a non uniform distribution and the underlying algorithm is
unspecified. Using std::shuffle can provide a reliable result in a 64
bit version.
2018-08-02 12:15:58 -04:00
Sujin Philip
259d670ab5 Merge topic 'cuda-per-thread-streams-2'
06dee259f Minimize cuda synchronizations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !1288
2018-07-25 15:07:39 -04:00
Robert Maynard
4ca4c17415 DeviceAdapterTagTestAlgorithmGeneral Id is positive value.
All valid devices must use a positive integer value as the
RuntimeTracker and VirtualObject consider all negative values
to be errors.
2018-07-25 14:09:00 -04:00
Robert Maynard
b51c773766 Allow ArrayHandleBasicImpl to work when we add new devices
Previously ArrayHandleBasicImpl had no support for OpenMP since
we forgot to update the implementation. This version will
work when adding new devices without any changes.
2018-07-25 12:57:27 -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
b4bfb95131 Merge topic 'atomic-array-device-execution'
96ae94420 Simplified execution object creation for atomic array
0bd197af9 moved TwoLevelUniformGridExecutionObject to vtkm/exec/internal
6ce895be8 simplified how atomic arrays create execution objects
f1ee5b92a fix a rebase error
25d140361 fix bad rabse for wireframer
f892695f1 fixing so wierd merging issue
9bb00ec66 moved the execution object for TwoLevelUniform grid to vrkm::exec
db1c9bfee Change the namespacing of atomic array
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !1243
2018-07-18 18:08:05 -04:00
Robert Maynard
6dc06423d8 ColorTable can provide vtkm::exec::Colortable to a specific device
Previously it wasn't possible to get a color table transfered
to a specific device.
2018-07-12 10:28:18 -04:00
Kenneth Moreland
3b828608a4 Support ExecArg behavior in vtkm::cont::Algorithm methods
Most of the arguments given to device adapter algorithms are actually
control-side arguments that get converted to execution objects internally
(usually a `vtkm::cont::ArrayHandle`). However, some of the algorithms,
take an argument that is passed directly to the execution environment, such
as the predicate argument of `Sort`. If the argument is a plain-old-data
(POD) type, which is common enough, then you can just pass the object
straight through. However, if the object has any special elements that have
to be transferred to the execution environment, such as internal arrays,
passing this to the `vtkm::cont::Algorithm` functions becomes
problematic.

To cover this use case, all the `vtkm::cont::Algorithm` functions now
support automatically transferring objects that support the `ExecObject`
worklet convention. If any argument to any of the `vtkm::cont::Algorithm`
functions inherits from `vtkm::cont::ExecutionObjectBase`, then the
`PrepareForExecution` method is called with the device the algorithm is
running on, which allows these device-specific objects to be used without
the hassle of creating a `TryExecute`.
2018-07-06 18:57:54 +02:00
Matthew Letter
f892695f16 fixing so wierd merging issue
somehow a rebase removed code that shouldnt have been removed so I added the code back in, gonna see if I can squash this commit later
2018-07-03 14:28:29 -06:00
Sujin Philip
06dee259f7 Minimize cuda synchronizations
1. Have a per-thread pinned array for cuda errors
2. Check for errors before scheduling new tasks and at explicit sync points
3. Remove explicit synchronizations from most places

Addresses part 2 of #168
2018-07-03 14:19:06 -04:00
Matthew Letter
db1c9bfeee Change the namespacing of atomic array
moved the execution object to vtkm::exec and AtomicArray to vtkm::cont
2018-07-02 16:25:48 -06:00
Matthew Letter
6b9cb536a8 added new lines at the end of bot recommended files 2018-07-02 16:21:00 -06:00
Matthew Letter
3c9e7f049f updated Atomic array to use new excution object paradigm 2018-07-02 16:21:00 -06:00
Kenneth Moreland
71486f0864 Fix TestingPointLocatorUniformGrid for double precision
There was an error in TestingPointLocatorUniformGrid in which it was
creating arrays of type vtkm::Float32 and passing them to a worklet that
expected vtkm::FloatDefault. This is corrected.
2018-07-01 11:27:35 +02:00
ayenpure
e2dccee099 Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into spatialsearch 2018-06-30 11:56:33 -06:00
Kenneth Moreland
6f75cd008b Fix crash in CUDA compiler
Previously when PointLocatorUniformGrid.h was compiled by the CUDA
compiler, the compiler would crash. Apparently during the ptxas
part of the compiler goes into a crazy recursion and runs out of
stack space. This appears to be a long-standing bug in CUDA
(been there for multiple releases) without a clear reason why it
sometimes rears its ugly head. (See for example
https://devtalk.nvidia.com/default/topic/1028825/cuda-programming-and-performance/-ptxas-died-with-status-0xc00000fd-stack_overflow-/)

The problem appears to be when having a doubly or triply nested
loop over a box of values to check in the uniform array. This
appears to fix the problem by converting that to a single for
loop with some index magic to convert that to 3D indices.
2018-06-27 23:52:48 +02:00
Kenneth Moreland
439beaaed9 Make point locator tests have consistent devices 2018-06-27 10:37:59 +02:00
Li-Ta Lo
9c2fdd5745 infinite loop at ptxas 2018-06-26 13:35:22 -06:00
Li-Ta Lo
8df78aedc7 TestingPointLocatorUniformGrid works for serial backend 2018-06-25 14:17:33 -06:00
Li-Ta Lo
c4921c0e7a fixed all most of compiler error, able to print something from point locator on execution side 2018-06-22 17:11:03 -06:00
Li-Ta Lo
1165845422 commit before mergin master 2018-06-22 14:18:55 -06:00
Li-Ta Lo
2e519f6508 Merge branch 'pointlocator' into pointlocator2 2018-06-19 12:06:54 -06:00
ayenpure
d8e8078099 Fixing the typos with ScanExclusiveByKey
- Fixed the typo
- Moved the test to vtkm/worklet/testing as vtkm/cont/testing does not execute with CUDA
2018-06-15 16:39:00 -07:00
luz.paz
940c891886 Misc. typos
Found via `codespell` and `grep`
more typos

includes source typo change and a typo that needs further review
follow-up typos


Follow-up typos


Revert a commit
2018-06-14 16:49:11 -04:00
ayenpure
671987148f Adding working implementation of BIH with test
- Uses smart pointers
  - need to get rid of them
2018-06-13 15:08:15 -07:00
Haocheng LIU
86f22bf47f Add a release resources API to CellSet and its derived classes 2018-06-12 11:44:18 -04:00
Kenneth Moreland
e62091a619 Add ability to "allocate" implicit storage
Previously, it was not possible to call Allocate or Shrink on an
implicit storage. The reason for this is that the implicit storage does
not represent any real memory and any attempt to modify it is wrong.

However, there are some rare cases where ArrayHandle will attempt to
"allocate" the storage even when behaving in a read-only manner. The use
case this is being created for is when an ArrayHandleImplicit first
calls ReleaseResources and then calls ReleaseResourcesExecution (or
anything else that tries to get a control-side portal). In this case,
the ReleaseResources makes the control side portal invalid and the
ReleaseResourcesExecution attempts to make it valid again by allocating
the storage to size 0. This change solves the problem by allowing the
implicit storage to be "allocated" to something smaller than originally
created.
2018-06-05 17:07:44 -05:00
Kenneth Moreland
9d16fadfc3 Merge topic 'vec-initializer-lists'
157894436 Enable Vec construction with intializer_list of single value
79afe2a16 Simplify make_ArrayHandleSwizzle
ae8d994d2 Add support for initializer lists in Vec

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti <allison.vacanti@kitware.com>
Merge-request: !1239
2018-06-05 12:26:21 -04:00
ayenpure
61fdfac710 Adding updated CellLocator / PointLocator APIs
- Adding API files
- Adding back Manish's BoundingIntervalHierarchy search structure
- Updating CMakeLists.txt to accomodate these changes
- Adding the old test file from Manish - won't build for now
2018-06-04 20:04:38 -07:00
ayenpure
18579394ed Moving Files for proper CellLocator/PointLocator APIs
-Changing the existing CellLocator.h to CellLocatorHelper.h,
 it's used by CellLocatorTwoLevelUniformGrid.h

-Changing unit tests and worklets that use CellLocator.h to use CellLocatorHelper.h
2018-06-04 19:51:54 -07:00
Allison Vacanti
d833d9285f Merge topic 'openmp'
183bcf109 Add initial version of an OpenMP backend.
7b5ad3e80 Expand device scheduler test to check for overlap.
e621b6ba3 Generalize the TBB radix sort implementation.
d60278434 Specialize swap for ArrayPortalValueReference types.
761f8986f Cache inputs to SSI::Unique benchmark.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !1099
2018-05-31 16:49:15 -04:00
Kenneth Moreland
79afe2a169 Simplify make_ArrayHandleSwizzle
Create a form that allows you to enumerate the indices as arguments
rather than having to construct a Vec.
2018-05-30 17:07:06 -06:00
Haocheng LIU
7d226a4666 Add a common API for CoordinateSystem to unload execution resources
This commit also fixes a bug that ArrayTransfer of ArrayHandleVirtualCoordinate
does not release execution resources properly.
2018-05-30 17:25:54 -04:00
Shreeraj Jadhav
6e099b7c09 Fix issue #110 TestingDeviceAdapter uniform_int_distribution
This fix addresses issue #110. Test functions in TestingDeviceAdapter have
been updated to test large arrays through random indices using
std::uniform_int_distribution rather than testing every 100th or 50th value.
2018-05-30 11:04:02 -04:00
Allison Vacanti
7b5ad3e80c Expand device scheduler test to check for overlap.
Add a test that fails if DeviceAdapterAlgorithm::Schedule
executes the same instance twice. Useful for checking block
scheduling algorithms.
2018-05-29 14:49:44 -04:00