200 likes | 292 Views
POE ( P artial O rder reduction avoiding E lusive interleavings). In this presentation let see how works POE algorithm thru an example with a DEADLOCK. Example #1. P 0. P 1. P 2. void Scheduler::generateFirstInterleaving () { ... while (count) {
E N D
POE (Partial Order reduction avoiding Elusive interleavings) In thispresentationletseehowworks POE algorithmthruanexamplewith a DEADLOCK
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if (_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize()
Initially _runQ[i]->_read_next_env == true Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if (_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... (count == nprocs)== 3 Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize()
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true Not-Blocking Type
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true Not-Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true i = 2 - _runQ[2]->read_next_env = false Barrier()
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... (count == nprocs)== 3 Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true Barrier() - _runQ[0]->read_next_env = false Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true i = 2 Barrier() - _runQ[2]->read_next_env = false
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true Barrier() - _runQ[0]->read_next_env = false Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true Barrier() - _runQ[1]->read_next_env = false i = 2 Barrier() - _runQ[2]->read_next_env = false
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() false i = 0 Isend(P1) - _runQ[0]->read_next_env = true Barrier() Barrier() - _runQ[0]->read_next_env = false - _runQ[1]->read_next_env = false i = 1 Irecv(*) - _runQ[1]->read_next_env = true i = 2 Barrier() - _runQ[2]->read_next_env = false
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { … while (!hasMoreEnvelopeToRead ()) { it->CHECK (*this, l); iter_end = l.end(); if (Scheduler::_probed) { assert (l.size() <= 2); _runQ[l.back()]->_read_next_env = true; Scheduler::_probed = false; } else { for (iter = l.begin (); iter != iter_end; iter++) { _runQ[*iter]->_read_next_env = true; } } } } } Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() _runQ[i]->read_next_env = false for i=0 to nprocs Finds out Enabled Transition Forms Match-Set in Priority • Barrier/Collectives • Wait • Non-Wildcards • Wildcards
Match-Set in Priority, in this case Barrier/Collectives and Wildcards Example #1 P0 P1 P2 P2 P1 P0 void Scheduler::generateFirstInterleaving () { … while (!hasMoreEnvelopeToRead ()) { it->CHECK (*this, l); iter_end = l.end(); if (Scheduler::_probed) { assert (l.size() <= 2); _runQ[l.back()]->_read_next_env = true; Scheduler::_probed = false; } else { for (iter = l.begin (); iter != iter_end; iter++) { _runQ[*iter]->_read_next_env = true; } } } } } Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() Forms Match-Set in Priority Finds out Enabled Transition Isend(P1) Barrier() Irecv(*) Barrier() Barrier()
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { … while (!hasMoreEnvelopeToRead ()) { it->CHECK (*this, l); iter_end = l.end(); if (Scheduler::_probed) { assert (l.size() <= 2); _runQ[l.back()]->_read_next_env = true; Scheduler::_probed = false; } else { for (iter = l.begin (); iter != iter_end; iter++) { _runQ[*iter]->_read_next_env = true; } } } } } Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() Forms Match-Set before with Barrier • Send “GoAhead” to Profiler • Profiler issues the Barrier with PMPI_Execute • All _runQ[i]->read_next_event are TRUE • Re-back in the WHILE and FOR Loop
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... (count == nprocs)== 3 Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true Not-Blocking Type
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true Not-Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true Not-Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true i = 2 - _runQ[2]->read_next_env = true Isend(P1)
Example #1 P1 P2 P0 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... (count == nprocs)== 3 Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true - _runQ[0]->read_next_env = false Wait() Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true i = 2 - _runQ[2]->read_next_env = true Isend(P1)
Example #1 P2 P1 P0 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true - _runQ[0]->read_next_env = false Wait() Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true - _runQ[1]->read_next_env = false Wait() i = 2 - _runQ[2]->read_next_env = true Isend(P1)
Example #1 P2 P1 P0 void Scheduler::generateFirstInterleaving () { ... while (count) { for (int i = 0 ; i < nprocs; i++) { if(_runQ[i]->_read_next_env) { t = getTransition (i); … if(! t->GetEnvelope ()->isBlockingType ()) { std::cout.flush(); Send (i, goback); } else { _runQ[i]->_read_next_env = false; } if (t->GetEnvelope ()->func_id == FINALIZE) { _runQ[i]->_read_next_env = false count--; } } } ... Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() true i = 0 Isend(P1) - _runQ[0]->read_next_env = true - _runQ[0]->read_next_env = false Wait() Blocking Type i = 1 Irecv(*) - _runQ[1]->read_next_env = true - _runQ[1]->read_next_env = false Wait() i = 2 - _runQ[2]->read_next_env = true Isend(P1) - _runQ[2]->read_next_env = false Wait()
Example #1 P0 P1 P2 void Scheduler::generateFirstInterleaving () { … while (!hasMoreEnvelopeToRead ()) { it->CHECK (*this, l); iter_end = l.end(); if (Scheduler::_probed) { assert (l.size() <= 2); _runQ[l.back()]->_read_next_env = true; Scheduler::_probed = false; } else { for (iter = l.begin (); iter != iter_end; iter++) { _runQ[*iter]->_read_next_env = true; } } } } } Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() _runQ[i]->read_next_env = false for i=0 to nprocs Finds out Enabled Transition Forms Match-Set in Priority • Barrier/Collectives • Wait • Non-Wildcards • Wildcards
Match-Set in Priority, in this case onlyWildcards Example #1 P0 P0 P1 P2 P2 P1 void Scheduler::generateFirstInterleaving () { … while (!hasMoreEnvelopeToRead ()) { it->CHECK (*this, l); iter_end = l.end(); if (Scheduler::_probed) { assert (l.size() <= 2); _runQ[l.back()]->_read_next_env = true; Scheduler::_probed = false; } else { for (iter = l.begin (); iter != iter_end; iter++) { _runQ[*iter]->_read_next_env = true; } } } } } Irecv(*) Isend(P1) Barrier() Barrier() Barrier() Isend(P1) Wait() Wait() Wait() Finalize() Finalize() Finalize() Forms Match-Set in Priority Finds out Enabled Transition DEADLOCK Isend(P1) Two probable matches (2 possible interleavings)… • …but in both cases there is a DEADLOCK, because one Isend(P1) does not have a match. Irecv(*) Isend(P1) DEADLOCK