Commit Graph

769 Commits

Author SHA1 Message Date
Robert Maynard
9622905c79 Merge branch 'correct_const_in_cellset_explicit' into 'master'
Make all the Get methods return by const ref.

See merge request !136
2015-08-19 11:30:06 -04:00
Kenneth Moreland
cf6af174eb Merge branch 'variable-topology-fields' into 'master'
Variable topology fields

Changes to fetching in topology maps that lets you properly deal with cases where you do not know how many values are being fetched at compile time. For example, explicit cell sets can have any number of cell shapes that have different numbers of nodes.

This change should resolve issue #26.

See merge request !128
2015-08-19 11:27:43 -04:00
Robert Maynard
219ecc37a5 Make all the Get methods return by const ref. 2015-08-19 10:58:40 -04:00
Robert Maynard
c49684a2df Merge branch 'workaround_thrust18_inc_scan_bug' into 'master'
Workaround thrust 1.8 inclusive scan issue.

Starting in thrust 1.8 the implementation of scan inclusive inside
thrust became highly optimized by using parallel task groups. This
new implementation has a bug that only exists when using custom
binary operators, large size arrays, release mode, and no
debugger or mem-checker attached.

While I have submitted the issue to thrust, we need to be able
to work around the existing issue. The solution I have chosen is
to mark all vtkm::exec::cuda::interal::WrappedBinaryOperators
as being commutative as far as thrust is concerened. To make
sure we don't get any unexpected behavior I have also had
to create WrappedBinaryPredicate so that we don't mark any
predicate as commutative.

See merge request !129
2015-08-17 14:36:26 -04:00
Robert Maynard
4c529dfa7b Merge branch 'min_boost_ver' into 'master'
Min boost ver

See merge request !133
2015-08-17 10:58:08 -04:00
Robert Maynard
157d8efee4 Workaround thrust 1.8 inclusive scan issue.
Starting in thrust 1.8 the implementation of scan inclusive inside
thrust became highly optimized by using parallel task groups. This
new implementation has a bug that only exists when using custom
binary operators, large size arrays, release mode, and no
debugger or mem-checker attached.

While I have submitted the issue to thrust, we need to be able
to work around the existing issue. The solution I have chosen is
to mark all vtkm::exec::cuda::interal::WrappedBinaryOperators
as being commutative as far as thrust is concerened. To make
sure we don't get any unexpected behavior I have also had
to create WrappedBinaryPredicate so that we don't mark any
predicate as commutative.
2015-08-17 10:39:14 -04:00
Kenneth Moreland
0ae1986090 Merge branch 'pgi-fixes' into 'master'
PGI fixes

Attempts to resolve PGI warnings and test failures.

See merge request !132
2015-08-17 10:28:45 -04:00
Robert Maynard
44412787e5 Update VTK-m to error out nicely when Boost isn't found.
Previously VTK-m would error out on failing to find/setup backends, instead
of clearly stating the issue was finding Boost.
2015-08-17 10:07:17 -04:00
Robert Maynard
32bf8a54f0 Update FindBoostHeaders to properly detect a minimum Boost version. 2015-08-17 10:06:57 -04:00
Kenneth Moreland
616c179a12 Fix NaN check that was optimized away.
The PGI compiler appearently saw the condition (var != var) and optimized
it to always be false. However, in this particular case var was holding
a NaN value that we were testing to make sure it does not equal itself.
Get around the problem by comparing the variable to the result of a
function call.
2015-08-17 07:35:39 -06:00
Kenneth Moreland
ab2e12ece9 Tell boost::iterator_facade that our value object is a reference.
My version of the PGI compiler was having problems with using
IteratorFromArrayPortal with STL algorithms. I traced the problem to
iterator_facade checking to see if the reference type we gave it was
a real reference (e.g. T&). It is not, iterator_facade downgraded the
iterator trait to a simple input iterator tag even though I declared
it with a random access traversal. I don't know what the reference type
has to do with random access, but in any case the value object is
designed to behave like a reference in that when you assign to it
the value gets propagated to the array. To tell boost this is the case,
I made a specialization of boost::is_reference that declares the
value type as a reference.

I'm not sure why it failed for me but not elsewhere. It might be that
this version of the PGI compiler is using "old-style" iterator traits
whereas other were using newer style that matches better the boost
iterator traits that iterator_facade is actually using.
2015-08-14 21:20:09 +00:00
Kenneth Moreland
e301ba0a98 Replace BOOST_MPL_ASSERT with BOOST_STATIC_ASSERT
BOOST_MPL_ASSERT is causing warnings in the PGI compiler. Apparently,
when BOOST_MPL_ASSERT succeeds it declares a static object with a unqiue
name scoped to the file. The problem is that the PGI compiler is pretty
picky about things being declared without being used, so it was emitting
useless warnings about successful BOOST_MPL_ASSERTs. However,
BOOST_STATIC_ASSERT does not seem to have this problem, so for the benefit
of PGI change the compile-time assert method.
2015-08-14 21:16:12 +00:00
Kenneth Moreland
50ac3af910 Fix PGI compiler issues.
The PGI compiler is fussy about finding declared variables and methods
that have limited scope and are never used. Thus, it is complaining about
some internal test classes that are properly implementing the ArrayPortal
interface even though not all of it is being accessed.

To get around the problem, put them in a non-anonymous namespace with a
name unlikely to conflict with anything. The compiler will recognize that
it is possible to access these classes outside the scope of the file and
shut up about items not being used.
2015-08-14 21:03:38 +00:00
Kenneth Moreland
07ca62e2af Add some documentation on how ConnectivityExplicit::GetIndices works. 2015-08-14 12:01:52 -06:00
Kenneth Moreland
6598b296a6 Remove TopologyData class.
This class was used to store a group of from field data in a topology
map. However, the fetching has been changed to use a customized class
for each type of fetch that can be optimized for the fetch type and does
not require to know the number of items in the fetch at compile time.
Thus, this class is no longer needed, so it is being removed.
2015-08-14 09:17:34 -06:00
Kenneth Moreland
f7a6946d9a Use variable Vec-like objects for topology map fetching
This change removes the requirement to specify some maximum cell length
in each of the worklets, which is basically impossible. It also makes
some of the loading more lazy, which might help reduce the number of
registers required in a worklet.
2015-08-14 09:17:13 -06:00
Kenneth Moreland
891979e3fa Added VecFromPortalPermute class. 2015-08-14 09:15:47 -06:00
Kenneth Moreland
2394de8c95 Fetch explicit indices as vec-like
Previously when you fetched the indices from an explicit cell set, you
would get back a Vec of a fixed length an expected to use a subset of
it. Now you get back a Vec-like object that reports the exact length.

This Vec-like is implemented with VecFromPortal, so that the data does
not need to be copied to the stack. Rather, it is pulled from memory as
requested.
2015-08-14 09:15:47 -06:00
Kenneth Moreland
c9d95298b0 Added VecFromPortal class. 2015-08-14 09:15:47 -06:00
Kenneth Moreland
da2e601b6a Add VecVariable
This class holds a Vec and exposes some number of components. The class
is used when you need a Vec of a size that is not known at compile time
but that a maximum length of reasonable size is known.
2015-08-14 09:15:46 -06:00
Kenneth Moreland
c847f0b148 Get FromIndices as unknown type.
We want to be able to get topological connections where it is difficult
to know how many values you get each time. In this change, the type of
the vector holding the from indices is determined from the connectivity
object, and the worklet does not know the type (it must be templated).

Although you do not need to specify the max number for this value set
(you still currently do for field values), we still need to change the
type for explicit sets that uses something that does not rely on the Vec
class. The cell-to-point method also needs a Vec wrapper that allows it
to shorten the vector dynamically.
2015-08-14 09:15:46 -06:00
Kenneth Moreland
5c3646af70 Changes to Vec/VecTraits for Vec-like objects.
Some changes to the Vec class and VecTraits in anticipation of creating
Vec-like objects. The following changes are made:

* Add GetNumberOfComponents to Vec, which returns NUM_COMPONENTS.

* Likewise, all VecTraits have a GetNumberOfComponents method.

* The ToVec method in VecTraits is changed to CopyInto so that it can be
used when the length of the Vec-like is not known. CopyInto is also
added to Vec.

* VecTraits has a typedef named IsSizeStatic which is set to
VecTraitsTagSizeStatic when the number of components is known at compile
time and VecTraitsTagSizeVariable when the number of components is not
known until runtime.
2015-08-14 09:15:46 -06:00
Robert Maynard
e182388cbe Merge branch 'rename_pragma_guard' into 'master'
Don't use guards in parallel_sort as it doesn't use vtkm configure.

See merge request !127
2015-08-13 10:51:03 -04:00
Robert Maynard
fd982f1b93 Don't use guards in parallel_sort as it doesn't use vtkm configure. 2015-08-13 10:50:17 -04:00
Robert Maynard
d934fe5f85 Merge branch 'rename_pragma_guard' into 'master'
Rename pragma guard

rename boost pre/post header guards to be thirdparty pre/post header guards to make it clear you can use them around thrust and tbb.

See merge request !125
2015-08-13 10:22:49 -04:00
Robert Maynard
ab59e34a2f Rename pragma header guard so it makes sense for tbb and thrust.
Boost is not the only thirdparty that we are supressing warnings for, so
make the name more generic.
2015-08-13 09:04:23 -04:00
Robert Maynard
8204db2f6a Use VTKM_BOOST_PRE_INCLUDE around thrust headers too. 2015-08-13 08:26:41 -04:00
Kenneth Moreland
472dadef00 Merge branch 'in-out-fields' into 'master'
Add in-place (in-out) arrays to worklets.

Previously, all arrays passed to worklets were designated as either
input or output. No in-place operation was permitted. This change adds
the FieldInOut tag for ControlSignature in both WorkletMapField and
WorkletMapTopology that allows you to read and write from the same
array.

See merge request !124
2015-08-12 18:27:35 -04:00
Kenneth Moreland
42aba97728 Add in-place (in-out) arrays to worklets.
Previously, all arrays passed to worklets were designated as either
input or output. No in-place operation was permitted. This change adds
the FieldInOut tag for ControlSignature in both WorkletMapField and
WorkletMapTopology that allows you to read and write from the same
array.
2015-08-12 14:41:56 -06:00
Robert Maynard
9fa56cd42f Merge branch 'disable_pragma_diagnostic_on_pgi' into 'master'
Disable #pragma diagnostic on pgi compiler as it doesn't support it.

See merge request !126
2015-08-12 16:21:55 -04:00
Robert Maynard
99589816df Disable #pragma diagnostic on pgi compiler as it doesn't support it. 2015-08-12 15:15:03 -04:00
Kenneth Moreland
8a0f5186f7 Merge branch 'is-sorted-ambiguous' into 'master'
The use of is_sorted in Benchmarker.h was ambiguous

Benchmarker provides its own implementation of is_sorted since this
method was not introduced until C++11 and not all compilers necessarily
support it. However, for those that did, the system is_sorted conflicted
with the provided is_sorted. To get around the problem, specify the full
namespace of the is_sorted being used (which is standard practice in
VTK-m anyway).

See merge request !122
2015-08-12 13:51:23 -04:00
Kenneth Moreland
c637bf94b1 The use of is_sorted in Benchmarker.h was ambiguous
Benchmarker provides its own implementation of is_sorted since this
method was not introduced until C++11 and not all compilers necessarily
support it. However, for those that did, the system is_sorted conflicted
with the provided is_sorted. To get around the problem, specify the full
namespace of the is_sorted being used (which is standard practice in
VTK-m anyway).
2015-08-12 09:16:54 -06:00
Kenneth Moreland
c5c1dee4fc Merge branch 'clean-up-cell-set' into 'master'
Clean up CellSet

Underneath the CellSet implementation is a set of supporting classes that manage the actual structure in both the control and execution environments. However, the implementation of these classes was a bit confusing and inconsistent. The following changes are made:

* Most significantly, there is no longer any Connectivity classes in the control environment. This functionality has been wrapped up into the CellSet classes, which is more consistent and easier to understand. (There was a definite distinction between CellSet and Connectivity, but it was subtle and difficult to understand.) This also means that edits to CellSets happen to CellSets directly.

* The set of classes for structured and explicit cell sets match. There is different functionality within, but the class naming and meaning are consistent.

* Make the class names more consistent with the rest of VTK-m class names. Specifically classes like ExplicitConnectivity become ConnectivityExplicit. Also, the words regular and structured were being used interchangeably. Now, always use structured except when dealing specifically with grids of regular spacing.

* The connectivity classes were using the nomenclature "From" and "To" to specify topological elements of links. The same concept in worklet classes were using the nomenclature "Src" and "Dest."  For consistency, all references are changed to "From" and "To".

* Unlike explicit cell sets, structured cell sets have functionality shared between control and execution environments. Rather than duplicate it or create unique exposed classes, have a shared internal implementation in vtkm::internal.

See merge request !117
2015-08-11 19:44:10 -04:00
Will Usher
28ad02eb75 Merge topic 'add-aligned-storage'
046cd2d2 Change StorageBasic to use an aligned allocator.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !119
2015-08-11 16:03:37 -04:00
Will Usher
046cd2d2b9 Change StorageBasic to use an aligned allocator.
The storage used will now be aligned to `VTKM_CACHE_LINE_SIZE bytes,
resulting in slightly better cache usage and load/store performance.
This define is set in `StorageBasic.h We also now detect if Posix is
available in Configure.h and will define VTKM_POSIX with _POSIX_VERSION
if it's available.

The AlignedAllocator used by StorageBasic is also STL compatible
and can be used in STL containers so user's can use it in their
std::vector and pass aligned user memory to the storage.
2015-08-11 13:42:55 -06:00
Kenneth Moreland
1862970a0b Reintroduce explicit connectivity class for cont environment
(Re-) Add a helper structure that holds the connectivity information for
a particular topology connection (e.g. from points to cells) to make it
easier to manage connections in multiple different directions in
CellSetExplicit.

Unlike the previous version of connectivity, this structure is
considered "internal" and not exposed through the API so that
CellSetExplicit can better manage the data. Also, many of the helper
methods remain in CellSetExplicit since they were specific for point-to-

Also, CellSetExplicit has a mechanism to take an arbitrary pair of
TopologyElementTags and get the appropriate connectivity. This should
simplify adding connections in the future.
2015-08-11 12:42:34 -06:00
Robert Maynard
aeabacfc77 Merge branch 'teach_vtkm_to_workaround_pgi_float128_issues' into 'master'
Workaround the PGI compiler stating it is gcc when looking for float128.

See merge request !120
2015-08-10 14:32:21 -04:00
Robert Maynard
a2e718acb1 Workaround the PGI compiler stating it is gcc when looking for float128. 2015-08-10 12:33:46 -04:00
Robert Maynard
bae6ff7f55 Merge branch 'introduce_binary_and_unary_operators' into 'master'
Introduce binary and unary operators

See merge request !94
2015-08-06 15:14:28 -04:00
Robert Maynard
06f1345316 Suppress bad conversion warnings generated by gcc. 2015-08-06 14:06:43 -04:00
Will Usher
b88f03f990 Merge topic 'benchmarks-tweaks'
1ea6f732 Add our own version of is_sorted to check the assert
311b5dcc Remove C++11 feature is_sorted and increase time alloted to run bench

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !115
2015-08-05 13:13:33 -04:00
Robert Maynard
0b4cb9c2c6 Add UnitTest for BinaryOperators. 2015-08-04 16:55:53 -04:00
Robert Maynard
f96a02adcb Add UnitTest for BinaryPredicates. 2015-08-04 16:55:53 -04:00
Robert Maynard
7bf0e41844 Add UnitTest for UnaryPredicates. 2015-08-04 16:55:53 -04:00
Robert Maynard
8839e8a019 Add vtkm/BinaryOperators header.
Currently includes the following predicates:
  - Sum
  - Product
  - Maximum
  - Minimum
  - BitwiseAnd
  - BitwiseOr
  - BitwiseXor
2015-08-04 16:55:53 -04:00
Robert Maynard
f20b1ea99a Add vtkm/BinaryPredicates header.
Currently includes the following predicates:
  - Equal
  - NotEqual
  - SortLess
  - SortGreater
  - LogicalAnd
  - LogicalOr
2015-08-04 16:55:53 -04:00
Kenneth Moreland
8f4fec555b Merge branch 'tbb-is-fixed' into 'master'
Don't use patched version of TBB on newer versions.

We have a patched version of TBB's parallel_for.h in our files that
fixes a problem with using std::swap. This issue has since been fixed in
TBB, so for newer versions we should revert back to TBB's
implementation.

See merge request !118
2015-08-04 12:21:22 -04:00
Kenneth Moreland
923fac45dd Allow TBB back to version 4.0.
Robert Maynard tells me that the TBB backend has been tried on versions
of TBB back to 4.0. Since the patch appears to work across them, allow
those versions too.
2015-08-04 10:13:43 -06:00
Kenneth Moreland
ce8ecf9e8b Don't use patched version of TBB on newer versions.
We have a patched version of TBB's parallel_for.h in our files that
fixes a problem with using std::swap. This issue has since been fixed in
TBB, so for newer versions we should revert back to TBB's
implementation.
2015-08-04 09:14:24 -06:00