Skip to content

Commit

Permalink
- use of TBB task priority is re-enabled (albeit deprecated)
Browse files Browse the repository at this point in the history
- replaced task::spawn with task::enqueue with priority_high due to
  - somehow spawned task never getting picked up when doing seemingly trivial TiledArray example in ValeevGroup/tiledarray#195 when MADNESS uses TBB and OpenMPI (3 or 4):
  - https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/326043 suggested that this is due to wait_for_all not getting called, but in the failing example main does get to fence and calls wait_for_all ... perhaps since this may be a different thread??
  • Loading branch information
evaleev committed Apr 25, 2020
1 parent 2460452 commit 6717bd3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/madness/world/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -1324,11 +1324,12 @@ namespace madness {
__dague_schedule(parsec->virtual_processes[0]->execution_units[0], context);
//////////// Parsec Related End ////////////////////
#elif HAVE_INTEL_TBB
if(task->is_high_priority()) {
tbb::task::spawn(*task);
} else {
#ifdef MADNESS_CAN_USE_TBB_PRIORITY
if(task->is_high_priority())
tbb::task::enqueue(*task, tbb::priority_high);
else
#endif // MADNESS_CAN_USE_TBB_PRIORITY
tbb::task::enqueue(*task);
}
#else
if (!task) MADNESS_EXCEPTION("ThreadPool: inserting a NULL task pointer", 1);
int task_threads = task->get_nthread();
Expand Down
7 changes: 7 additions & 0 deletions src/madness/world/worldrmi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,11 @@ namespace madness {
new (tbb::task::allocate_root()) tbb::empty_task;
tbb_rmi_parent_task->set_ref_count(2);
task_ptr = new (tbb_rmi_parent_task->allocate_child()) RmiTask(comm);
#ifdef MADNESS_CAN_USE_TBB_PRIORITY
tbb::task::enqueue(*task_ptr, tbb::priority_high);
#else
tbb::task::enqueue(*task_ptr);
#endif // MADNESS_CAN_USE_TBB_PRIORITY

task_ptr->comm.Barrier();

Expand All @@ -424,6 +428,9 @@ namespace madness {
for (int i = 0; i < NEMPTY; i++) {
tbb::task* empty =
new (empty_root->allocate_child()) tbb::empty_task;
#ifdef MADNESS_CAN_USE_TBB_PRIORITY
tbb::task::enqueue(*empty, tbb::priority_high);
#else
tbb::task::enqueue(*empty);
#endif // MADNESS_CAN_USE_TBB_PRIORITY
++binge_counter;
Expand Down

0 comments on commit 6717bd3

Please sign in to comment.