200 likes | 287 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 (PartialOrderreductionavoidingElusive 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-BlockingType
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-BlockingType 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 BlockingType 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--; } } } ... (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 BlockingType 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 BlockingType 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 tonprocs Finds out EnabledTransition 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 EnabledTransition 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 beforewithBarrier • Send “GoAhead” toProfiler • Profilerissues the BarrierwithPMPI_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-BlockingType
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-BlockingType 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-BlockingType i = 1 Irecv(*) - _runQ[1]->read_next_env = true i = 2 Isend(P1) - _runQ[2]->read_next_env = true
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() BlockingType i = 1 Irecv(*) - _runQ[1]->read_next_env = true i = 2 Isend(P1) - _runQ[2]->read_next_env = true
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() BlockingType i = 1 Irecv(*) - _runQ[1]->read_next_env = true - _runQ[1]->read_next_env = false Wait() i = 2 Isend(P1) - _runQ[2]->read_next_env = true
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() BlockingType i = 1 Irecv(*) - _runQ[1]->read_next_env = true - _runQ[1]->read_next_env = false Wait() i = 2 Isend(P1) - _runQ[2]->read_next_env = true - _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 tonprocs Finds out EnabledTransition 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 EnabledTransition DEADLOCK Isend(P1) Twoprobablematches (2possibleinterleavings)… • …but in bothcasesthereis a DEADLOCK, becauseoneIsend(P1) doesnothave a match. Irecv(*) Isend(P1) DEADLOCK