X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/648f354f59e3ae712e973c2268b1c69395b6fdf2..1687df79d61a9418bba830bbd0ab7de16e457090:/src/smpi/colls/reduce-rab.c diff --git a/src/smpi/colls/reduce-rab.c b/src/smpi/colls/reduce-rab.c index 0e8db8f174..61653b7b98 100644 --- a/src/smpi/colls/reduce-rab.c +++ b/src/smpi/colls/reduce-rab.c @@ -3,11 +3,11 @@ /* Copyright: Rolf Rabenseifner, 1997 * Computing Center University of Stuttgart - * rabenseifner@rus.uni-stuttgart.de + * rabenseifner@rus.uni-stuttgart.de * - * The usage of this software is free, + * The usage of this software is free, * but this header must not be removed. - */ + */ #include "colls_private.h" #include @@ -301,7 +301,7 @@ Benchmark results on CRAY T3E MPI: /opt/ctl/mpt/1.1.0.3 datatype: MPI_DOUBLE Ldb[][] = {{ 896,1728, 576, 736},{ 448,1280, 512, 512}} - env: export MPI_BUFFER_MAX=4099 + env: export MPI_BUFFER_MAX=4099 compiled with: cc -c -O3 -h restrict=f old = binary tree protocol of the vendor @@ -410,11 +410,11 @@ Benchmark results on CRAY T3E #endif typedef enum {MPIM_SHORT, MPIM_INT, MPIM_LONG, MPIM_UNSIGNED_SHORT, - MPIM_UNSIGNED, MPIM_UNSIGNED_LONG, MPIM_FLOAT, + MPIM_UNSIGNED, MPIM_UNSIGNED_LONG, MPIM_UNSIGNED_LONG_LONG, MPIM_FLOAT, MPIM_DOUBLE, MPIM_BYTE} MPIM_Datatype; -typedef enum {MPIM_MAX, MPIM_MIN, MPIM_SUM, MPIM_PROD, - MPIM_LAND, MPIM_BAND, MPIM_LOR, MPIM_BOR, +typedef enum {MPIM_MAX, MPIM_MIN, MPIM_SUM, MPIM_PROD, + MPIM_LAND, MPIM_BAND, MPIM_LOR, MPIM_BOR, MPIM_LXOR, MPIM_BXOR} MPIM_Op; #define MPI_I_DO_OP_C_INTEGER(MPI_I_do_op_TYPE,TYPE) \ static void MPI_I_do_op_TYPE(TYPE* b1,TYPE* b2,TYPE* rslt, int cnt,MPIM_Op op)\ @@ -467,6 +467,7 @@ MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_long, long) MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_ushort, unsigned short) MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_uint, unsigned int) MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_ulong, unsigned long) +MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_ulonglong, unsigned long long) MPI_I_DO_OP_FP( MPI_I_do_op_float, float) MPI_I_DO_OP_FP( MPI_I_do_op_double, double) MPI_I_DO_OP_BYTE( MPI_I_do_op_byte, char) @@ -487,6 +488,8 @@ static void MPI_I_do_op(void* b1, void* b2, void* rslt, int cnt, MPI_I_DO_OP_CALL(MPI_I_do_op_uint, unsigned int) case MPIM_UNSIGNED_LONG: MPI_I_DO_OP_CALL(MPI_I_do_op_ulong, unsigned long) + case MPIM_UNSIGNED_LONG_LONG: + MPI_I_DO_OP_CALL(MPI_I_do_op_ulonglong, unsigned long long) case MPIM_FLOAT : MPI_I_DO_OP_CALL(MPI_I_do_op_float, float) case MPIM_DOUBLE: MPI_I_DO_OP_CALL(MPI_I_do_op_double, double) case MPIM_BYTE : MPI_I_DO_OP_CALL(MPI_I_do_op_byte, char) @@ -499,24 +502,27 @@ static int MPI_I_anyReduce(void* Sendbuf, void* Recvbuf, int count, MPI_Datatype { char *scr1buf, *scr2buf, *scr3buf, *xxx, *sendbuf, *recvbuf; int myrank, size, x_base, x_size, computed, idx; - int x_start, x_count, r, n, mynewrank, newroot, partner; + int x_start, x_count = 0, r, n, mynewrank, newroot, partner; int start_even[20], start_odd[20], count_even[20], count_odd[20]; MPI_Aint typelng; MPI_Status status; size_t scrlng; int new_prot; - MPIM_Datatype datatype; MPIM_Op op; - + MPIM_Datatype datatype = MPIM_INT; MPIM_Op op = MPIM_MAX; + if (mpi_datatype==MPI_SHORT ) datatype=MPIM_SHORT; else if(mpi_datatype==MPI_INT ) datatype=MPIM_INT; else if(mpi_datatype==MPI_LONG ) datatype=MPIM_LONG; else if(mpi_datatype==MPI_UNSIGNED_SHORT) datatype=MPIM_UNSIGNED_SHORT; else if(mpi_datatype==MPI_UNSIGNED ) datatype=MPIM_UNSIGNED; else if(mpi_datatype==MPI_UNSIGNED_LONG ) datatype=MPIM_UNSIGNED_LONG; + else if(mpi_datatype==MPI_UNSIGNED_LONG_LONG ) datatype=MPIM_UNSIGNED_LONG_LONG; else if(mpi_datatype==MPI_FLOAT ) datatype=MPIM_FLOAT; else if(mpi_datatype==MPI_DOUBLE ) datatype=MPIM_DOUBLE; else if(mpi_datatype==MPI_BYTE ) datatype=MPIM_BYTE; - + else + THROWF(arg_error,0, "reduce rab algorithm can't be used with this datatype ! "); + if (mpi_op==MPI_MAX ) op=MPIM_MAX; else if(mpi_op==MPI_MIN ) op=MPIM_MIN; else if(mpi_op==MPI_SUM ) op=MPIM_SUM; @@ -531,10 +537,10 @@ static int MPI_I_anyReduce(void* Sendbuf, void* Recvbuf, int count, MPI_Datatype new_prot = 0; MPI_Comm_size(comm, &size); if (size > 1) /*otherwise no balancing_protocol*/ - { register int ss; + { int ss; if (size==2) ss=0; else if (size==3) ss=1; - else { register int s = size; while (!(s & 1)) s = s >> 1; + else { int s = size; while (!(s & 1)) s = s >> 1; if (s==1) /* size == power of 2 */ ss = 2; else /* size != power of 2 */ ss = 3; } switch(op) { @@ -546,7 +552,7 @@ static int MPI_I_anyReduce(void* Sendbuf, void* Recvbuf, int count, MPI_Datatype new_prot = count >= Lsh[is_all][ss]; break; case MPIM_INT: case MPIM_UNSIGNED: new_prot = count >= Lin[is_all][ss]; break; - case MPIM_LONG: case MPIM_UNSIGNED_LONG: + case MPIM_LONG: case MPIM_UNSIGNED_LONG: case MPIM_UNSIGNED_LONG_LONG: new_prot = count >= Llg[is_all][ss]; break; default: break;