-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify.cu
41 lines (28 loc) · 1012 Bytes
/
verify.cu
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
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2020, American University of Beirut
// See LICENSE.txt for copyright license
#include "graph.h"
#include <assert.h>
#include <stdio.h>
#include "verify.h"
void verify(COOGraph* graph, Config config) {
// Read reference from file
COOGraph* reference = createCOOFromFile(config.compareFileName);
// Check edge count
assert(graph->numEdges == reference->numEdges);
// Convert graphs to COO/CSR
COOCSRGraph* g = createEmptyCOOCSR(graph->numNodes, graph->numEdges);
COOCSRGraph* gr = createEmptyCOOCSR(reference->numNodes, reference->numEdges);
coo2coocsr(graph, g);
coo2coocsr(reference, gr);
// Compare COO/CSR graphs
for(unsigned int e = 0; e < g->numEdges; ++e) {
assert(g->srcIdx[e] == gr->srcIdx[e]);
assert(g->dstIdx[e] == gr->dstIdx[e]);
}
// Free COO/CSR graphs
freeCOOCSRGraph(g);
freeCOOCSRGraph(gr);
freeCOOGraph(reference);
// Passed
if(config.verbosity >= 1) printf(" PASSED\n");
}