MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / main

Function main

deps/GraphBLAS/Demo/Program/kron_demo.c:40–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38#include "graphblas_demos.h"
39
40int main (int argc, char **argv)
41{
42 //--------------------------------------------------------------------------
43 // check inputs
44 //--------------------------------------------------------------------------
45
46 GrB_Matrix A = NULL, B = NULL, C = NULL ;
47 GrB_Index *I = NULL, *J = NULL ;
48 FILE *Afile = NULL, *Bfile = NULL, *Cfile = NULL ;
49 double *X = NULL ;
50 GrB_Info info ;
51
52 OK (GrB_init (GrB_NONBLOCKING)) ;
53 int nthreads ;
54 OK (GxB_Global_Option_get (GxB_GLOBAL_NTHREADS, &nthreads)) ;
55 fprintf (stderr, "kron demo: nthreads %d\n", nthreads) ;
56
57 // printf ("argc %d\n", argc) ;
58 if (argc != 4)
59 {
60 FREE_ALL ;
61 fprintf (stderr, "usage: kron_demo A.tsv B.tsv C.tsv\n") ;
62 exit (1) ;
63 }
64
65 Afile = fopen (argv [1], "r") ;
66 Bfile = fopen (argv [2], "r") ;
67 Cfile = fopen (argv [3], "w") ;
68 if (Afile == NULL || Bfile == NULL || Cfile == NULL)
69 {
70 FREE_ALL ;
71 fprintf (stderr, "unable to read input files or create output file\n") ;
72 exit (1) ;
73 }
74
75 //--------------------------------------------------------------------------
76 // get A and B from input files
77 //--------------------------------------------------------------------------
78
79 // this would be faster and take less memory if GraphBLAS had a built-in
80 // read-from-file operation
81 OK (read_matrix (&A, Afile, false, false, true, false, false)) ;
82 OK (read_matrix (&B, Bfile, false, false, true, false, false)) ;
83
84 fclose (Afile) ;
85 fclose (Bfile) ;
86 Afile = NULL ;
87 Bfile = NULL ;
88
89 GrB_Index anrows, ancols, bnrows, bncols, anvals, bnvals ;
90 OK (GrB_Matrix_nrows (&anrows, A)) ;
91 OK (GrB_Matrix_ncols (&ancols, A)) ;
92 OK (GrB_Matrix_nvals (&anvals, A)) ;
93 OK (GrB_Matrix_nrows (&bnrows, B)) ;
94 OK (GrB_Matrix_ncols (&bncols, B)) ;
95 OK (GrB_Matrix_nvals (&bnvals, B)) ;
96
97 //--------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 9

GrB_initFunction · 0.85
GxB_Global_Option_getFunction · 0.85
read_matrixFunction · 0.85
GrB_Matrix_nrowsFunction · 0.85
GrB_Matrix_ncolsFunction · 0.85
GrB_Matrix_nvalsFunction · 0.85
GrB_Matrix_newFunction · 0.85
GrB_Matrix_freeFunction · 0.85

Tested by

no test coverage detected