Commit Graph

256 Commits

Author SHA1 Message Date
Kenneth Moreland
3b9bb5ffeb Merge branch 'math' into 'master'
Math

Adds a set of portable math functions, most of which are "expected" to be available and are typically useful. They include things like trigonometry (sin, cos, tan, etc.), floating point information (nan, finite, etc), and min/max.

See merge request !58
2015-06-27 20:29:49 -04:00
Kenneth Moreland
4a8d69ca66 Add CUDA math test
Also fix some issues that caused the compile to fail when trying to
run some of the math functions on a CUDA device. In particular, CUDA
is picky about using a global const on a device when the const type is
not one of the basic C types.
2015-06-25 13:54:24 -06:00
Robert Maynard
47f9874132 Extend the array handle testing to be done on a per device basis.
Now we test ArrayHandle with all the vtkm types to make sure all the
transfer logic / access logic works for all T types.
2015-06-25 08:21:49 -04:00
Robert Maynard
6b70893b96 Merge branch 'clarify_unary_and_binary_operator_names' into 'master'
Clarify unary and binary operator names

Fixes the naming issues brought up in Issue #6.

See merge request !54
2015-06-23 15:49:03 -04:00
Robert Maynard
459552d795 Update the name of the binary functor for UpperBounds 2015-06-23 09:19:09 -04:00
Robert Maynard
3cbac03810 Update the name of the binary functor Unique 2015-06-23 08:58:53 -04:00
Robert Maynard
e6cadef457 Update the name of the unary functor for StreamCompact. 2015-06-23 08:56:18 -04:00
Robert Maynard
7ee3084868 Update the name of the binary functor for Sort. 2015-06-23 08:36:42 -04:00
Robert Maynard
604289c1ce Update the name of the binary functor for ScanInclusive 2015-06-23 08:26:04 -04:00
Robert Maynard
8ba0dacc65 Update the name of the binary functor for Reduce. 2015-06-22 11:55:02 -04:00
Robert Maynard
0901e71574 Update the name of the binary comparison for LowerBounds. 2015-06-22 11:49:11 -04:00
Robert Maynard
2a66dec110 Correct a bug in the logic of determining the block size. 2015-06-22 08:51:25 -04:00
Robert Maynard
fa78610ea1 Remove inclusion of iostream header. 2015-06-19 13:03:56 -04:00
Robert Maynard
6c3f669398 Remove dead code for converting zip handles to iterators for cuda.
This code isn't needed anymore as the new iterator facade handles this
use case properly.
2015-06-18 13:53:02 -04:00
Robert Maynard
9d350fb023 Correct undefined behavior that was causing scan test failures.
We need call PrepareForInput on the input argument before invoking a function.
The order of execution of parameters of a function is undefined, so we need to
make sure input is called before output, or else in-place use case breaks.
2015-06-17 15:35:27 -04:00
Robert Maynard
2ce14c7760 DeviceAdapter's now properly init all value types.
This is needed when use vtkm::Vec, as it doesn't zero the memory it contains.
2015-06-16 08:35:04 -04:00
Robert Maynard
2c91cdfa3b Update cuda/thrust backend scan algorithms to work with vec types. 2015-06-16 08:28:31 -04:00
Chun-Ming Chen
360279c29a A more general Copy that allows copying into a diff. array type. Testing codes are added. 2015-06-12 12:42:43 -04:00
Robert Maynard
2a2159b1e1 Generalize the support for zip handles inside the cuda backend.
Instead of having a single specialization for sort and zip handles,
we know handle any fancy handles being passed to the cuda device adapter.
This was done by reworking how we represent fancy iterators inside thrust,
and instead of using a transform iterator + counting iterator we just use
a iterator_facade.
2015-06-12 11:56:46 -04:00
Robert Maynard
d26cfcf5cc Merge branch 'sort_inplace_zip_arrays' into 'master'
Allow in-place sorting of ArrayHandleZip

See merge request !29
2015-06-10 15:51:40 -04:00
Robert Maynard
c052400ffb CUDA now converts ArrayHandleZip to ::thrust::zip iterator.
This is required so that we can use ArrayHandleZip with Sort/Reduce and
custom comparison operators. ArrayZip and PortalValue don't combine
well together, when used with DeviceAlgorithm that has a custom operator.
The custom operator is actually passed the PortalValue instead of
the real values, and by that point we can't fix anything since we
don't know what the original operator is.
2015-06-10 14:15:40 -04:00
Robert Maynard
549a7dd7c7 Adding support to cuda backend to write to a ZipHandle. 2015-06-10 14:15:40 -04:00
Robert Maynard
040d7e761e Explicitly invoke all thrust algorithms using the cuda policy.
This is required if we ever want to use thrust from another device adapter.
2015-06-10 09:41:06 -04:00
Robert Maynard
3a532160c9 cuda device adapter now support different value types for keys and values. 2015-06-01 17:19:33 -04:00
Robert Maynard
07970cf476 Correct all signed / unsigned and narrowing warnings ( 64bit to 32bit ). 2015-05-28 09:05:17 -04:00
Robert Maynard
d54aee7eb5 Merge branch 'fix_typo_in_copyright' 2015-05-21 10:32:08 -04:00
Robert Maynard
6b8e7822be The Copyright statement now has all the periods in the correct location. 2015-05-21 10:30:11 -04:00
Robert Maynard
f2b47ffd4a Add ReduceByKey to the DeviceAdapter. 2015-05-21 08:23:28 -04:00
Robert Maynard
be193542ac Introduce StreamCompact with a custom stencil unary predicate. 2015-05-21 08:23:28 -04:00
Robert Maynard
e38caafe37 Adding Reduce with custom operator to the DeviceAdapterAlgorithm. 2015-05-14 15:16:49 -04:00
Robert Maynard
5d9f369d0c Adding ScanInclusive with custom binary operator to DeviceAdapterAlgorithm. 2015-05-14 15:16:49 -04:00
Robert Maynard
9519737b3a Adding Reduce to the DeviceAdapterAlgorithm. 2015-05-14 15:16:49 -04:00
Robert Maynard
fbee20fc03 Mark the local value for the result of GetNumberOfValues as const.
We aren't modifying the value, so no reason to not have it as const.
2015-05-14 15:16:48 -04:00
Robert Maynard
59618b3a50 Merge branch 'sort_by_key' 2015-05-11 08:04:09 -04:00
Kenneth Moreland
66aa10aab7 Fix issues with warnings about data loss from type conversion
Fix compile warnings that come up with the flags

  -Wconversion -Wno-sign-conversion

This catches several instances (mostly in the testing framework) where
types are implicitly converted. I expect these changes to fix some of
the warnings we are seeing in MSVC.

I was going to add these flags to the list of extra warning flags, but
unfortunately the Thrust library has several warnings of these types,
and I don't know a good way to turn on the warnings for our code but
turn them off for Thrust.
2015-05-07 16:34:06 -06:00
Robert Maynard
6564d7af1c Enable SortByKey Test on the Device Adapter. 2015-05-06 09:27:59 -04:00
Robert Maynard
c2f2c166c0 Test all Fancy ArrayHandles and Array Portals on every device adapter.
Fancy array handles being Counting, Implicit, Permutation, Transform, and Zip.
2015-05-05 14:25:48 -04:00
Kenneth Moreland
d15074153d Remove comments about textures from ArrayManagerExecutionThrustDevice
Per a discussion with Robert Maynard, we no longer have plans to bind
textures or use texture objects. Instead, we are now using the __ldg
command to load from global memory inside the execution portal, which
gives us most of the benefits of textures, but doesn't incur any
bookkeeping.
2015-05-04 14:18:00 -06:00
Kenneth Moreland
e14fc427f0 Change storage references to storage pointers.
Previously ArrayTransfer and ArrayManagerExecution received a reference
to a Storage class in their constructor and held the reference as an
ivar. In retrospect, this is just asking for trouble. First, it is way
too easy to pass by value when you mean to pass by reference. Second, if
there ever is a bug where the Storage goes out of scope before the
classes holding a reference, it is that much harder to debug.
2015-04-30 21:29:58 -06:00
Kenneth Moreland
ec0adf8b16 Change interface of ArrayTransfer to be more like ArrayHandle.
This includes changing methods like LoadDataForInput to PrepareForInput.
It also changed the interface a bit to save a reference to the storage
object. (Maybe it would be better to save a pointer?) These changes also
extend up to the ArrayManagerExecution class, so it can effect device
adapter implementations.
2015-04-30 21:07:36 -06:00
Kenneth Moreland
c5b831b726 Remove LoadDataForInput that takes portals.
This API change effects both ArrayTransfer and ArrayManagerExecution.
This is in preparation for a future change to make the API more
consistent with ArrayHandle.
2015-04-28 11:30:30 -04:00
Robert Maynard
30c5ee9cf4 Remove SetThrustForCuda as we explicitly use the thrust cuda system.
The only reason SetThrustForCuda was ever needed was that we used
::thrust::device_vector instead of ::thrust::system::cuda::vector.
2015-04-23 09:23:41 -04:00
Robert Maynard
c806348c94 Remove debug code from cuda schedule algorithm. 2015-04-16 08:56:08 -04:00
Robert Maynard
3a10a63e8c make sure the 3d block size makes sense. 2015-04-08 15:57:35 -04:00
Robert Maynard
fdac208acb use cuda scheduling versus thrust scheduling. 2015-04-03 10:18:05 -04:00
Robert Maynard
d340a573d9 don't clear ::thrust::vectors as that is not our intended behavior. 2015-03-23 09:01:42 -04:00
Robert Maynard
86dc8f1d38 Move back to thrust::cuda::vector to properly handle allocating uint8's
Our approach of using the underlying allocator inside thrust was a bad approach,
for some reason it fails to properly allocate uint8's or int8's on the correct
boundaries. I expect that this logic is somewhere else in the code and
instead we should use thrust::system::cuda::vector which does this properly.
2015-03-10 10:10:03 -04:00
Robert Maynard
63b1f03187 Simplify the implementation of loading through textures.
We don't need this super complicated system for texture loading.
2015-03-09 16:37:45 -04:00
Robert Maynard
9b49973621 Use __ldg instead of texture object. 2015-03-05 18:31:44 -05:00
Robert Maynard
3c8ce36666 Properly deallocate cuda memory when we are done with it. 2015-01-28 15:54:45 -05:00
Robert Maynard
46df484ca7 Redesign the way we implement when to choose texture portals.
The logic to select texture portals is easier to understand now.
2015-01-20 13:58:28 -05:00
Robert Maynard
e26040282b Properly map TexturePortals to Iterators.
Also at the same time disable the Texture support by default.
2015-01-20 13:58:28 -05:00
Robert Maynard
04bc41cad3 Fix multiple issue in the cuda array handle unit tests.
The namespaces need to be different for each test, or else only the first
implementation of the function will be used for all tests that call that
function.

Also updated the test to verify that we can count starting from a non zero
number.
2015-01-20 09:03:24 -05:00
Robert Maynard
1b5c5a6ce5 Add in initial support for texture binding of input arrays. 2014-12-19 13:47:28 -05:00
Robert Maynard
a509dae909 Use pinned memory for error reporting on the cuda backend.
This reduces the amount of explicit cuda Device to Host memory copies.
2014-12-19 13:47:28 -05:00
Robert Maynard
d9270e408d Adding a cuda device adapter to vtkm.
Porting the dax device adapter over to vtkm. Unlike the dax version, doesn't
use the thrust::device_vector, but instead uses thrust::system calls so that
we can support multiple thrust based backends.

Also this has Texture Memory support for input array handles. Some more work
will need to be done to ArrayHandle so that everything works when using an
ArrayHandle inplace with texture memory bindings.
2014-12-19 13:47:28 -05:00