COMBINATORIAL_BLAS 1.6
 
Loading...
Searching...
No Matches
SpGEMM3DTest.cpp
Go to the documentation of this file.
1#include <mpi.h>
2#include <sys/time.h>
3#include <iostream>
4#include <functional>
5#include <algorithm>
6#include <vector>
7#include <sstream>
8#include "CombBLAS/CombBLAS.h"
9#include "CombBLAS/CommGrid3D.h"
10#include "CombBLAS/SpParMat3D.h"
11#include "CombBLAS/ParFriends.h"
12
13using namespace std;
14using namespace combblas;
15
16#define EPS 0.0001
17
18#ifdef _OPENMP
20#else
22#endif
23
24
25// Simple helper class for declarations: Just the numerical type is templated
26// The index type and the sequential matrix type stays the same for the whole code
27// In this case, they are "int" and "SpDCCols"
28template <class NT>
29class PSpMat
30{
31public:
34};
35
36int main(int argc, char* argv[])
37{
38 int nprocs, myrank;
39 MPI_Init(&argc, &argv);
42
43 if(argc < 4){
44 if(myrank == 0)
45 {
46 cout << "Usage: ./<Binary> <MatrixA> <MatrixB> <MatrixCC>" << endl;
47 }
49 return -1;
50 }
51 else {
52 string Aname(argv[1]);
53 string Bname(argv[2]);
54 string CCname(argv[3]);
56 fullWorld.reset( new CommGrid(MPI_COMM_WORLD, 0, 0) );
57
58 double t0, t1;
59
61
65
66 A2D.ParallelReadMM(Aname, true, maximum<double>());
67 B2D.ParallelReadMM(Bname, true, maximum<double>());
68 CC2D.ParallelReadMM(CCname, true, maximum<double>());
69
70 if(myrank == 0) fprintf(stderr, "***\n");
71
72 // Increase number of layers 1 -> 4 -> 16
73 for(int layers = 1; layers <= 16; layers = layers * 4){
74
75 if(myrank == 0) fprintf(stderr, "Trying %d layers\n", layers);
76
77 // Convert 2D matrices to 3D
80
83 (A3D, B3D);
85
86 if(CC2D == C3D2D){
87 if(myrank == 0) fprintf(stderr, "Correct\n");
88 }
89 else{
90 if(myrank == 0) fprintf(stderr, "Not correct\n");
91 }
92
93 if(myrank == 0) fprintf(stderr, "***\n");
94 }
95
96 }
98 return 0;
99}
int main()
Definition Driver.cpp:12
int cblas_splits
SpParMat< int64_t, NT, DCCols > MPI_DCCols
SpDCCols< int64_t, NT > DCCols
int nprocs
Definition comms.cpp:55
long int64_t
Definition compat.h:21