(1) Transformer paraDijkstra{ |
(2) Within(Function dijkstra_distance){ |
(3) AddUseModuleStatement(omp_lib); |
(4) AddVariablesSameType(Integer, my_id, my_first, my_last, my_md, my_mv, nth); |
(5) Statement doStmt = getStatement("do step = 2, nv"); |
(6) Before(doStmt){ |
(7) OmpGetLoopIndexes4Thread(my_first, my_last); |
(8) } |
(9) OmpUseParallel(doStmt, private(my_first,my_id,my_last,my_md,my_mv,step), |
shared(connected, md, mind, mv, nth, ohd)); |
(10) StatementFunctionCall callfind=getStatement(“call find_nearest()”); |
(11) SetParameters(callfind, my_first, my_last, nv, mind, connected, my_md, my_mv); |
(12) Statement ifST = AddStatement(After, callfind.Statement, |
“if(my_md<md) then md=my_md mv=my_mv end if”); |
(13) OmpUseCritical(ifST); |
(14) OmpUseBarrierAfter(ifST); |
(15) Statement ifST2 = getStatement(“if(mv/=-1)”); |
(16) OmpUseSingle(ifST2); |
(17) Statement ifST3 = getStatement2(“if(mv/=-1)”); |
(18) OmpUseBarrierBefore(ifST3); |
(19) OmpUseBarrierAfter(ifST3); |
(20) } |
(21) } |