6
6
*/
7
7
#include < dawn/algorithm/gpu/apsp.cuh>
8
8
int main (int argc, char * argv[]) {
9
+ DAWN::IO::parameters_t params = DAWN::IO::parameters (argc, argv);
9
10
DAWN::Graph::Graph_t graph;
10
-
11
- std::string input_path = argv[1 ];
12
- std::string output_path = argv[2 ];
13
- graph.stream = atoi (argv[3 ]);
14
- graph.block_size = atoi (argv[4 ]);
15
- std::string print = argv[5 ];
16
- graph.source = atoi (argv[6 ]);
17
- std::string weighted = argv[7 ];
18
-
11
+ graph.source = params.source ;
12
+ graph.print = params.print ;
13
+ graph.weighted = params.weighted ;
14
+ graph.thread = 1 ;
15
+ graph.stream = 4 ;
16
+ graph.block_size = 1024 ;
19
17
graph.interval = 100 ;
20
18
21
- if (print == " true" ) {
22
- graph.print = true ;
23
- std::cout << " Print source " << graph.source << std::endl;
24
- } else {
25
- graph.print = false ;
26
- }
27
-
28
- DAWN::Graph::createGraph (input_path, graph);
29
-
30
- if (weighted == " weighted" ) {
31
- graph.weighted = true ;
32
-
33
- float elapsed_time = DAWN::APSP_GPU::run_Weighted (graph, output_path);
19
+ DAWN::Graph::createGraph (params.input_path , graph);
34
20
21
+ if (graph.weighted ) {
22
+ float elapsed_time =
23
+ DAWN::APSP_GPU::run_Weighted (graph, params.output_path );
35
24
printf (" %-21s%3.5d\n " , " Nodes:" , graph.rows );
36
25
printf (" %-21s%3.5ld\n " , " Edges:" , graph.nnz );
37
26
printf (" %-21s%3.5lf\n " , " Time:" , elapsed_time);
38
27
} else {
39
- graph.weighted = false ;
40
-
41
- float elapsed_time = DAWN::APSP_GPU::run (graph, output_path);
42
-
28
+ float elapsed_time = DAWN::APSP_GPU::run (graph, params.output_path );
43
29
printf (" %-21s%3.5d\n " , " Nodes:" , graph.rows );
44
30
printf (" %-21s%3.5ld\n " , " Edges:" , graph.nnz );
45
31
printf (" %-21s%3.5lf\n " , " Time:" , elapsed_time);
46
32
}
47
33
48
34
return 0 ;
49
- }
50
- // ./apsp_gpu $GRAPH_DIR/XXX.mtx ../output.txt 8 1024 false 0 unweighted
51
- // ./apsp_gpu $GRAPH_DIR/XXX.mtx ../output.txt 8 1024 false 0 weighted
35
+ }
0 commit comments