int main(int argc, char *argv[]) { /* Serena's seed */ int sseed; if (argc == 2) { sseed = atol(argv[1]); } srand(sseed); /* Default parameters. */ unsigned seed = rand(); int nmax = 50; int n = rand() % nmax; srand(seed); if (n > MAX_PATH) n = MAX_PATH; init_array(n, path); #if 0 print_array(n, path); #endif kernel_floyd_warshall(n, path); #if 0 print_array(n, path); #endif return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(path, DATA_TYPE, N, N, n, n); /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(path)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_floyd_warshall (n, POLYBENCH_ARRAY(path)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #ifdef __PRINT print_array(n,POLYBENCH_ARRAY(path)); #endif /* Prevent dead-code elimination. All live-out data must be printed by the function call in argument. */ polybench_prevent_dce(print_array(n, POLYBENCH_ARRAY(path))); /* Be clean. */ POLYBENCH_FREE_ARRAY(path); return 0; }
int main(int argc, char *argv[]) { /* Default parameters. */ unsigned seed = 1; int n = 2; /* Override default random seed. */ if (argc > 1) srandom(seed = atoi(argv[1])); /* Override default size of array. */ if (argc > 2) n = atoi(argv[2]); if (n > MAX_PATH) n = MAX_PATH; init_array(n, path); #if 0 print_array(n, path); #endif kernel_floyd_warshall(n, path); #if 0 print_array(n, path); #endif return 0; }
int main(int argc, char** argv) { int n = N; Arr2D<int> path{n, n}; init_array(n, &path); { util::block_timer t{"FLOYD-WARSHALL"}; kernel_floyd_warshall(n, &path); } if (argc > 42) print_array(n, &path); return 0; }
int main(int argc, char** argv) { #pragma hmpp floydwarshall acquire /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(path, DATA_TYPE, N, N, n, n); #pragma hmpp floydwarshall allocate, & #pragma hmpp & args[path].size={n,n}, args[path].hostdata="path" /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(path)); #pragma hmpp floydwarshall advancedload, args[path] /* Start timer. */ polybench_start_instruments; /* Run kernel. */ #pragma hmpp floydwarshall callsite kernel_floyd_warshall (n, POLYBENCH_ARRAY(path)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #pragma hmpp floydwarshall delegatedstore, args[path] /* Prevent dead-code elimination. All live-out data must be printed by the function call in argument. */ polybench_prevent_dce(print_array(n, POLYBENCH_ARRAY(path))); /* Be clean. */ POLYBENCH_FREE_ARRAY(path); #pragma hmpp floydwarshall release return 0; }