COMBINATORIAL_BLAS
1.6
Loading...
Searching...
No Matches
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
13
using namespace
std;
14
using namespace
combblas
;
15
16
#define EPS 0.0001
17
18
#ifdef _OPENMP
19
int
cblas_splits
=
omp_get_max_threads
();
20
#else
21
int
cblas_splits
= 1;
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"
28
template
<
class
NT>
29
class
PSpMat
30
{
31
public
:
32
typedef
SpDCCols < int64_t, NT >
DCCols
;
33
typedef
SpParMat < int64_t, NT, DCCols >
MPI_DCCols
;
34
};
35
36
int
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
60
typedef
PlusTimesSRing<double, double>
PTFF
;
61
62
SpParMat<int64_t, double, SpDCCols < int64_t, double >
>
A2D
(
fullWorld
);
63
SpParMat<int64_t, double, SpDCCols < int64_t, double >
>
B2D
(
fullWorld
);
64
SpParMat<int64_t, double, SpDCCols < int64_t, double >
>
CC2D
(
fullWorld
);
65
66
A2D
.ParallelReadMM(
Aname
,
true
,
maximum<double>
());
67
B2D
.ParallelReadMM(
Bname
,
true
,
maximum<double>
());
68
CC2D
.ParallelReadMM(
CCname
,
true
,
maximum<double>
());
69
70
SpDCCols < int64_t, double >
*
Alocal
=
A2D
.seqptr();
71
SpDCCols < int64_t, double >
*
Blocal
=
B2D
.seqptr();
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
}
main
int main()
Definition
Driver.cpp:12
cblas_splits
int cblas_splits
Definition
HashSpGEMMTest.cpp:21
PSpMat
Definition
BcastTest.cpp:35
PSpMat::MPI_DCCols
SpParMat< int64_t, NT, DCCols > MPI_DCCols
Definition
HashSpGEMMTest.cpp:33
PSpMat::DCCols
SpDCCols< int64_t, NT > DCCols
Definition
HashSpGEMMTest.cpp:32
combblas::CommGrid
Definition
CommGrid.h:45
combblas::DistEdgeList
Definition
DistEdgeList.h:82
nprocs
int nprocs
Definition
comms.cpp:55
combblas
Definition
CCGrid.h:4
time.h
ReleaseTests
HashSpGEMMTest.cpp
Generated by
1.9.8