Commit d19ad7f1 authored by Antoine Jego's avatar Antoine Jego
Browse files

fixed build

parent 8d2b6830
......@@ -107,9 +107,9 @@ find_package(LAPACKE REQUIRED)
# Add the unique executable ...
# -------------
add_library(Tile_interface optional_tile_interface.c)
add_library(Dense_matrices dsmat.c)
add_executable( starpu_example_dgemm starpu_example_dgemm.c )
add_library(Tile_interface optional_tile_interface.c)
add_executable( starpu_example_dgemm starpu_example_dgemm.c dsmat.c optional_tile_interface.c )
if( ENABLE_MPI )
target_link_libraries( Dense_matrices PUBLIC MPI::MPI_C )
target_link_libraries( Tile_interface PUBLIC MPI::MPI_C )
......
......@@ -33,8 +33,6 @@
#include "dsmat.h"
#include "optional_tile_interface.h"
#define VERBOSE 0
/* STARPU_EXAMPLE_DGEMM default values */
#define STARPU_EXAMPLE_DGEMM_TRACE 0
#define STARPU_EXAMPLE_DGEMM_OWNDATATYPE 0
......@@ -54,6 +52,7 @@ static struct argp_option options[] = {
{"p", 'p', "int", 0, "Length of the logical grid"},
{"q", 'q', "int", 0, "Width of the logical grid"},
{"check", 'c', 0, 0, "If the program checks gemm results (NOT INTERPRETED)"},
{"verbose", 'v', 0, 0, "Extend program vebosity"},
{"trace", 'f', 0, 0, "Whether or not to use FxT tracing"},
{"niter", 'l', "int", 0, "Number of iterations (loops)"},
{"mpi-thread",'t', "int", 0, "MPI thread level support : -1 StarPU, 0 SINGLE, 1 FUNNELED, 2 SERIALIZED, 3 MULTIPLE"},
......@@ -66,7 +65,7 @@ struct arguments
{
int m, n, k, b;
int p, q;
int check,trace;
int check,verbose,trace;
int niter;
int mpi_thread, datatype;
};
......@@ -98,14 +97,22 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
case 'c':
arguments->check = 1;
break;
case 'v':
arguments->verbose = 1;
break;
case 'f':
arguments->trace = 1;
break;
case 'l':
arguments->niter = atoi(arg);
break;
case 't':
arguments->mpi_thread = atoi(arg);
break;
case 'd':
arguments->datatype = 1;
break;
default:
return ARGP_ERR_UNKNOWN;
}
......@@ -125,6 +132,7 @@ static int trace = STARPU_EXAMPLE_DGEMM_TRACE; /* whether to trace */
static int datatype =
STARPU_EXAMPLE_DGEMM_OWNDATATYPE; /* whether to register our own datatype */
static int mpi_thread = -1; /* whether to register our own datatype */
static int verbose = 0;
#define MB ((M)/(BS)) /* Number of blocks */
#define NB ((N)/(BS)) /* Number of blocks */
......@@ -148,7 +156,7 @@ static Matrix *C = NULL; /* C will be partitioned as MB x NB blocks */
static void alloc_matrices(void)
{
if (VERBOSE) printf( "Allocating matrices\n");
if (verbose) printf( "Allocating matrices\n");
A = alloc_matrix(MB,KB,BS,P,Q);
B = alloc_matrix(KB,NB,BS,P,Q);
C = alloc_matrix(MB,NB,BS,P,Q);
......@@ -156,7 +164,7 @@ static void alloc_matrices(void)
static void free_matrices(void)
{
if (VERBOSE) printf( "Freeing matrices\n");
if (verbose) printf( "Freeing matrices\n");
free_matrix(A,MB,KB);
free_matrix(B,KB,NB);
free_matrix(C,MB,NB);
......@@ -166,7 +174,7 @@ starpu_mpi_tag_t tag = 0;
/* Register the matrix blocks to StarPU and to StarPU-MPI */
static void register_matrices()
{
if (VERBOSE) printf("Registering matrices\n");
if (verbose) printf("Registering matrices\n");
A_h = calloc(MB*KB, sizeof(starpu_data_handle_t));
B_h = calloc(KB*NB, sizeof(starpu_data_handle_t));
C_h = calloc(MB*NB, sizeof(starpu_data_handle_t));
......@@ -182,7 +190,7 @@ static void register_matrices()
/* Unregister matrices from the StarPU management. */
static void unregister_matrices()
{
if (VERBOSE) printf( "Unregistering matrices\n");
if (verbose) printf( "Unregistering matrices\n");
/* unregister_matrix(A,A_h,MB,KB);
unregister_matrix(B,B_h,KB,NB);
unregister_matrix(C,C_h,MB,NB);
......@@ -206,7 +214,7 @@ static void cpu_gemm(void *handles[], void *arg)
unsigned ld_B = STARPU_MATRIX_GET_LD(handles[1]);
unsigned ld_C = STARPU_MATRIX_GET_LD(handles[2]);
if (VERBOSE) printf("gemm_task\n");
if (verbose) printf("gemm_task\n");
cblas_dgemm( CblasColMajor, CblasNoTrans, CblasNoTrans,
n_row_C, n_col_C, n_col_A, 1.0, block_A, ld_A, block_B,
ld_B, 1.0, block_C, ld_C );
......@@ -222,7 +230,7 @@ static void cpu_fill(void *handles[], void *arg)
unsigned ld_A = STARPU_MATRIX_GET_LD(handles[0]);
int i,j;
if (VERBOSE) printf("fill_task\n");
if (verbose) printf("fill_task\n");
for (i=0;i<n_row_A;i++)
{
for (j=0;j<n_col_A;j++)
......@@ -260,6 +268,7 @@ static void init_matrix(Matrix* X, starpu_data_handle_t* X_h, int mb, int nb)
{
if (X->blocks[row*nb+col].owner == comm_rank)
{
printf("%d insert fill X_%d,%d\n",comm_rank,row,col);
starpu_mpi_task_insert(MPI_COMM_WORLD, &fill_cl,
STARPU_W, X_h[row*nb+col], 0);
}
......@@ -269,7 +278,7 @@ static void init_matrix(Matrix* X, starpu_data_handle_t* X_h, int mb, int nb)
static void init_matrices(void)
{
if (VERBOSE) printf( "Initializing matrices\n");
if (verbose) printf( "Initializing matrices\n");
// I own all the blocks
init_matrix(A,A_h,MB,KB);
starpu_mpi_wait_for_all(MPI_COMM_WORLD);
......@@ -290,6 +299,8 @@ int main(int argc, char *argv[])
arguments.p = P;
arguments.q = Q;
arguments.check = 0;
arguments.verbose = 0;
arguments.trace = 0;
arguments.niter = T;
arguments.mpi_thread = mpi_thread;
arguments.datatype = datatype;
......@@ -302,6 +313,7 @@ int main(int argc, char *argv[])
P = arguments.p;
Q = arguments.q;
// check
verbose = arguments.verbose;
trace = arguments.trace;
T = arguments.niter;
mpi_thread = arguments.mpi_thread;
......@@ -377,7 +389,7 @@ int main(int argc, char *argv[])
printf("PxQ = %dx%d\n", P, Q);
if (trace) printf("- Tracing enabled\n");
if (datatype) printf("- MPI datatype enabled\n");
if (mpi_thread > -1) printf("MPI thread support level : \n", provided_mpi_thread);
if (mpi_thread > -1) printf("MPI thread support level : %d\n", provided_mpi_thread);
}
int barrier_ret, trial;
double start, stop;
......
Supports Markdown
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