Skip to content

Commit a04827d

Browse files
authored
Merge pull request #989 from danrbailey/prepare_v7_2_3
Prepare v7.2.3
2 parents 3539f6e + 72365e0 commit a04827d

File tree

5 files changed

+49
-5
lines changed

5 files changed

+49
-5
lines changed

CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
OpenVDB Version History
22
=======================
33

4+
Version 7.2.3 - March 16, 2021
5+
6+
Bug fixes:
7+
- Use copy-by-reference for the operator in a DynamicNodeManager to fix a
8+
performance regression.
9+
410
Version 7.2.2 - February 4, 2021
511

612
Bug fixes:

doc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ set(DOXY_FILES
5151
doc/python.txt)
5252

5353
set(DOXYGEN_PROJECT_NAME "OpenVDB")
54-
set(DOXYGEN_PROJECT_NUMBER "7.2.2")
54+
set(DOXYGEN_PROJECT_NUMBER "7.2.3")
5555
set(DOXYGEN_PROJECT_BRIEF "")
5656
set(DOXYGEN_FILE_PATTERNS "*.h") # headers only
5757
set(DOXYGEN_IMAGE_PATH "doc/img")

doc/changes.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
@page changes Release Notes
44

5+
@htmlonly <a name="v7_2_3_changes"></a>@endhtmlonly
6+
@par
7+
<B>Version 7.2.3</B> - <I><March 16, 2021</I>
8+
9+
@par
10+
Bug fixes:
11+
- Use copy-by-reference for the operator in a DynamicNodeManager to fix a
12+
performance regression.
13+
14+
515
@htmlonly <a name="v7_2_2_changes"></a>@endhtmlonly
616
@par
717
<B>Version 7.2.2</B> - <I>February 4, 2021</I>

openvdb/openvdb/tree/NodeManager.h

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class NodeList
267267
template<typename NodeOp>
268268
void foreach(const NodeOp& op, bool threaded = true, size_t grainSize=1)
269269
{
270-
NodeTransformer<NodeOp> transform(op);
270+
NodeTransformerCopy<NodeOp> transform(op); // always deep-copies the op
271271
transform.run(this->nodeRange(grainSize), threaded);
272272
}
273273

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

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

316+
// Private struct of NodeList that performs parallel_for
317+
template<typename NodeOp, typename OpT = OpWithoutIndex>
318+
struct NodeTransformerCopy
319+
{
320+
NodeTransformerCopy(const NodeOp& nodeOp) : mNodeOp(nodeOp)
321+
{
322+
}
323+
void run(const NodeRange& range, bool threaded = true)
324+
{
325+
threaded ? tbb::parallel_for(range, *this) : (*this)(range);
326+
}
327+
void operator()(const NodeRange& range) const
328+
{
329+
for (typename NodeRange::Iterator it = range.begin(); it; ++it) {
330+
OpT::template eval(mNodeOp, it);
331+
}
332+
}
333+
const NodeOp mNodeOp;
334+
};// NodeList::NodeTransformerCopy
335+
315336
// Private struct of NodeList that performs parallel_for
316337
template<typename NodeOp, typename OpT = OpWithoutIndex>
317338
struct NodeTransformer
@@ -329,7 +350,7 @@ class NodeList
329350
OpT::template eval(mNodeOp, it);
330351
}
331352
}
332-
const NodeOp mNodeOp;
353+
const NodeOp& mNodeOp;
333354
};// NodeList::NodeTransformer
334355

335356
// Private struct of NodeList that performs parallel_reduce
@@ -886,6 +907,13 @@ class DynamicNodeManager
886907
/// children of this node should be processed, false indicating the
887908
/// early-exit termination should occur.
888909
///
910+
/// @note Unlike the NodeManager, the foreach() method of the
911+
/// DynamicNodeManager uses copy-by-reference for the user-supplied functor.
912+
/// This can be an issue when using a shared Accessor or shared Sampler in
913+
/// the operator as they are not inherently thread-safe. For these use
914+
/// cases, it is recommended to create the Accessor or Sampler in the
915+
/// operator execution itself.
916+
///
889917
/// @par Example:
890918
/// @code
891919
/// // Functor to densify the first child node in a linear array. Note

openvdb/openvdb/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
// Library major, minor and patch version numbers
5151
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 7
5252
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 2
53-
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 2
53+
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 3
5454

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

0 commit comments

Comments
 (0)