COMBINATORIAL_BLAS 1.6
 
Loading...
Searching...
No Matches
SpMMError.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 <string>
8#include <sstream>
9#include <stdint.h>
10#include "CombBLAS/CombBLAS.h"
11
12using namespace combblas;
13
16
17
21
22#define ValueType int64_t
26
29
30int main(int argc, char* argv[])
31{
32 int torusi[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
33 int torusj[] = {3,0,1,2,7,4,5,6,11,8,9,10,15,12,13,14,1,2,3,0,5,6,7,4,9,10,11,8,13,14,15,12,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3};
34
35 int nprocs, myrank;
36 MPI_Init(&argc, &argv);
39 {
40 SpParHelper::Print("Usage: SpMMError [arg]\nIf arg is present then matrix will be read from torus.mtx (no error).\nIf arg is absent, matrix will be created from vectors (error present)\n\n");
41 // Declare objects
42 MatType G1;
43 MatType G2;
44 if (argc > 1)
45 {
46 SpParHelper::Print("Reading torus.mtx\n");
47 std::ifstream input("torus.mtx");
48 G1.ReadDistribute(input, 0); // read it from file
49 ifstream input2("torus.mtx");
50 G2.ReadDistribute(input2, 0);
51 SpParHelper::Print("Read input\n");
52
53 }
54 else
55 {
56 SpParHelper::Print("Creating matrices from built-in vectors\n");
60 for (int i = 0; i <64; i++)
61 {
62 dpvi.SetElement(i, torusi[i]);
63 dpvj.SetElement(i, torusj[i]);
64 }
65 dpvi.DebugPrint();
66 dpvj.DebugPrint();
67 G1 = MatType(16, 16, dpvi, dpvj, dpvv);
68 G2 = MatType(16, 16, dpvi, dpvj, dpvv);
69
70 ofstream out1("G1.txt");
71 ofstream out2("G2.txt");
72 out1 << G1;
73 out2 << G2;
74 }
75
76 MatType G3(G1);
77 G1.PrintInfo();
78 G2.PrintInfo();
79 G3.PrintInfo();
80 SpParHelper::Print("The nnz values should be 112, 112, 112:\n");
81
82
84 G12.PrintInfo();
85 ofstream out12("G12.txt");
86 out12 << G12;
87
89 G13.PrintInfo();
90
92 G23.PrintInfo();
93
94 }
96 return 0;
97}
98
int main()
Definition Driver.cpp:12
PSpMat_Int64 MatType
Definition SpMMError.cpp:25
SpDCCols< int64_t, ValueType > DCColsType
Definition SpMMError.cpp:23
SpParMat< int64_t, bool, SpDCCols< int64_t, bool > > PSpMat_Bool
Definition SpMMError.cpp:19
SelectMaxSRing< bool, int64_t > SR
Definition SpMMError.cpp:18
double cblas_allgathertime
Definition SpMMError.cpp:15
double cblas_alltoalltime
Definition SpMMError.cpp:14
SpParMat< int64_t, ValueType, DCColsType > PSpMat_Int64
Definition SpMMError.cpp:24
SpParMat< int64_t, int, SpDCCols< int64_t, int > > PSpMat_Int
Definition SpMMError.cpp:20
static void Print(const std::string &s)
int nprocs
Definition comms.cpp:55
#define DECLARE_PROMOTE(A, B, C)
Definition promote.h:56