Commit 31fb7973 authored by Antoine Jego's avatar Antoine Jego
Browse files

added nowarmup and context for C example

parent d0a6fd5b
......@@ -61,6 +61,8 @@ static struct argp_option options[] = {
{"prune", 'r', 0, 0, "If handed out to the program, prune the DAG tightly enough (relying on STARPU+mpi cache to avoid redundant data transfers)."},
{"super-prune", 'R', 0, 0, "If handed out to the program, prune the DAG as tightly as possible."},
{"prune-handles",'z', 0, 0, "If handed out to the program, prune the handle registration."},
{"own-context", 'o', 0, 0, "If handed out to the program, schedule tasks in a created context."},
{"nowarmup", 'w', 0, 0, "If handed out to the program, register warmup run."},
{ 0 }
};
......@@ -73,6 +75,8 @@ struct arguments
int niter;
int mpi_thread, datatype;
int no_flush, prune, super_prune, prune_handles;
int context;
int warmup;
};
......@@ -132,6 +136,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'z':
arguments->prune_handles = 1;
break;
case 'o':
arguments->context = 1;
break;
case 'w':
arguments->warmup = 0;
break;
default:
return ARGP_ERR_UNKNOWN;
}
......@@ -156,6 +166,8 @@ static int flush = 1;
static int prune = 0;
static int super_prune = 0;
static int prune_handles = 0;
static int context = 0;
static int warmup = 1;
#define MB ((M)/(BS)) /* Number of blocks */
#define NB ((N)/(BS)) /* Number of blocks */
......@@ -474,6 +486,7 @@ int main(int argc, char *argv[])
arguments.prune = 0;
arguments.super_prune = 0;
arguments.prune_handles = 0;
arguments.context = 0;
argp_parse(&argp, argc, argv, 0, 0, &arguments);
M = arguments.m;
......@@ -492,6 +505,7 @@ int main(int argc, char *argv[])
prune = arguments.prune;
super_prune = arguments.super_prune;
prune_handles = arguments.prune_handles;
context = arguments.context;
/* Initializes StarPU and the StarPU-MPI layer */
starpu_fxt_autostart_profiling(0);
......@@ -523,7 +537,8 @@ int main(int argc, char *argv[])
if (comm_rank == 0) printf("Launching with %d arguments\n",argc);
if (starpu_cpu_worker_get_count() == 0)
int ncpu = starpu_cpu_worker_get_count();
if (ncpu == 0)
{
fprintf(stderr, "We need at least 1 CPU worker.\n");
starpu_mpi_shutdown();
......@@ -556,11 +571,22 @@ int main(int argc, char *argv[])
if (super_prune) printf("- Super-Pruning enabled\n");
if (prune) printf("- Pruning enabled\n");
if (prune_handles) printf("- Handle pruning enabled\n");
if (context) printf("- Submitting own context\n");
if (!warmup) printf("- Warmup disabled\n");
}
int barrier_ret, trial;
double start, stop;
double alpha = 3.14, beta=0.42;
if (trace) starpu_fxt_start_profiling();
unsigned ctx;
int* procs;
if (context) {
procs = (int*) malloc(ncpu*sizeof(int));
starpu_worker_get_ids_by_type(STARPU_CPU_WORKER, procs, ncpu);
ctx = starpu_sched_ctx_create(procs, ncpu,"std_ctx",
STARPU_SCHED_CTX_POLICY_NAME, "lws", 0);
}
if (warmup) T++;
for (trial =0; trial < T; trial++)
{
alloc_matrices();
......@@ -627,7 +653,7 @@ int main(int argc, char *argv[])
barrier_ret = starpu_mpi_barrier(MPI_COMM_WORLD);
stop = starpu_timing_now();
double timing = stop - start;
if (comm_rank==0) printf("RANK %d -> took %f s | %f Gflop/s\n", comm_rank, timing/1000/1000, 2.0*M*N*K/(timing*1000));
if (comm_rank==0 && (!warmup || trial > 1)) printf("RANK %d -> took %f s | %f Gflop/s\n", comm_rank, timing/1000/1000, 2.0*M*N*K/(timing*1000));
if (check) {
Matrix* Acheck, *Bcheck, *Ccheck;
......@@ -693,6 +719,10 @@ int main(int argc, char *argv[])
free_matrices();
}
if (context) {
starpu_sched_ctx_delete(ctx);
free(procs);
}
if (trace) starpu_fxt_stop_profiling();
starpu_mpi_shutdown();
if (mpi_thread > -1) MPI_Finalize();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment