Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2413 Discussions

Flash Graph Connect Edges of Nodes with different Graph parents

ronag89
Beginner
85 Views

I asked this in a previous post but I though that it might deserve a thread in itself.

Is it possible to create edges between nodes that have different parent graph objects? If so, what is the semantics an life time management of that?

e.g. would this be valid?

graph g0;
broadcast_node<int> n0(g0);
function_node<int, int> n1(g0, my_func0_body());
queue_node<int> n2(g0);

make_edge(n0, n1),
make_edge(n1, n2);

// Some other thread
{
    graph g1;
    function_node<int> n3(g1, my_func1_body());

    make_edge(n2, n3);
    
    g1.increment_wait_count();
    g1.run_and_wait();
}

// Sleep for a while

// Some other thread
{
    graph g2;
    function_node<int> n4(g2, my_func2_body());

    make_edge(n1, n4);
    
    g2.increment_wait_count();
    g2.run_and_wait();
}

// Some other thread

g1.decrement_wait_count(); // We are done with g1

// Sleep for a while

g2.decremeent_wait_count(); // We are done with g2

// Some other thread
{
    graph g3;
    function_node<int> n5(g3, my_func3_body());

    make_edge(n1, n5);
    
    g3.increment_wait_count();
    g3.run_and_wait();
}

// Etc...

 

0 Kudos
0 Replies
Reply