Skip to content

Commit

Permalink
Merge pull request #989 from danrbailey/prepare_v7_2_3
Browse files Browse the repository at this point in the history
Prepare v7.2.3
  • Loading branch information
danrbailey authored Mar 17, 2021
2 parents 3539f6e + 72365e0 commit a04827d
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
OpenVDB Version History
=======================

Version 7.2.3 - March 16, 2021

Bug fixes:
- Use copy-by-reference for the operator in a DynamicNodeManager to fix a
performance regression.

Version 7.2.2 - February 4, 2021

Bug fixes:
Expand Down
2 changes: 1 addition & 1 deletion doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set(DOXY_FILES
doc/python.txt)

set(DOXYGEN_PROJECT_NAME "OpenVDB")
set(DOXYGEN_PROJECT_NUMBER "7.2.2")
set(DOXYGEN_PROJECT_NUMBER "7.2.3")
set(DOXYGEN_PROJECT_BRIEF "")
set(DOXYGEN_FILE_PATTERNS "*.h") # headers only
set(DOXYGEN_IMAGE_PATH "doc/img")
Expand Down
10 changes: 10 additions & 0 deletions doc/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

@page changes Release Notes

@htmlonly <a name="v7_2_3_changes"></a>@endhtmlonly
@par
<B>Version 7.2.3</B> - <I><March 16, 2021</I>

@par
Bug fixes:
- Use copy-by-reference for the operator in a DynamicNodeManager to fix a
performance regression.


@htmlonly <a name="v7_2_2_changes"></a>@endhtmlonly
@par
<B>Version 7.2.2</B> - <I>February 4, 2021</I>
Expand Down
34 changes: 31 additions & 3 deletions openvdb/openvdb/tree/NodeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class NodeList
template<typename NodeOp>
void foreach(const NodeOp& op, bool threaded = true, size_t grainSize=1)
{
NodeTransformer<NodeOp> transform(op);
NodeTransformerCopy<NodeOp> transform(op); // always deep-copies the op
transform.run(this->nodeRange(grainSize), threaded);
}

Expand All @@ -278,7 +278,8 @@ class NodeList
transform.run(this->nodeRange(grainSize), threaded);
}

// identical to foreach except the operator() method has a node index
// identical to foreach except the operator() method has a node index and
// the operator is referenced instead of copied in NodeTransformer
template<typename NodeOp>
void foreachWithIndex(const NodeOp& op, bool threaded = true, size_t grainSize=1)
{
Expand Down Expand Up @@ -312,6 +313,26 @@ class NodeList
static void eval(T& node, typename NodeRange::Iterator& iter) { node(*iter, iter.pos()); }
};

// Private struct of NodeList that performs parallel_for
template<typename NodeOp, typename OpT = OpWithoutIndex>
struct NodeTransformerCopy
{
NodeTransformerCopy(const NodeOp& nodeOp) : mNodeOp(nodeOp)
{
}
void run(const NodeRange& range, bool threaded = true)
{
threaded ? tbb::parallel_for(range, *this) : (*this)(range);
}
void operator()(const NodeRange& range) const
{
for (typename NodeRange::Iterator it = range.begin(); it; ++it) {
OpT::template eval(mNodeOp, it);
}
}
const NodeOp mNodeOp;
};// NodeList::NodeTransformerCopy

// Private struct of NodeList that performs parallel_for
template<typename NodeOp, typename OpT = OpWithoutIndex>
struct NodeTransformer
Expand All @@ -329,7 +350,7 @@ class NodeList
OpT::template eval(mNodeOp, it);
}
}
const NodeOp mNodeOp;
const NodeOp& mNodeOp;
};// NodeList::NodeTransformer

// Private struct of NodeList that performs parallel_reduce
Expand Down Expand Up @@ -886,6 +907,13 @@ class DynamicNodeManager
/// children of this node should be processed, false indicating the
/// early-exit termination should occur.
///
/// @note Unlike the NodeManager, the foreach() method of the
/// DynamicNodeManager uses copy-by-reference for the user-supplied functor.
/// This can be an issue when using a shared Accessor or shared Sampler in
/// the operator as they are not inherently thread-safe. For these use
/// cases, it is recommended to create the Accessor or Sampler in the
/// operator execution itself.
///
/// @par Example:
/// @code
/// // Functor to densify the first child node in a linear array. Note
Expand Down
2 changes: 1 addition & 1 deletion openvdb/openvdb/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
// Library major, minor and patch version numbers
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 7
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 2
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 2
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 3

// If OPENVDB_ABI_VERSION_NUMBER is already defined (e.g., via -DOPENVDB_ABI_VERSION_NUMBER=N)
// use that ABI version. Otherwise, use this library version's default ABI.
Expand Down

0 comments on commit a04827d

Please sign in to comment.