File: mpi_comm_eb4811a.diff

package info (click to toggle)
combblas 2.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 190,488 kB
  • sloc: cpp: 55,918; ansic: 25,134; sh: 3,691; makefile: 548; csh: 66; python: 49; perl: 21
file content (77 lines) | stat: -rw-r--r-- 2,892 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
diff --git a/Applications/BipartiteMatchings/BPMaximalMatching.h b/Applications/BipartiteMatchings/BPMaximalMatching.h
index 365b7c70..eef74142 100644
--- a/Applications/BipartiteMatchings/BPMaximalMatching.h
+++ b/Applications/BipartiteMatchings/BPMaximalMatching.h
@@ -26,9 +26,10 @@ void MaximalMatching(Par_DCSC_Bool & A, Par_DCSC_Bool & AT, FullyDistVec<IT, IT>
 {
 
 	typedef VertexTypeML < IT, IT> VertexType;
+    MPI_Comm comm = A.getcommgrid()->GetWorld();
     int nprocs, myrank;
-    MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
-    MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
+    MPI_Comm_size(comm,&nprocs);
+    MPI_Comm_rank(comm,&myrank);
     int nthreads = 1;
 #ifdef _OPENMP
 #pragma omp parallel
@@ -76,7 +77,7 @@ void MaximalMatching(Par_DCSC_Bool & A, Par_DCSC_Bool & AT, FullyDistVec<IT, IT>
         cout << "=======================================================\n";
     }
 #endif
-    MPI_Barrier(MPI_COMM_WORLD);
+    MPI_Barrier(comm);
 
     
     while(curUnmatchedCol !=0 && curUnmatchedRow!=0 && newlyMatched != 0 )
@@ -178,7 +179,7 @@ void MaximalMatching(Par_DCSC_Bool & A, Par_DCSC_Bool & AT, FullyDistVec<IT, IT>
 #endif
         curUnmatchedCol = unmatchedCol.getnnz();
         curUnmatchedRow = unmatchedRow.getnnz();
-        MPI_Barrier(MPI_COMM_WORLD);
+        MPI_Barrier(comm);
         
     }
     
@@ -249,9 +250,10 @@ void WeightedGreedy(Par_MAT_Double & A, FullyDistVec<IT, IT>& mateRow2Col,
     }
 #endif
     PreAllocatedSPA<VertexType> SPA(A.seq(), nthreads*4);
-	int nprocs, myrank;
-	MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
-	MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
+    int nprocs, myrank;
+    MPI_Comm comm = A.getcommgrid()->GetWorld();
+    MPI_Comm_size(comm,&nprocs);
+    MPI_Comm_rank(comm,&myrank);
 	
     
 	//unmatched row and column vertices
@@ -288,7 +290,7 @@ void WeightedGreedy(Par_MAT_Double & A, FullyDistVec<IT, IT>& mateRow2Col,
 		cout << "=======================================================\n";
 	}
 #endif
-	MPI_Barrier(MPI_COMM_WORLD);
+	MPI_Barrier(comm);
 	
 	
 	while(curUnmatchedCol !=0 && curUnmatchedRow!=0 && newlyMatched != 0 )
@@ -348,7 +350,7 @@ void WeightedGreedy(Par_MAT_Double & A, FullyDistVec<IT, IT>& mateRow2Col,
 #endif
 		curUnmatchedCol = unmatchedCol.getnnz();
 		curUnmatchedRow = unmatchedRow.getnnz();
-		MPI_Barrier(MPI_COMM_WORLD);
+		MPI_Barrier(comm);
 		
 	}
     
@@ -402,7 +404,8 @@ bool isMaximalmatching(Par_DCSC_Bool & A, FullyDistVec<IT,NT> & mateRow2Col, Ful
 {
 	typedef VertexTypeML < IT, IT> VertexType;
     int myrank;
-    MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
+    MPI_Comm comm = A.getcommgrid()->GetWorld();
+    MPI_Comm_rank(comm,&myrank);
     FullyDistSpVec<IT, IT> fringeRow(A.getcommgrid(), A.getnrow());
     FullyDistSpVec<IT, IT> fringeCol(A.getcommgrid(), A.getncol());
     FullyDistSpVec<IT, IT> unmatchedRow(mateRow2Col, [](IT mate){return mate==-1;});