Commit Graph

1243 Commits

Author SHA1 Message Date
Kenneth Moreland
37d0100828 Merge topic 'correct-simple-unique'
7a2ef646 Correct the implementation of DeviceAdapterAlgorithmGeneral::Unique

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti <allison.vacanti@kitware.com>
Merge-request: !982
2017-10-25 10:30:10 -04:00
Kenneth Moreland
b3fcc82d27 Merge topic 'scan-exclusive-by-key-type-mismatch'
e50ec6b6 Fix type error in ScanExclusiveByKey

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti <allison.vacanti@kitware.com>
Merge-request: !981
2017-10-25 10:29:43 -04:00
Kenneth Moreland
f577591d9a Merge topic 'scan-exclusive-doc'
038e12e0 Document ScanExclusive algorithm

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti <allison.vacanti@kitware.com>
Merge-request: !980
2017-10-25 10:29:16 -04:00
Kenneth Moreland
7a2ef6464a Correct the implementation of DeviceAdapterAlgorithmGeneral::Unique
The implementation of the simplified version of
DeviceAdapterAlgorithmGeneral::Unique had two errors.

First, the implementation is such that it calls the more complex version
of Unique (which specifies a binary predicate to establish equality).
However, it was not calling the Unique method in the DerivedAlgorithm
like it should have been. Instead, it was calling its own Unique
algorithm, which might not be as efficient as the specialized Unique for
the device.

Second, it was using std::equal_to as its binary predicate. Using
functors from std can be dangerous because they are not marked with
VTKM_EXEC, so have the potential to not work in the execution
environment. Instead, use the readily available vtkm::Equal binary
predicate.
2017-10-24 16:57:18 -06:00
Kenneth Moreland
e50ec6b667 Fix type error in ScanExclusiveByKey
The implementation of ScanExclusiveByKey in
DeviceAdapterAlgorithmGeneral by shifting values in the input values
array and then calling ScanInclusiveByKey. However, the temporary
shifted values array was created using the key type instead of the
values type. This caused a compile error when the keys and values had
different types.
2017-10-24 16:12:30 -06:00
Kenneth Moreland
038e12e09f Document ScanExclusive algorithm
The documentation for one of the versions of ScanExclusive was
missing in doxygen.
2017-10-24 14:29:57 -06:00
Allison Vacanti
5a99dd761b Only use cuda hints for CUDA 8.0+. 2017-10-24 11:55:07 -04:00
Allison Vacanti
40441e78e6 Fix some additional warnings. 2017-10-23 11:48:19 -04:00
Allison Vacanti
4cd791932b Ensure that Pair and Vec are trivial classes.
For std::copy to optimize a copy to memcpy, the valuetype must be both
trivially constructable and trivially copyable.

The new copy benchmarks highlighted an issue that std::copy'ing pairs
and vecs were not optimized to memcpy. For a 256 MiB buffer on my
laptop w/ GCC, the serial copy speeds were:

UInt8:                 10.10 GiB/s
Vec<UInt8, 2>           3.12 GiB/s
Pair<UInt32, Float32>   6.92 GiB/s

After this patch, the optimization occurs and a bitwise copy occurs:

UInt8:                 10.12 GiB/s
Vec<UInt8, 2>           9.66 GiB/s
Pair<UInt32, Float32>   9.88 GiB/s

Check were also added to the Vec and Pair unit tests to ensure that
this classes continue to be trivial.

The ArrayHandleSwizzle test was refactored a bit to eliminate a new
'possibly uninitialized memory' warning introduced with the default
Vec ctors.
2017-10-18 14:58:35 -04:00
Sujin Philip
800bcf3124 Merge topic 'fix-intel-link-bug'
ecb99acb Workaround intel compiler bug

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Matt Larsen <mlarsen@cs.uoregon.edu>
Merge-request: !969
2017-10-12 16:46:33 -04:00
Sujin Philip
ecb99acb5e Workaround intel compiler bug
Fixes issue #179
2017-10-12 13:32:39 -04:00
Allison Vacanti
7b66dece45 Add equality operators that handle different handle types.
In generic code, it's a pain to use the equality operators since they
requires the ValueType and Storage to match, else the operator is undefined.
This commit adds operators for such comparisons, as well as a unit test.
2017-10-11 17:25:13 -04:00
Allison Vacanti
1653f20e7c Add missing typedef to portal. 2017-10-11 17:24:05 -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
374321e027 Use std::copy in TBB copy routines. 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
Allison Vacanti
b396716f86 Merge topic 'vertexclustering-reducepoints'
8fabece1 Use median point from cluster as representative vertex.
c7bf0c95 Compute PointIdMap while reducing cluster ids.
5dee7c6a Select input point from cluster rather than averaging.
28e76ddb Update vertex clustering benchmarking code.
e3c9e7bb Optimize cell map computation.
d7669650 Use requested grid in VertexClustering worklet.
0472dc11 Fix warning on Cuda.
3f4e17e2 Add field mapping to VertexClustering.
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !960
2017-10-11 16:25:30 -04:00
Sujin Philip
4253d12062 Merge topic 'cell-locator'
41679cb5 Add a CellLocator
02f48cfa Fix multiple declaration of DistributeCellData
9e0650ad Update Newton's Method to return solution status

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !957
2017-10-11 09:37:51 -04:00
Sujin Philip
41679cb5f9 Add a CellLocator
Implements a two-level uniform grid cell locator
2017-10-10 14:01:41 -04:00
Allison Vacanti
0472dc1198 Fix warning on Cuda.
assert(false && ""); emitted a

"warning : controlling expression is constant"

Replace the assertion with an exception, which is more appropriate here
anyway.
2017-10-10 10:28:51 -04:00
Allison Vacanti
5420368ae0 Add fields to the cow nose testing dataset. 2017-10-10 10:28:51 -04:00
Allison Vacanti
c2a7e4faba Adapt ReduceByKey to handle ArrayHandleDiscard for output keys.
Often times we don't care about the output keys, and it's useful to
be able to pass an ArrayHandleDiscard into the algorithm to save
memory in these cases.
2017-10-10 10:28:51 -04:00
Allison Vacanti
9fe7cb4542 Add struct to simplify detection of ArrayHandleDiscards.
This makes it easier to adapt algorithms to avoid reading from
discard arrays.
2017-10-10 10:28:51 -04:00
Robert Maynard
34361dd15a DeviceAdapterAlgorithmSerial ReduceByKey handles zero size key/values 2017-10-10 10:12:59 -04:00
Robert Maynard
f8f1adc962 Forward decleare DeviceAdapterAlgorithm correctly as a struct 2017-10-06 09:50:12 -04:00
Allison Vacanti
75f88b4c46 Add versioning to VTKM installed include/share dirs. 2017-10-02 11:39:10 -04:00
Kenneth Moreland
aa0a7bdceb Fix ambiguous make_ArrayHandleCast template
In a previous commit I made a version of make_ArrayHandleCast that
returned the same array if no cast was needed. That should shorten
template type names and make them easier to read. However, some
compilers were having trouble distinguishing between the two versions I
had created. This change uses an internal structure to make the
resolution easier.
2017-09-27 10:56:22 -06:00
Kenneth Moreland
091881d2a4 Use default storage in ArrayHandleCompositeVector test
The idea of the test was to turn off the "default" storage to ensure
that the fancy array was not making assumptions about the storage of its
delegate array. But there is lots of code elsewhere that uses the
default storage (rightly so) to create intermediate arrays, which will
fail if you disable the default storage. This was causing a test to
fail, so turn default storage back on for this case.
2017-09-27 10:05:24 -06:00
Kenneth Moreland
2625ae7866 Update VTK-m source to use new ArrayCopy functionality 2017-09-25 16:54:46 -06:00
Kenneth Moreland
f4ff589a9d Add version of ArrayCopy that takes a device adapter
This is still more convenient than declaring DeviceAdapterAlgorithm just
to copy two arrays. Now the function works whether or not you know what
the device should be.
2017-09-25 16:54:24 -06:00
Kenneth Moreland
65c7324ffe Create ArrayCopy method
This is a convenience method to do a deep copy of an array. This comes
up a lot, but can be a pain if you don't have a specific device adapter
on which to do the copy.
2017-09-25 16:28:44 -06:00
Kenneth Moreland
fb6be2819d Merge topic 'doxygen-fixes'
52060f52 Fix many warnings from doxygen

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !951
2017-09-22 14:05:24 -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
52060f52c7 Fix many warnings from doxygen
There are still some warnings left:

* Some text in markdown files are incorrectly picked up as
  doxygen commands
* ArrayPortalTransform weirdly inherits from a specialized
  version of itself. It's technically correct C++ code, but
  gives doxygen fits.
2017-09-22 10:29:08 -06:00
Robert Maynard
427ff728ad Merge topic 'restore_tbb_schedule_explicit_grain_size'
9607f71c TBB 1D scheduling restored to using the explicit grain size.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !946
2017-09-21 16:45:42 -04:00
Robert Maynard
9607f71cd3 TBB 1D scheduling restored to using the explicit grain size. 2017-09-21 09:17:44 -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
3b03177c3f Add TBB specialization of Unique.
This performs roughly an order of magnitude better than the old
implementation on a quad core processor.
2017-09-20 09:47:22 -04:00
Allison Vacanti
1c68106c00 Merge topic '173_tbb_copyif'
3638b340 Specialize CopyIf for TBB backend.
81979ae0 Specialize CopyIf for serial backend.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !940
2017-09-19 15:44:05 -04:00
Allison Vacanti
3638b340ef Specialize CopyIf for TBB backend. 2017-09-19 11:09:27 -04:00
Allison Vacanti
81979ae08f Specialize CopyIf for serial backend. 2017-09-19 11:08:22 -04:00
Allison Vacanti
00320e5dc0 Use vtkm::UInt64 for byte sizes.
vtkm::Id could be just 32bits, which limits the number of values we
would be able to store for large arrays.
2017-09-19 09:21:14 -04:00
Allison Vacanti
c4c05d8b72 Merge topic 'remove_bad_assert'
c07c37ae Remove assert for incorrect assumption new TBB::RBK impl.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !938
2017-09-19 09:16:05 -04:00
Robert Maynard
70f294aeec Merge topic 'renar_warnings'
28ab480a Fix warnings on renar.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !937
2017-09-18 17:28:23 -04:00
Allison Vacanti
c07c37aea2 Remove assert for incorrect assumption new TBB::RBK impl.
The assertion assumes that the RHS of the join operation has not been
yet reduced, which is not correct.
2017-09-18 16:12:07 -04:00
Allison Vacanti
28ab480a40 Fix warnings on renar. 2017-09-18 15:33:02 -04:00
Allison Vacanti
6c7c4ddec0 Merge topic '173_tbb_reducebykey'
d174c0fe Add TBB specialization for ReduceByKey.
c9c7149c Fix typo in ReduceByKey docstring.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !928
2017-09-18 13:48:56 -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