- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
a have a problem with pipeline:
say i have a 4 threads, 4 tasks, and 3 pipeline stages:
emit(serial), worker(not serial), and join(serial)
but if i run a code - a got following output:
processing with 4 files (4 threads)
emit __cdb_tbench-0
emit __cdb_tbench-1
worker: __cdb_tbench-0
emit __cdb_tbench-2
emit __cdb_tbench-3
worker: __cdb_tbench-0 done
joining : __cdb_tbench-0
worker: __cdb_tbench-1
joining : __cdb_tbench-0 done: 10000000
worker: __cdb_tbench-1 done
joining : __cdb_tbench-1
worker: __cdb_tbench-2
joining : __cdb_tbench-1 done: 10000000
worker: __cdb_tbench-2 done
joining : __cdb_tbench-2
worker: __cdb_tbench-3
joining : __cdb_tbench-2 done: 10000000
worker: __cdb_tbench-3 done
joining : __cdb_tbench-3
joining : __cdb_tbench-3 done: 10000000
Done.
worker stage is nearly to 1 sec, join is faster.
looks like stages are interleaved, but worker() never called in parallel,
can you advise why ?
code looks like:
template
struct Stage : public tbb::filter {
T& ticket;
Stage(T& ticketIn) : tbb::filter(serial), ticket(ticketIn) {}
virtual ~Stage() throw() {}
virtual void* operator()(void* item)
{
return ((&ticket)->*callback)(item);
}
....
tbb::pipeline pl;
internal::Stage s1(ticket);
internal::Stage s2(ticket);
internal::Stage s3(ticket);
pl.add_filter(s1);
pl.add_filter(s2);
pl.add_filter(s3);
pl.run(data.size());
a have a problem with pipeline:
say i have a 4 threads, 4 tasks, and 3 pipeline stages:
emit(serial), worker(not serial), and join(serial)
but if i run a code - a got following output:
processing with 4 files (4 threads)
emit __cdb_tbench-0
emit __cdb_tbench-1
worker: __cdb_tbench-0
emit __cdb_tbench-2
emit __cdb_tbench-3
worker: __cdb_tbench-0 done
joining : __cdb_tbench-0
worker: __cdb_tbench-1
joining : __cdb_tbench-0 done: 10000000
worker: __cdb_tbench-1 done
joining : __cdb_tbench-1
worker: __cdb_tbench-2
joining : __cdb_tbench-1 done: 10000000
worker: __cdb_tbench-2 done
joining : __cdb_tbench-2
worker: __cdb_tbench-3
joining : __cdb_tbench-2 done: 10000000
worker: __cdb_tbench-3 done
joining : __cdb_tbench-3
joining : __cdb_tbench-3 done: 10000000
Done.
worker stage is nearly to 1 sec, join is faster.
looks like stages are interleaved, but worker() never called in parallel,
can you advise why ?
code looks like:
template
struct Stage : public tbb::filter {
T& ticket;
Stage(T& ticketIn) : tbb::filter(serial), ticket(ticketIn) {}
virtual ~Stage() throw() {}
virtual void* operator()(void* item)
{
return ((&ticket)->*callback)(item);
}
....
tbb::pipeline pl;
internal::Stage
internal::Stage
internal::Stage
pl.add_filter(s1);
pl.add_filter(s2);
pl.add_filter(s3);
pl.run(data.size());
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oh... i find a problem:
a should not name my argument as `serial` in Stage template
a should not name my argument as `serial` in Stage template
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page