Macaulay2 Engine
Loading...
Searching...
No Matches
res-tasking-example.cpp File Reference

Standalone TBB flow::graph sandbox simulating the F4 resolution's (level, degree) task DAG. More...

#include <tbb/tbb.h>
#include <iostream>
#include <vector>
#include <memory>
#include <unistd.h>
#include <mutex>
#include <thread>
#include <chrono>
#include <random>

Go to the source code of this file.

Classes

struct  OurNode
 Scratch task descriptor used by the standalone TBB dependency-graph example. More...

Typedefs

using Node = tbb::flow::continue_node<tbb::flow::continue_msg>
using NodePtr = std::shared_ptr<Node>

Functions

std::mt19937 rng (rd())
std::uniform_int_distribution< intuni (250, 1000)
NodePtr createNode (tbb::flow::graph &G, int lev, int sldeg)
void makeDependencyGraph (int nlevels, int nslanted_degrees)
int main ()

Variables

tbb::flow::graph G
std::vector< std::vector< NodePtr > > nodes
std::mutex myMutex
std::random_device rd

Detailed Description

Standalone TBB flow::graph sandbox simulating the F4 resolution's (level, degree) task DAG.

Note
AI-generated documentation. Verify against the source before relying on it.

A self-contained test program (not part of the engine build) that exercises Intel TBB's flow::continue_node primitives in exactly the dependency pattern the production resolution uses: nodes[lev][sldeg] is a per-cell task with predecessors nodes[lev-1][sldeg] and nodes[lev][sldeg-1], and each task simulates work by sleeping a uniform random duration before signalling its dependents. The leading comment carries the literal Homebrew-pinned compile recipe (brew --prefix tbb@2021) so a developer can rebuild and iterate the threading harness without touching CMake.

Lives in-tree as documentation of the intended task-graph shape and as a regression-isolation harness: if the real res-dep-graph.hpp scheduler misbehaves, this sandbox verifies "is TBB itself doing the right thing?" without pulling in any engine state. New contributors can use it as a minimal reference for the parallel resolution design.

See also
res-dep-graph.hpp
res-schreyer-frame.hpp
m2tbb.hpp

Definition in file res-tasking-example.cpp.