Commit Graph

64 Commits

Author SHA1 Message Date
Kenneth Moreland
b1343474c1 Consolidate count-to-offset algorithms
For no particularly good reason, there were two functions that converted
and array of counts to an array of offsets: `ConvertNumComponentsToOffsets`
and `ConvertNumIndicesToOffsets`. These functions were identical, except
one was defined in `ArrayHandleGroupVecVariable.h` and the other was
defined in `CellSetExplicit.h`.

These two functions have been consolidated into one (which is now called
`ConvertNumComponentsToOffsets`). The consolidated function has also been
put in its own header file: `ConvertNumComponentsToOffsets.h`.

Normally, backward compatibility would be established using deprecated
features. However, one of the things being worked on is the removal of
device-specific code (e.g. `vtkm::cont::Algorithm`) from core classes like
`CellSetExplicit` so that less code needs to use the device compiler
(especially downstream code).

Part of this change removed unnecessary includes of `Algorithm.h` in
`ArrayHandleGroupVecVariable.h` and `CellSetExplicit.h`. This header had to
be added to some classes that were not including it themselves.
2021-09-16 14:24:41 -06:00
Kenneth Moreland
68f39b86a8 Deprecate VariantArrayHandle
`VaraintArrayHandle` has been replaced by `UnknownArrayHandle` and
`UncertainArrayHandle`. Officially make it deprecated and point users to
the new implementations.
2021-04-07 16:12:38 -06:00
Kenneth Moreland
28ecf3636d Change interface of atomic compare and swap
The old atomic compare and swap operations (`vtkm::AtomicCompareAndSwap`
and `vtkm::exec::AtomicArrayExecutionObject::CompareAndSwap`) had an
order of arguments that was confusing. The order of the arguments was
shared pointer (or index), desired value, expected value. Most people
probably assume expected value comes before desired value. And this
order conflicts with the order in the `std` methods, GCC atomics, and
Kokkos.

Change the interface of atomic operations to be patterned off the
`std::atomic_compare_exchange` and `std::atomic<T>::compare_exchange`
methods. First, these methods have a more intuitive order of parameters
(shared pointer, expected, desired). Second, rather than take a value
for the expected and return the actual old value, they take a pointer to
the expected value (or reference in `AtomicArrayExecutionObject`) and
modify this value in the case that it does not match the actual value.
This makes it harder to mix up the expected and desired parameters.
Also, because the methods return a bool indicating whether the value was
changed, there is an additional benefit that compare-exchange loops are
implemented easier.

For example, consider you want to apply the function `MyOp` on a
`sharedValue` atomically. With the old interface, you would have to do
something like this.

```cpp
T oldValue;
T newValue;
do
{
  oldValue = *sharedValue;
  newValue = MyOp(oldValue);
} while (vtkm::AtomicCompareAndSwap(sharedValue, newValue, oldValue) != oldValue);
```

With the new interface, this is simplfied to this.

```cpp
T oldValue = *sharedValue;
while (!vtkm::AtomicCompareExchange(sharedValue, &oldValue, MyOp(oldValue));
```
2020-10-20 08:39:22 -06:00
Li-Ta Lo
eaff271950 minor changes on comments on findRoot() 2020-10-07 15:09:12 -06:00
Li-Ta Lo
a036b0f980 Minor change based on code review. 2020-10-07 14:23:40 -06:00
Li-Ta Lo
1185f70bc9 Data Race Resolution
Finished the comments on data races and their resolution.
2020-10-07 11:56:02 -06:00
Li-Ta Lo
3c7aa34267 Remove duplicate code in ImageConnectivity.h and GraphConnectivity.h 2020-10-06 13:38:59 -06:00
Li-Ta Lo
945e9cf328 some more comments 2020-08-31 09:23:03 -06:00
Li-Ta Lo
7533538e17 restore CI config files, minor clean up for UnionFind 2020-08-28 10:48:14 -06:00
Li-Ta Lo
31322cd2e1 use CompareAndSwap for setting root 2020-08-28 10:33:24 -06:00
Li-Ta Lo
4cd320c284 put finding and setting root in a loop 2020-08-28 08:53:56 -06:00
Li-Ta Lo
f91fb35d7f added more data race analysis, change GraphGraft to use AtomicArray 2020-08-28 00:04:50 -06:00
Li-Ta Lo
fc754b329f deduplicate UnionFind 2020-08-27 20:07:32 -06:00
Li-Ta Lo
af53fb736f Add unit test for graph connectivity with data from the ECL_CC paper 2020-08-27 17:37:08 -06:00
Li-Ta Lo
17047f456d more comments on things to do 2020-08-27 11:46:31 -06:00
Li-Ta Lo
727e0cb268 single pass algorithm for both Image and Graph connectivity 2020-08-27 11:22:48 -06:00
Li-Ta Lo
19be36ee7a implemented single pass algorithm for image connectivity 2020-08-27 11:03:45 -06:00
Li-Ta Lo
0902cbbad3 save before change to single pass algorithm 2020-08-27 10:17:02 -06:00
Li-Ta Lo
69de6afa2a add more comments on data race 2020-08-25 13:30:37 -06:00
Li-Ta Lo
ea2dad5154 extract Unite 2020-08-22 06:15:11 -06:00
Li-Ta Lo
ac6fe7a295 remove unnecessary joining my friend operation 2020-08-21 07:17:13 -06:00
Li-Ta Lo
45fed319ac add more comments on data race during union 2020-08-21 07:15:43 -06:00
Li-Ta Lo
2492d7d1d1 add test case from Valentine, more comments in ImageGraft 2020-08-20 15:08:55 -06:00
Li-Ta Lo
83b90f9fce time to test on GPU 2020-08-20 10:49:00 -06:00
Kenneth Moreland
51e817adc1 Introduce vtkm::ErrorCode
This is a flag that functions in the execution environment can return to
report on the status of the operation. This way they can report an error
without forcing the entire invocation to shut down.
2020-03-13 18:58:33 -06:00
Kenneth Moreland
ec34cb56c4 Use new ways to get array portal in control environment
Also fix deadlocks that occur when portals are not destroyed
in time.
2020-02-26 13:10:46 -07:00
Kenneth Moreland
92db376236 Convert uses of ListTagBase to List 2019-12-06 15:37:46 -07:00
Kenneth Moreland
cd302effb3 Update lists in TypeListTag.h
A new header named TypeList.h and the type lists have been redefined in
this new file. All the types have been renamed from `TypeListTag*` to
`TypeList*`. TypeListTag.h has been gutted to provide deprecated
versions of the old type list names.

There were also some other type lists that were changed from using the
old `ListTagBase` to the new `List`.
2019-12-05 11:05:19 -07:00
Robert Maynard
973878b8ba Improve the performance of the Image and Graph Connectivity algorithms
The collection of connectivity algorithms had a couple of inefficiencies.
By moving to using WorkId we can remove a couple of arrays of the same size
as the input domain. In addition by moving to using atomics we can remove
an bool output array with a size equivalent to the input domain and
a call to reduce.
2019-10-02 08:25:10 -04:00
Allison Vacanti
5db762ee71 Refactor topology mappings to clarify meaning.
The `From` and `To` nomenclature for topology mapping has been confusing for
both users and developers, especially at lower levels where the intention of
mapping attributes from one element to another is easily conflated with the
concept of mapping indices (which maps in the exact opposite direction).

These identifiers have been renamed to `VisitTopology` and `IncidentTopology`
to clarify the direction of the mapping. The order in which these template
parameters are specified for `WorkletMapTopology` have also been reversed,
since eventually there may be more than one `IncidentTopology`, and having
`IncidentTopology` at the end will allow us to replace it with a variadic
template parameter pack in the future.

Other implementation details supporting these worklets, include `Fetch` tags,
`Connectivity` classes, and methods on the various `CellSet` classes (such as
`PrepareForInput` have also reversed their template arguments. These will need
to be cautiously updated.

The convenience implementations of `WorkletMapTopology` have been renamed for
clarity as follows:

```
WorkletMapPointToCell --> WorkletVisitCellsWithPoints
WorkletMapCellToPoint --> WorkletVisitPointsWithCells
```

The `ControlSignature` tags have been renamed as follows:

```
FieldInTo --> FieldInVisit
FieldInFrom --> FieldInMap
FromCount --> IncidentElementCount
FromIndices --> IncidentElementIndices
```
2019-08-06 11:27:26 -04:00
Mark Kim
6e1d3a84f0 First Extrude commit.
how did any of this work?

match other CellSet file layouts.

???

compile in CUDA.

unit tests.

also only serial.

make error message accurate

Well, this compiles and works now.

Did it ever?

use CellShapeTagGeneric

UnitTest matches previous changes.

whoops

Fix linking problems.

Need the same interface

as other ThreadIndices.

add filter test

okay, let's try duplicating CellSetStructure.

okay

inching...

change to wedge in CellSetListTag

Means changing these to support it.

switch back to wedge from generic

compiles and runs

remove ExtrudedType

need vtkm_worklet

vtkm_worklet needs to be included

fix segment count for wedge specialization

need to actually save the index

for the other constructor.

specialize on Explicit

clean up warning

angled brackets not quotes.

formatting
2019-06-20 22:17:24 -04:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Robert Maynard
18ff6681fb Less vtkm_cont cxx files bring in the cuda device
When you have CUDA enabled we need to make sure that all worklet
launches come from a cuda file otherwise we will generate ODR
violations.
2019-04-01 08:21:07 -04:00
Li-Ta Lo
045da86e49 add unit test for image connectivity filter 2019-03-17 21:24:24 -06:00
Li-Ta Lo
55910e5a76 Merge branch 'master' into connected_component 2019-02-28 11:31:56 -07:00
Kenneth Moreland
2e426ad547 Run the update-control-signature-tags.sh script 2019-01-11 12:23:10 -07:00
Robert Maynard
0a40c620ac Rename ArrayHandleVariant to VariantArrayHandle. 2018-12-27 14:35:56 -05:00
Robert Maynard
eed321aad0 Update vtkm/worklet to work with ArrayHandleVariant 2018-12-27 14:35:56 -05:00
Li-Ta Lo
2af1162a01 Merge branch 'master' into connected_component 2018-12-12 14:12:34 -07:00
Li-Ta Lo
c75ec7bfc7 Updated unit tests, add filter interface 2018-12-04 16:42:34 -07:00
Li-Ta Lo
5000ef459b Fixed pre-mature termination of the image connectivity algorithm
The previous algorithm terminates based on if all pixels are in a root star. It turns out to be in
sufficient and thus terminates much earlier than it is required.
2018-12-03 13:46:21 -07:00
Kenneth Moreland
01a9e85416 Change WorkletPointNeighborhood to specify neighborhood at runtime
Previously, WorkletPointNeighborhood had a template argument to select
the size of the neighborhood. This change removes that template
argument. Instead, the vtkm::exec::arg::BoundaryState methods now take
in a size parameter when determining when it overlaps the boundary.

If in the future we want to add the ability to select the neighborhood
size at compile-time (for performance reasons), I suggest adding this
template argument to the OnBoundary tag for ExecutionSignature.
2018-12-03 12:45:23 -07:00
Haocheng LIU
8859636672 Merge worklet testing executables into a device dependent shared library
VTK-m has been updated to replace old per device worklet testing executables with a device
dependent shared library so that it's able to accept a device adapter
at runtime.
Meanwhile, it updates the testing infrastructure APIs. vtkm::cont::testing::Run
function would call ForceDevice when needed and if users need the device
adapter info at runtime, RunOnDevice function would pass the adapter into the functor.

Optional Parser is bumped from 1.3 to 1.7.
2018-11-23 10:13:56 -05: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
Allison Vacanti
93506d25e2 Change function signatures to use 'using' aliases.
Also cleaned up some lingering type typedefs.
2018-05-25 17:18:41 -04:00
Li-Ta Lo
269b940fe6 Merge topic 'connected_component'
d3dbdd59 remove using namespace, specify fully qualified names
ae5e3be8 Merge branch 'connected_component' of gitlab.kitware.com:ollielo/vtk-m into connected_component
f655e8f1 add overload of Run() for ArrayHandle
6f853971 Add vtkm::worklet::connectivity namespace
ce27f5fc Change signature of ImageConnectivity::Run()
648b0dec add installation of header files in CMakeLists.txt
d94f2cae Add ImageConnectivity worklet
ca0e9d20 Change signature of ImageConnectivity::Run()
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1154
2018-05-08 11:08:54 -04:00
Robert Maynard
eb82620539 Correct shadowing define warning from GraphConnectivity 2018-05-02 13:31:30 -04:00
Li-Ta Lo
f655e8f1f1 add overload of Run() for ArrayHandle 2018-05-01 15:48:26 -06:00
Li-Ta Lo
6f85397192 Add vtkm::worklet::connectivity namespace
Created vtkm::worklet::connectivity namespace and worklets in the namespace.
2018-04-27 11:32:27 -06:00
Li-Ta Lo
ce27f5fcaa Change signature of ImageConnectivity::Run()
It takes CellSetStructured<2> and DynamicArrayHandle and uses CastAndCall
to resolve data type for pixels. Moved implementation to the RunImpl
function object.
2018-04-27 11:32:27 -06:00