Question: GATB - Multithreaded iteration of paired banks ?
0
gravatar for wfd
8 months ago by
wfd0
wfd0 wrote:

Hi there,

Is there a way to iterate two banks at the same time in a multithreaded fashion? I tried changing the code snippet: Multithreaded iteration of a bank(Code is from example multithreading6.cpp ) to accept a PairedIterator<Sequence> instead of the standard bank iterator.

Here is what I tried;

ThreadObject<string> correctionOutput_1, correctionOutput_2;

PairedIterator<Sequence> itPair(paired_bank1->iterator(), paired_bank2->iterator());

   ISynchronizer* synchro = System::thread().newSynchronizer();

    dispatcher->iterate(itPair, [&](pair<Sequence, Sequence> &seqPair) {
        LocalSynchronizer sync (synchro);
        string &localCorrection_1 = correctionOutput_1();
        string &localCorrection_2 = correctionOutput_2();
        Sequence &s1 = seqPair.first;
        Sequence &s2 = seqPair.second;
        cout << s1.toString()  << "\t" << s2.toString() << endl;

        // do stuff
    });
    delete synchro;

Nothing is being printed - I am most likely missing something obvious here... Any help is appreciated, thanks!

gatb multithreading • 333 views
ADD COMMENTlink modified 6 months ago by Rayan Chikhi1.3k • written 8 months ago by wfd0
2
gravatar for Rayan Chikhi
6 months ago by
Rayan Chikhi1.3k
France, Lille, CNRS
Rayan Chikhi1.3k wrote:

There was a tricky long-standing bug in GATB where PairedIterator did not work in conjunction with Dispatcher.

I just fixed it, if you update to the master branch of gatb-core, it should work. You can also try the new tools/multithreading8.cpp example that illustrates PairedIterator with Dispatcher.

ADD COMMENTlink modified 6 months ago • written 6 months ago by Rayan Chikhi1.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1561 users visited in the last hour