Skip to content

Commit 752608f

Browse files
committed
Fix test and address review comments
1 parent c385b83 commit 752608f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

gtsam/base/tests/testPriorityScheduler.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,19 @@ TEST(PriorityScheduler, VoidPriorityOrderingSingleWorker) {
6262
scheduler.waitForAllTasks();
6363
EXPECT_LONGS_EQUAL(3, executionOrder.size());
6464
// With a single worker, tasks are not preempted: the first scheduled task may
65-
// start running before later (higher-priority) tasks are submitted. Once all
66-
// tasks are enqueued, remaining work should respect priority order.
65+
// start running before later (higher-priority) tasks are submitted. Also,
66+
// since the third task is submitted last, the worker may run the first two
67+
// tasks before the third is enqueued.
6768
const bool strictPriority =
6869
(executionOrder.at(0) == 1 && executionOrder.at(1) == 3 &&
6970
executionOrder.at(2) == 5);
7071
const bool firstTaskRanImmediately =
7172
(executionOrder.at(0) == 5 && executionOrder.at(1) == 1 &&
7273
executionOrder.at(2) == 3);
73-
EXPECT(strictPriority || firstTaskRanImmediately);
74+
const bool thirdTaskEnqueuedLate =
75+
(executionOrder.at(0) == 1 && executionOrder.at(1) == 5 &&
76+
executionOrder.at(2) == 3);
77+
EXPECT(strictPriority || firstTaskRanImmediately || thirdTaskEnqueuedLate);
7478
}
7579

7680
/* ************************************************************************* */

gtsam/linear/MultifrontalClique.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,7 @@ void MultifrontalClique::updateParentSbm(
326326
SymmetricBlockMatrix& parentSbm) const {
327327
if (useQR()) {
328328
// Accumulate separator (and RHS) normal equations (S^T S) into the parent.
329-
assert(RSdReady_);
330-
assert(RSd_.firstBlock() == 0);
331-
assert(parent.sbm_.nBlocks() > 0);
329+
assert(RSdReady_ && RSd_.firstBlock() == 0);
332330
const DenseIndex nfBlocks = static_cast<DenseIndex>(numFrontals());
333331
RSd_.firstBlock() = nfBlocks;
334332
parentSbm.updateFromOuterProductBlocks(RSd_, parentIndices_);
@@ -365,7 +363,7 @@ void MultifrontalClique::gatherUpdatesParallel(size_t numThreads) {
365363
auto& local = locals.local(); // Thread-local SBM.
366364
for (size_t i = range.begin(); i < range.end(); ++i) {
367365
const auto& child = children[i];
368-
if (!child) continue;
366+
assert(child);
369367
child->updateParentSbm(
370368
local); // No locking: each thread writes its own SBM.
371369
}
@@ -392,7 +390,7 @@ void MultifrontalClique::gatherUpdatesParallel(size_t numThreads) {
392390
auto& local = locals[t];
393391
for (size_t i = start; i < end; ++i) {
394392
const auto& child = children[i];
395-
if (!child) continue;
393+
assert(child);
396394
child->updateParentSbm(
397395
local); // No locking: each thread writes its own SBM.
398396
}

0 commit comments

Comments
 (0)