From: Arnaud Giersch Date: Mon, 25 Mar 2013 21:27:09 +0000 (+0100) Subject: Fix various build errors. X-Git-Tag: v3_9_90~412^2~87 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/25fd5bf34caebe9efb725c743c7c4e0319c46ad2 Fix various build errors. Mainly unused variables, or pointer arithmetic with pointers to void. The builds with compile optimizations are still broken, because of smpi symbols imported in libsimgrid, but I'm not sure how to fix this properly. --- diff --git a/src/include/smpi/smpi_interface.h b/src/include/smpi/smpi_interface.h index ed7f5c4c5b..1609dede73 100644 --- a/src/include/smpi/smpi_interface.h +++ b/src/include/smpi/smpi_interface.h @@ -26,13 +26,13 @@ typedef struct mpi_coll_description { * \brief The list of all available alltoall collectives */ XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_alltoall_description[]; -int (*mpi_coll_alltoall_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm); +XBT_PUBLIC_DATA(int (*mpi_coll_alltoall_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm)); /** \ingroup MPI allgather * \brief The list of all available allgather collectives */ XBT_PUBLIC_DATA(s_mpi_coll_description_t) mpi_coll_allgather_description[]; -int (*mpi_coll_allgather_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm); +XBT_PUBLIC_DATA(int (*mpi_coll_allgather_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm)); XBT_PUBLIC(void) coll_help(const char *category, s_mpi_coll_description_t * table); XBT_PUBLIC(int) find_coll_description(s_mpi_coll_description_t * table, diff --git a/src/smpi/colls/alltoall-2dmesh.c b/src/smpi/colls/alltoall-2dmesh.c index 2b1a2a05b7..948957cf81 100644 --- a/src/smpi/colls/alltoall-2dmesh.c +++ b/src/smpi/colls/alltoall-2dmesh.c @@ -27,7 +27,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_colls, smpi, * Auther: Ahmad Faraj ****************************************************************************/ -int alltoall_check_is_2dmesh(int num, int *i, int *j) +static int alltoall_check_is_2dmesh(int num, int *i, int *j) { int x, max = num / 2; x = sqrt(num); @@ -62,8 +62,8 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count, char *tmp_buff1, *tmp_buff2; int i, j, src, dst, rank, num_procs, count, num_reqs; - int rows, cols, my_row, my_col, X, Y, send_offset, recv_offset; - int two_dsize, my_row_base, my_col_base, src_row_base, block_size; + int X, Y, send_offset, recv_offset; + int my_row_base, my_col_base, src_row_base, block_size; int tag = 1, failure = 0, success = 1; MPI_Comm_rank(comm, &rank); @@ -73,8 +73,6 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count, if (!alltoall_check_is_2dmesh(num_procs, &X, &Y)) return failure; - two_dsize = X * Y; - my_row_base = (rank / Y) * Y; my_col_base = rank % Y; @@ -139,14 +137,15 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count, recv_offset = (my_row_base * block_size) + (i * block_size); if (i + my_row_base == rank) - MPI_Sendrecv(send_buff + recv_offset, send_count, send_type, - rank, tag, recv_buff + recv_offset, recv_count, - recv_type, rank, tag, comm, &s); + MPI_Sendrecv((char *)send_buff + recv_offset, send_count, send_type, + rank, tag, + (char*)recv_buff + recv_offset, recv_count, recv_type, + rank, tag, comm, &s); else MPI_Sendrecv(tmp_buff1 + send_offset, send_count, send_type, rank, tag, - recv_buff + recv_offset, recv_count, recv_type, + (char *)recv_buff + recv_offset, recv_count, recv_type, rank, tag, comm, &s); } @@ -157,7 +156,7 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count, continue; src_row_base = (src / Y) * Y; - MPI_Irecv(recv_buff + src_row_base * block_size, recv_count * Y, + MPI_Irecv((char *)recv_buff + src_row_base * block_size, recv_count * Y, recv_type, src, tag, comm, req_ptr++); } @@ -171,7 +170,7 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count, send_offset = (dst + j * num_procs) * block_size; if (j + my_row_base == rank) - MPI_Sendrecv(send_buff + dst * block_size, send_count, send_type, + MPI_Sendrecv((char *)send_buff + dst * block_size, send_count, send_type, rank, tag, tmp_buff2 + recv_offset, recv_count, recv_type, rank, tag, comm, &s); diff --git a/src/smpi/colls/alltoall-3dmesh.c b/src/smpi/colls/alltoall-3dmesh.c index ed734e5b1f..7f6a766f91 100644 --- a/src/smpi/colls/alltoall-3dmesh.c +++ b/src/smpi/colls/alltoall-3dmesh.c @@ -24,7 +24,7 @@ * Auther: Ahmad Faraj ****************************************************************************/ -int alltoall_check_is_3dmesh(int num, int *i, int *j, int *k) +static int alltoall_check_is_3dmesh(int num, int *i, int *j, int *k) { int x, max = num / 3; x = cbrt(num); @@ -157,8 +157,8 @@ int smpi_coll_tuned_alltoall_3dmesh(void *send_buff, int send_count, send_offset = (rank * block_size) + (i * block_size * num_procs); recv_offset = (my_z_base * block_size) + (i * block_size); MPI_Sendrecv(tmp_buff1 + send_offset, send_count, send_type, rank, tag, - recv_buff + recv_offset, recv_count, recv_type, rank, tag, - comm, &status); + (char *)recv_buff + recv_offset, recv_count, recv_type, + rank, tag, comm, &status); } for (i = 1; i < Z; i++) { @@ -167,7 +167,7 @@ int smpi_coll_tuned_alltoall_3dmesh(void *send_buff, int send_count, recv_offset = (src_z_base * block_size); - MPI_Irecv(recv_buff + recv_offset, recv_count * two_dsize, recv_type, + MPI_Irecv((char *)recv_buff + recv_offset, recv_count * two_dsize, recv_type, src, tag, comm, req_ptr++); } diff --git a/src/smpi/colls/alltoall-pair.c b/src/smpi/colls/alltoall-pair.c index b54b226e69..8767708dba 100644 --- a/src/smpi/colls/alltoall-pair.c +++ b/src/smpi/colls/alltoall-pair.c @@ -1,4 +1,4 @@ -#include "smpi/mpi.h" +#include "colls.h" /***************************************************************************** diff --git a/src/smpi/colls/alltoall-rdb.c b/src/smpi/colls/alltoall-rdb.c index bbd337868f..5abbbc9e80 100644 --- a/src/smpi/colls/alltoall-rdb.c +++ b/src/smpi/colls/alltoall-rdb.c @@ -34,7 +34,7 @@ int smpi_coll_tuned_alltoall_rdb(void *send_buff, int send_count, int dst_tree_root, rank_tree_root, send_offset, recv_offset; int rank, num_procs, j, k, dst, curr_size, max_size; int last_recv_count, tmp_mask, tree_root, num_procs_completed; - int tag = 1, mask = 1, success = 1, failure = 0, c = 0, i = 0; + int tag = 1, mask = 1, success = 1, failure = 0, i = 0; char *tmp_buff; char *send_ptr = (char *) send_buff; diff --git a/src/smpi/colls/alltoall-simple.c b/src/smpi/colls/alltoall-simple.c index b8c72540ca..90e1c724ed 100644 --- a/src/smpi/colls/alltoall-simple.c +++ b/src/smpi/colls/alltoall-simple.c @@ -57,8 +57,10 @@ int smpi_coll_tuned_alltoall_simple(void *send_buff, int send_count, free(statuses); return 0; } - } else - req = 0; + } else { + req = NULL; + statuses = NULL; + } /* simple optimization */ diff --git a/src/smpi/smpi_coll.c b/src/smpi/smpi_coll.c index af699b9055..9dd439426b 100644 --- a/src/smpi/smpi_coll.c +++ b/src/smpi/smpi_coll.c @@ -117,6 +117,9 @@ int find_coll_description(s_mpi_coll_description_t * table, XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll)"); +int (*mpi_coll_alltoall_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm); +int (*mpi_coll_allgather_fun)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm); + struct s_proc_tree { int PROCTREE_A; int numChildren;