0, tag, comm, &status);
/* at this point all nodes in this set perform all-gather operation */
- to = header_buf[myordering + 1];
- from = header_buf[myordering - 1];
- if (myordering == 0)
- from = header_buf[total_nodes - 1];
- if (myordering == (total_nodes - 1))
- to = header_buf[0];
+
+ to = (myordering == (total_nodes - 1)) ? header_buf[0] : header_buf[myordering + 1];
+ from = (myordering == 0) ? header_buf[total_nodes - 1] : header_buf[myordering - 1];
/* last segment may have a larger size since it also include the remainder */
#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,
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)
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)
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;
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;
std::vector<MPI_Request> *reqs = win->requests;
int size = static_cast<int>(reqs->size());
// start all requests that have been prepared by another process
- for(auto req: *reqs){
- if (req && (req->flags & PREPARED))
- smpi_mpi_start(req);
- }
+ if(size>0){
+ for(auto req: *reqs){
+ if (req && (req->flags & PREPARED))
+ smpi_mpi_start(req);
+ }
+
+ MPI_Request* treqs = &(*reqs)[0];
- MPI_Request* treqs = &(*reqs)[0];
- smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
+ smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
+ }
win->count=0;
}
win->assert = assert;
{
int rank, size;
int i;
- long int *sb;
- long int *rb;
+ unsigned long long *sb;
+ unsigned long long *rb;
int status;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
- sb = (long int *) xbt_malloc(size * sizeof(long int));
- rb = (long int *) xbt_malloc(size * sizeof(long int));
+ sb = (unsigned long long *) xbt_malloc(size * sizeof(unsigned long long));
+ rb = (unsigned long long *) xbt_malloc(size * sizeof(unsigned long long));
for (i = 0; i < size; ++i) {
sb[i] = rank*size + i;
}
printf("[%d] sndbuf=[", rank);
for (i = 0; i < size; i++)
- printf("%ld ", sb[i]);
+ printf("%llu ", sb[i]);
printf("]\n");
int root=0;
- status = MPI_Reduce(sb, rb, size, MPI_LONG, MPI_SUM, root, MPI_COMM_WORLD);
+ status = MPI_Reduce(sb, rb, size, MPI_UNSIGNED_LONG_LONG, MPI_SUM, root, MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
if (rank == root) {
printf("[%d] rcvbuf=[", rank);
for (i = 0; i < size; i++)
- printf("%ld ", rb[i]);
+ printf("%llu ", rb[i]);
printf("]\n");
if (status != MPI_SUCCESS) {
printf("all_to_all returned %d\n", status);
printf("[%d] second sndbuf=[", rank);
for (i = 0; i < 1; i++)
- printf("%ld ", sb[i]);
+ printf("%llu ", sb[i]);
printf("]\n");
root=size-1;
- status = MPI_Reduce(sb, rb, 1, MPI_LONG, MPI_PROD, root, MPI_COMM_WORLD);
+ status = MPI_Reduce(sb, rb, 1, MPI_UNSIGNED_LONG_LONG, MPI_PROD, root, MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
if (rank == root) {
printf("[%d] rcvbuf=[", rank);
for (i = 0; i < 1; i++)
- printf("%ld ", rb[i]);
+ printf("%llu ", rb[i]);
printf("]\n");
if (status != MPI_SUCCESS) {
printf("all_to_all returned %d\n", status);