From: jean-noel quintin Date: Tue, 9 Oct 2012 17:40:32 +0000 (+0100) Subject: [examples,smpi] remove warnings and resolve a bug (I hope I amn't sure) X-Git-Tag: v3_8~94 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/309519cea2b6a86eecee99369b8d5a383b71c1a5?ds=sidebyside [examples,smpi] remove warnings and resolve a bug (I hope I amn't sure) --- diff --git a/examples/smpi/MM/2.5D_MM.c b/examples/smpi/MM/2.5D_MM.c index 63e4058619..514ac43af2 100644 --- a/examples/smpi/MM/2.5D_MM.c +++ b/examples/smpi/MM/2.5D_MM.c @@ -6,6 +6,7 @@ #include "Matrix_init.h" #include "Summa.h" +#include "2.5D_MM.h" #include "timer.h" #include #include "xbt/log.h" diff --git a/examples/smpi/MM/MM_mpi.c b/examples/smpi/MM/MM_mpi.c index 7ab7d14371..23d2e2be2a 100644 --- a/examples/smpi/MM/MM_mpi.c +++ b/examples/smpi/MM/MM_mpi.c @@ -171,7 +171,6 @@ int main(int argc, char ** argv) size_row, size_col, NB_groups); // close properly the pragram -end: MPI_Barrier(MPI_COMM_WORLD); MPI_Finalize(); return 0; diff --git a/examples/smpi/MM/Matrix_init.c b/examples/smpi/MM/Matrix_init.c index 9688c4ef3a..7492f434d5 100644 --- a/examples/smpi/MM/Matrix_init.c +++ b/examples/smpi/MM/Matrix_init.c @@ -1,5 +1,6 @@ #include "Matrix_init.h" #include +#include #include "xbt/log.h" XBT_LOG_NEW_DEFAULT_CATEGORY(MM_init, "Messages specific for this msg example"); diff --git a/examples/smpi/MM/Summa.c b/examples/smpi/MM/Summa.c index 617bfaa190..6b64619511 100644 --- a/examples/smpi/MM/Summa.c +++ b/examples/smpi/MM/Summa.c @@ -23,7 +23,7 @@ inline double Summa( { double *B_a , *B_b ; //matrix blocks size_t err; - double alpha = 1, beta = 1; //C := alpha * a * b + beta * c + //double alpha = 1, beta = 1; //C := alpha * a * b + beta * c size_t B_proc_col, B_proc_row; // Number of bloc(row or col) on one processor B_proc_col = k_b / Block_size; // Number of block on one processor B_proc_row = k_a / Block_size; // Number of block on one processor @@ -137,7 +137,7 @@ inline double Summa( for(i = 0; i < m; i++) for(j = 0; j < n; j++) for(k = 0; k < Block_size; k++) - c[i*ldc+j] += B_a[j*lda_local+k]*B_b[k*ldb_local+j]; + c[i*ldc+j] += B_a[i*lda_local+k]*B_b[k*ldb_local+j]; get_time(&end_time_intern); computation_time += get_timediff(&start_time_intern,&end_time_intern); diff --git a/examples/smpi/MM/param.c b/examples/smpi/MM/param.c index 3cab7f9056..a72e75c615 100644 --- a/examples/smpi/MM/param.c +++ b/examples/smpi/MM/param.c @@ -15,6 +15,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(MM_param, "Messages specific for this msg example"); +int match(const char *s, char p); +char** get_list_param(const char* input); int match(const char *s, char p) { int c = 0; @@ -43,7 +45,7 @@ char** get_list_param(const char* input){ return list_param; } -char** get_conf(MPI_Comm comm, char * filename, int mynoderank) +char** get_conf(MPI_Comm comm, const char * filename, int mynoderank) { if(filename == NULL) return NULL; if(mynoderank == -1){ @@ -170,7 +172,6 @@ void print_conf(MPI_Comm comm, int rank, FILE* file, char * default_options){ int len; MPI_Get_processor_name(name, &len); if(file == NULL) file = stdout; - if(default_options == NULL) default_options = ""; MPI_Comm comm_node; split_comm_intra_node(comm, &comm_node, 0); @@ -184,7 +185,10 @@ void print_conf(MPI_Comm comm, int rank, FILE* file, char * default_options){ if(rank == 0){ fprintf(file, "#processor_name index USER ARGS (like the cpu binding ...)\n"); for(i = 0; i < size; i++){ - fprintf(file, "%s %d %s\n", names[i],index[i],default_options); + if(default_options != NULL) + fprintf(file, "%s %d %s\n", names[i],index[i],default_options); + else + fprintf(file, "%s %d\n", names[i],index[i]); } } free(names); diff --git a/examples/smpi/MM/param.h b/examples/smpi/MM/param.h index fa29681ec8..86f837be2f 100644 --- a/examples/smpi/MM/param.h +++ b/examples/smpi/MM/param.h @@ -23,7 +23,7 @@ */ /*! reads a file and returns the specific parameters for the process */ -char** get_conf(MPI_Comm comm, char * filename, int mynoderank); +char** get_conf(MPI_Comm comm, const char * filename, int mynoderank); /*! reads a file and returns the parameters of every processes */ char*** get_conf_all(char * filename, int * nb_process); diff --git a/examples/smpi/MM/timer.c b/examples/smpi/MM/timer.c index 4b2e0adcd0..a647f98712 100644 --- a/examples/smpi/MM/timer.c +++ b/examples/smpi/MM/timer.c @@ -28,6 +28,7 @@ inline int get_time(struct timespec *tp){ time = time * 1000000000; tp->tv_nsec = (long) time; tp->tv_sec = value ; + return 0; } double get_timediff(struct timespec *start, struct timespec *end){ diff --git a/examples/smpi/MM/timer.h b/examples/smpi/MM/timer.h index 5a59a24ea4..bb4568714d 100644 --- a/examples/smpi/MM/timer.h +++ b/examples/smpi/MM/timer.h @@ -6,6 +6,7 @@ */ # include +inline double get_second(struct timespec *res); inline double get_microsecond(struct timespec *res); inline double get_nanosecond(struct timespec *res);