-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapsp.cpp
More file actions
28 lines (25 loc) · 876 Bytes
/
Copy pathapsp.cpp
File metadata and controls
28 lines (25 loc) · 876 Bytes
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
#include <vector>
#include <utility>
#include <array>
#include <mpi.h>
#include <cassert>
#include <iostream>
#include "functions.h"
#include <limits>
void apsp(int n, std::vector<std::pair<std::pair<int, int>, int>> &graph,
std::vector<std::pair<std::pair<int, int>, int>> &result,
MPI_Comm row_comm, MPI_Comm col_comm)
{
std::vector<std::pair<std::pair<int,int>, int>> L = graph;
int max_iter = 1;
while (max_iter<n){
std::vector<std::pair<std::pair<int,int>, int>> L_tmp = std::move(L);
spgemm_2d(n,n,n,L_tmp,L_tmp,L,
// TODO: Choose operation here
[](int a, int b){ return std::min(a,b); },
// TODO: Choose operation here
[](int a, int b){ return a + b; }, row_comm, col_comm);
max_iter*=2;
}
result = L;
}