COMBINATORIAL_BLAS 1.6
HashSpGEMMTest.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
19int cblas_splits = omp_get_max_threads();
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);
40 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
41 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
42
43 if(argc < 4){
44 if(myrank == 0)
45 {
46 cout << "Usage: ./<Binary> <MatrixA> <MatrixB> <MatrixCC>" << endl;
47 }
48 MPI_Finalize();
49 return -1;
50 }
51 else {
52 string Aname(argv[1]);
53 string Bname(argv[2]);
54 string CCname(argv[3]);
55 shared_ptr<CommGrid> fullWorld;
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
72 SpDCCols < int64_t, double >* CClocal = CC2D.seqptr();
73
74 //Clocal = LocalSpGEMMHash<PTFF, double>(*Alocal, *Blocal, false, false, true);
75 SpTuples<int64_t, double>* Clocal_tuples = LocalSpGEMM<PTFF, double>(*Alocal, *Blocal, false, false);
76 SpDCCols < int64_t, double >* Clocal = new SpDCCols < int64_t, double >(*Clocal_tuples, false);
77
78 if(*Clocal == *CClocal){
79 if(myrank == 0) fprintf(stderr, "Correct\n");
80 }
81 else{
82 if(myrank == 0) fprintf(stderr, "Not correct\n");
83 }
84
85 }
86 MPI_Finalize();
87 return 0;
88}
int main(int argc, char *argv[])
int cblas_splits
SpParMat< int64_t, NT, DCCols > MPI_DCCols
SpDCCols< int64_t, NT > DCCols
void ParallelReadMM(const std::string &filename, bool onebased, _BinaryOperation BinOp)
Definition: SpParMat.cpp:3980
DER * seqptr() const
Definition: SpParMat.h:307
int nprocs
Definition: comms.cpp:55
Definition: CCGrid.h:4
Compute the maximum of two values.
Definition: Operations.h:155