With non-blocking collectives, a "round schedule" could fall on any address
alignment, which typically causes problems on SPARC. Further, the pointer manipulation to access elements in a round schedule was clumsy. This change introduces macros to facilitate addressing and make it more portable. This commit was SVN r26802.
Этот коммит содержится в:
родитель
8f0525a8cc
Коммит
a3e02fdaff
@ -7,6 +7,8 @@
|
||||
*
|
||||
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
|
||||
*
|
||||
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
*/
|
||||
#include "nbc_internal.h"
|
||||
#include "ompi/mca/coll/base/coll_tags.h"
|
||||
@ -30,11 +32,16 @@ void NBC_Print_times(double div) {
|
||||
|
||||
/* allocates a new schedule array */
|
||||
int NBC_Sched_create(NBC_Schedule* schedule) {
|
||||
|
||||
int *ptr;
|
||||
|
||||
*schedule=malloc(2*sizeof(int));
|
||||
if(*schedule == NULL) { return NBC_OOR; }
|
||||
*(int*)*schedule=2*sizeof(int);
|
||||
*(((int*)*schedule)+1)=0;
|
||||
|
||||
/* initialize the schedule */
|
||||
ptr = (int*) *schedule;
|
||||
ptr[0] = 2 * sizeof(int); /* initial total size of the schedule */
|
||||
ptr[1] = 0; /* initial round-schedule has num=(int)0 and no actions */
|
||||
/* The schedule's final end=(char)0 delimiter won't be added until NBC_Sched_commit(). */
|
||||
|
||||
return NBC_OK;
|
||||
}
|
||||
@ -42,31 +49,34 @@ int NBC_Sched_create(NBC_Schedule* schedule) {
|
||||
/* this function puts a send into the schedule */
|
||||
int NBC_Sched_send(void* buf, char tmpbuf, int count, MPI_Datatype datatype, int dest, NBC_Schedule *schedule) {
|
||||
int size;
|
||||
NBC_Args_send* send_args;
|
||||
char* ptr;
|
||||
NBC_Fn_type type = SEND;
|
||||
NBC_Args_send send_args;
|
||||
|
||||
/* get size of actual schedule */
|
||||
NBC_GET_SIZE(*schedule, size);
|
||||
/*printf("schedule is %i bytes\n", size);*/
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Args_send)+sizeof(NBC_Fn_type));
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_send));
|
||||
if(*schedule == NULL) { printf("Error in realloc()\n"); return NBC_OOR; }
|
||||
|
||||
/* adjust the function type */
|
||||
*(NBC_Fn_type*)((char*)*schedule+size)=SEND;
|
||||
|
||||
/* store the passed arguments */
|
||||
send_args = (NBC_Args_send*)((char*)*schedule+size+sizeof(NBC_Fn_type));
|
||||
send_args->buf=buf;
|
||||
send_args->tmpbuf=tmpbuf;
|
||||
send_args->count=count;
|
||||
send_args->datatype=datatype;
|
||||
send_args->dest=dest;
|
||||
send_args.buf=buf;
|
||||
send_args.tmpbuf=tmpbuf;
|
||||
send_args.count=count;
|
||||
send_args.datatype=datatype;
|
||||
send_args.dest=dest;
|
||||
|
||||
/* increase number of elements in schedule */
|
||||
/* append to the round-schedule */
|
||||
ptr = (char*)*schedule + size;
|
||||
NBC_PUT_BYTES(ptr,type);
|
||||
NBC_PUT_BYTES(ptr,send_args);
|
||||
|
||||
/* increase number of elements in round-schedule */
|
||||
NBC_INC_NUM_ROUND(*schedule);
|
||||
NBC_DEBUG(10, "adding send - ends at byte %i\n", (int)(size+sizeof(NBC_Args_send)+sizeof(NBC_Fn_type)));
|
||||
NBC_DEBUG(10, "adding send - ends at byte %i\n", (int)(size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_send)));
|
||||
|
||||
/* increase size of schedule */
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Args_send)+sizeof(NBC_Fn_type));
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Fn_type)+sizeof(NBC_Args_send));
|
||||
|
||||
return NBC_OK;
|
||||
}
|
||||
@ -74,31 +84,34 @@ int NBC_Sched_send(void* buf, char tmpbuf, int count, MPI_Datatype datatype, int
|
||||
/* this function puts a receive into the schedule */
|
||||
int NBC_Sched_recv(void* buf, char tmpbuf, int count, MPI_Datatype datatype, int source, NBC_Schedule *schedule) {
|
||||
int size;
|
||||
NBC_Args_recv* recv_args;
|
||||
char* ptr;
|
||||
NBC_Fn_type type = RECV;
|
||||
NBC_Args_recv recv_args;
|
||||
|
||||
/* get size of actual schedule */
|
||||
NBC_GET_SIZE(*schedule, size);
|
||||
/*printf("schedule is %i bytes\n", size);*/
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Args_recv)+sizeof(NBC_Fn_type));
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_recv));
|
||||
if(*schedule == NULL) { printf("Error in realloc()\n"); return NBC_OOR; }
|
||||
|
||||
/* adjust the function type */
|
||||
*(NBC_Fn_type*)((char*)*schedule+size)=RECV;
|
||||
|
||||
/* store the passed arguments */
|
||||
recv_args=(NBC_Args_recv*)((char*)*schedule+size+sizeof(NBC_Fn_type));
|
||||
recv_args->buf=buf;
|
||||
recv_args->tmpbuf=tmpbuf;
|
||||
recv_args->count=count;
|
||||
recv_args->datatype=datatype;
|
||||
recv_args->source=source;
|
||||
recv_args.buf=buf;
|
||||
recv_args.tmpbuf=tmpbuf;
|
||||
recv_args.count=count;
|
||||
recv_args.datatype=datatype;
|
||||
recv_args.source=source;
|
||||
|
||||
/* increase number of elements in schedule */
|
||||
/* append to the round-schedule */
|
||||
ptr = (char*)*schedule + size;
|
||||
NBC_PUT_BYTES(ptr,type);
|
||||
NBC_PUT_BYTES(ptr,recv_args);
|
||||
|
||||
/* increase number of elements in round-schedule */
|
||||
NBC_INC_NUM_ROUND(*schedule);
|
||||
NBC_DEBUG(10, "adding receive - ends at byte %i\n", (int)(size+sizeof(NBC_Args_recv)+sizeof(NBC_Fn_type)));
|
||||
NBC_DEBUG(10, "adding receive - ends at byte %i\n", (int)(size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_recv)));
|
||||
|
||||
/* increase size of schedule */
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Args_recv)+sizeof(NBC_Fn_type));
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Fn_type)+sizeof(NBC_Args_recv));
|
||||
|
||||
return NBC_OK;
|
||||
}
|
||||
@ -106,35 +119,38 @@ int NBC_Sched_recv(void* buf, char tmpbuf, int count, MPI_Datatype datatype, int
|
||||
/* this function puts an operation into the schedule */
|
||||
int NBC_Sched_op(void *buf3, char tmpbuf3, void* buf1, char tmpbuf1, void* buf2, char tmpbuf2, int count, MPI_Datatype datatype, MPI_Op op, NBC_Schedule *schedule) {
|
||||
int size;
|
||||
NBC_Args_op* op_args;
|
||||
char* ptr;
|
||||
NBC_Fn_type type = OP;
|
||||
NBC_Args_op op_args;
|
||||
|
||||
/* get size of actual schedule */
|
||||
NBC_GET_SIZE(*schedule, size);
|
||||
/*printf("schedule is %i bytes\n", size);*/
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Args_op)+sizeof(NBC_Fn_type));
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_op));
|
||||
if(*schedule == NULL) { printf("Error in realloc()\n"); return NBC_OOR; }
|
||||
|
||||
/* adjust the function type */
|
||||
*(NBC_Fn_type*)((char*)*schedule+size)=OP;
|
||||
|
||||
/* store the passed arguments */
|
||||
op_args=(NBC_Args_op*)((char*)*schedule+size+sizeof(NBC_Fn_type));
|
||||
op_args->buf1=buf1;
|
||||
op_args->buf2=buf2;
|
||||
op_args->buf3=buf3;
|
||||
op_args->tmpbuf1=tmpbuf1;
|
||||
op_args->tmpbuf2=tmpbuf2;
|
||||
op_args->tmpbuf3=tmpbuf3;
|
||||
op_args->count=count;
|
||||
op_args->op=op;
|
||||
op_args->datatype=datatype;
|
||||
op_args.buf1=buf1;
|
||||
op_args.buf2=buf2;
|
||||
op_args.buf3=buf3;
|
||||
op_args.tmpbuf1=tmpbuf1;
|
||||
op_args.tmpbuf2=tmpbuf2;
|
||||
op_args.tmpbuf3=tmpbuf3;
|
||||
op_args.count=count;
|
||||
op_args.op=op;
|
||||
op_args.datatype=datatype;
|
||||
|
||||
/* increase number of elements in schedule */
|
||||
/* append to the round-schedule */
|
||||
ptr = (char*)*schedule + size;
|
||||
NBC_PUT_BYTES(ptr,type);
|
||||
NBC_PUT_BYTES(ptr,op_args);
|
||||
|
||||
/* increase number of elements in round-schedule */
|
||||
NBC_INC_NUM_ROUND(*schedule);
|
||||
NBC_DEBUG(10, "adding op - ends at byte %i\n", (int)(size+sizeof(NBC_Args_op)+sizeof(NBC_Fn_type)));
|
||||
NBC_DEBUG(10, "adding op - ends at byte %i\n", (int)(size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_op)));
|
||||
|
||||
/* increase size of schedule */
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Args_op)+sizeof(NBC_Fn_type));
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Fn_type)+sizeof(NBC_Args_op));
|
||||
|
||||
return NBC_OK;
|
||||
}
|
||||
@ -142,34 +158,37 @@ int NBC_Sched_op(void *buf3, char tmpbuf3, void* buf1, char tmpbuf1, void* buf2,
|
||||
/* this function puts a copy into the schedule */
|
||||
int NBC_Sched_copy(void *src, char tmpsrc, int srccount, MPI_Datatype srctype, void *tgt, char tmptgt, int tgtcount, MPI_Datatype tgttype, NBC_Schedule *schedule) {
|
||||
int size;
|
||||
NBC_Args_copy* copy_args;
|
||||
char* ptr;
|
||||
NBC_Fn_type type = COPY;
|
||||
NBC_Args_copy copy_args;
|
||||
|
||||
/* get size of actual schedule */
|
||||
NBC_GET_SIZE(*schedule, size);
|
||||
/*printf("schedule is %i bytes\n", size);*/
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Args_copy)+sizeof(NBC_Fn_type));
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_copy));
|
||||
if(*schedule == NULL) { printf("Error in realloc()\n"); return NBC_OOR; }
|
||||
|
||||
/* adjust the function type */
|
||||
*(NBC_Fn_type*)((char*)*schedule+size)=COPY;
|
||||
|
||||
/* store the passed arguments */
|
||||
copy_args = (NBC_Args_copy*)((char*)*schedule+size+sizeof(NBC_Fn_type));
|
||||
copy_args->src=src;
|
||||
copy_args->tmpsrc=tmpsrc;
|
||||
copy_args->srccount=srccount;
|
||||
copy_args->srctype=srctype;
|
||||
copy_args->tgt=tgt;
|
||||
copy_args->tmptgt=tmptgt;
|
||||
copy_args->tgtcount=tgtcount;
|
||||
copy_args->tgttype=tgttype;
|
||||
copy_args.src=src;
|
||||
copy_args.tmpsrc=tmpsrc;
|
||||
copy_args.srccount=srccount;
|
||||
copy_args.srctype=srctype;
|
||||
copy_args.tgt=tgt;
|
||||
copy_args.tmptgt=tmptgt;
|
||||
copy_args.tgtcount=tgtcount;
|
||||
copy_args.tgttype=tgttype;
|
||||
|
||||
/* increase number of elements in schedule */
|
||||
/* append to the round-schedule */
|
||||
ptr = (char*)*schedule + size;
|
||||
NBC_PUT_BYTES(ptr,type);
|
||||
NBC_PUT_BYTES(ptr,copy_args);
|
||||
|
||||
/* increase number of elements in round-schedule */
|
||||
NBC_INC_NUM_ROUND(*schedule);
|
||||
NBC_DEBUG(10, "adding copy - ends at byte %i\n", (int)(size+sizeof(NBC_Args_copy)+sizeof(NBC_Fn_type)));
|
||||
NBC_DEBUG(10, "adding copy - ends at byte %i\n", (int)(size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_copy)));
|
||||
|
||||
/* increase size of schedule */
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Args_copy)+sizeof(NBC_Fn_type));
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Fn_type)+sizeof(NBC_Args_copy));
|
||||
|
||||
return NBC_OK;
|
||||
}
|
||||
@ -177,39 +196,44 @@ int NBC_Sched_copy(void *src, char tmpsrc, int srccount, MPI_Datatype srctype, v
|
||||
/* this function puts a unpack into the schedule */
|
||||
int NBC_Sched_unpack(void *inbuf, char tmpinbuf, int count, MPI_Datatype datatype, void *outbuf, char tmpoutbuf, NBC_Schedule *schedule) {
|
||||
int size;
|
||||
NBC_Args_unpack* unpack_args;
|
||||
char* ptr;
|
||||
NBC_Fn_type type = UNPACK;
|
||||
NBC_Args_unpack unpack_args;
|
||||
|
||||
/* get size of actual schedule */
|
||||
NBC_GET_SIZE(*schedule, size);
|
||||
/*printf("schedule is %i bytes\n", size);*/
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Args_unpack)+sizeof(NBC_Fn_type));
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_unpack));
|
||||
if(*schedule == NULL) { printf("Error in realloc()\n"); return NBC_OOR; }
|
||||
|
||||
/* adjust the function type */
|
||||
*(NBC_Fn_type*)((char*)*schedule+size)=UNPACK;
|
||||
|
||||
/* store the passed arguments */
|
||||
unpack_args = (NBC_Args_unpack*)((char*)*schedule+size+sizeof(NBC_Fn_type));
|
||||
unpack_args->inbuf=inbuf;
|
||||
unpack_args->tmpinbuf=tmpinbuf;
|
||||
unpack_args->count=count;
|
||||
unpack_args->datatype=datatype;
|
||||
unpack_args->outbuf=outbuf;
|
||||
unpack_args->tmpoutbuf=tmpoutbuf;
|
||||
unpack_args.inbuf=inbuf;
|
||||
unpack_args.tmpinbuf=tmpinbuf;
|
||||
unpack_args.count=count;
|
||||
unpack_args.datatype=datatype;
|
||||
unpack_args.outbuf=outbuf;
|
||||
unpack_args.tmpoutbuf=tmpoutbuf;
|
||||
|
||||
/* increase number of elements in schedule */
|
||||
/* append to the round-schedule */
|
||||
ptr = (char*)*schedule + size;
|
||||
NBC_PUT_BYTES(ptr,type);
|
||||
NBC_PUT_BYTES(ptr,unpack_args);
|
||||
|
||||
/* increase number of elements in round-schedule */
|
||||
NBC_INC_NUM_ROUND(*schedule);
|
||||
NBC_DEBUG(10, "adding unpack - ends at byte %i\n", (int)(size+sizeof(NBC_Args_unpack)+sizeof(NBC_Fn_type)));
|
||||
NBC_DEBUG(10, "adding unpack - ends at byte %i\n", (int)(size+sizeof(NBC_Fn_type)+sizeof(NBC_Args_unpack)));
|
||||
|
||||
/* increase size of schedule */
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Args_unpack)+sizeof(NBC_Fn_type));
|
||||
NBC_INC_SIZE(*schedule, sizeof(NBC_Fn_type)+sizeof(NBC_Args_unpack));
|
||||
|
||||
return NBC_OK;
|
||||
}
|
||||
|
||||
/* this function ends a round of a schedule */
|
||||
int NBC_Sched_barrier(NBC_Schedule *schedule) {
|
||||
int size;
|
||||
int size, num = 0;
|
||||
char *ptr;
|
||||
char delimiter = 1;
|
||||
|
||||
/* get size of actual schedule */
|
||||
NBC_GET_SIZE(*schedule, size);
|
||||
@ -217,11 +241,10 @@ int NBC_Sched_barrier(NBC_Schedule *schedule) {
|
||||
*schedule = (NBC_Schedule)realloc(*schedule, size+sizeof(char)+sizeof(int));
|
||||
if(*schedule == NULL) { printf("Error in realloc()\n"); return NBC_OOR; }
|
||||
|
||||
/* add the barrier char (1) because another round follows */
|
||||
*(char*)((char*)*schedule+size)=1;
|
||||
ptr = (char*)*schedule + size;
|
||||
NBC_PUT_BYTES(ptr,delimiter); /* round-schedule delimiter */
|
||||
NBC_PUT_BYTES(ptr,num); /* initialize num=0 for next round-schedule */
|
||||
|
||||
/* set round count elements = 0 for new round */
|
||||
*(int*)((char*)*schedule+size+sizeof(char))=0;
|
||||
NBC_DEBUG(10, "ending round at byte %i\n", (int)(size+sizeof(char)+sizeof(int)));
|
||||
|
||||
/* increase size of schedule */
|
||||
@ -349,136 +372,137 @@ error:
|
||||
}
|
||||
|
||||
static inline int NBC_Start_round(NBC_Handle *handle) {
|
||||
int *numptr; /* number of operations */
|
||||
int num; /* number of operations */
|
||||
int i, res, ret=NBC_OK;
|
||||
NBC_Fn_type *typeptr;
|
||||
NBC_Args_send *sendargs;
|
||||
NBC_Args_recv *recvargs;
|
||||
NBC_Args_op *opargs;
|
||||
NBC_Args_copy *copyargs;
|
||||
NBC_Args_unpack *unpackargs;
|
||||
char* ptr;
|
||||
NBC_Fn_type type;
|
||||
NBC_Args_send sendargs;
|
||||
NBC_Args_recv recvargs;
|
||||
NBC_Args_op opargs;
|
||||
NBC_Args_copy copyargs;
|
||||
NBC_Args_unpack unpackargs;
|
||||
NBC_Schedule myschedule;
|
||||
void *buf1, *buf2, *buf3;
|
||||
|
||||
/* get schedule address */
|
||||
/* get round-schedule address */
|
||||
myschedule = (NBC_Schedule*)((char*)*handle->schedule + handle->row_offset);
|
||||
ptr = (char*) myschedule;
|
||||
|
||||
numptr = (int*)myschedule;
|
||||
NBC_DEBUG(10, "start_round round at address %p : posting %i operations\n", myschedule, *numptr);
|
||||
NBC_GET_BYTES(ptr,num);
|
||||
NBC_DEBUG(10, "start_round round at address %p : posting %i operations\n", myschedule, num);
|
||||
|
||||
/* typeptr is increased by sizeof(int) bytes to point to type */
|
||||
typeptr = (NBC_Fn_type*)(numptr+1);
|
||||
for (i=0; i<*numptr; i++) {
|
||||
/* go sizeof op-data forward */
|
||||
switch(*typeptr) {
|
||||
for (i=0; i<num; i++) {
|
||||
NBC_GET_BYTES(ptr,type);
|
||||
switch(type) {
|
||||
case SEND:
|
||||
NBC_DEBUG(5," SEND (offset %li) ", (long)typeptr-(long)myschedule);
|
||||
sendargs = (NBC_Args_send*)(typeptr+1);
|
||||
NBC_DEBUG(5,"*buf: %p, count: %i, type: %lu, dest: %i, tag: %i)\n", sendargs->buf, sendargs->count, (unsigned long)sendargs->datatype, sendargs->dest, handle->tag);
|
||||
typeptr = (NBC_Fn_type*)(((NBC_Args_send*)typeptr)+1);
|
||||
NBC_DEBUG(5," SEND (offset %li) ", (long)ptr-(long)myschedule);
|
||||
NBC_GET_BYTES(ptr,sendargs);
|
||||
NBC_DEBUG(5,"*buf: %p, count: %i, type: %lu, dest: %i, tag: %i)\n", sendargs.buf, sendargs.count, (unsigned long)sendargs.datatype, sendargs.dest, handle->tag);
|
||||
/* get an additional request */
|
||||
handle->req_count++;
|
||||
/* get buffer */
|
||||
if(sendargs->tmpbuf)
|
||||
buf1=(char*)handle->tmpbuf+(long)sendargs->buf;
|
||||
else
|
||||
buf1=sendargs->buf;
|
||||
if(sendargs.tmpbuf) {
|
||||
buf1=(char*)handle->tmpbuf+(long)sendargs.buf;
|
||||
} else {
|
||||
buf1=sendargs.buf;
|
||||
}
|
||||
#ifdef NBC_TIMING
|
||||
Isend_time -= MPI_Wtime();
|
||||
Isend_time -= MPI_Wtime();
|
||||
#endif
|
||||
handle->req_array = (MPI_Request*)realloc((void*)handle->req_array, (handle->req_count)*sizeof(MPI_Request));
|
||||
NBC_CHECK_NULL(handle->req_array);
|
||||
res = MCA_PML_CALL(isend(buf1, sendargs->count, sendargs->datatype, sendargs->dest, handle->tag, MCA_PML_BASE_SEND_STANDARD, handle->comm, handle->req_array+handle->req_count-1));
|
||||
if(OMPI_SUCCESS != res) { printf("Error in MPI_Isend(%lu, %i, %lu, %i, %i, %lu) (%i)\n", (unsigned long)buf1, sendargs->count, (unsigned long)sendargs->datatype, sendargs->dest, handle->tag, (unsigned long)handle->comm, res); ret=res; goto error; }
|
||||
res = MCA_PML_CALL(isend(buf1, sendargs.count, sendargs.datatype, sendargs.dest, handle->tag, MCA_PML_BASE_SEND_STANDARD, handle->comm, handle->req_array+handle->req_count-1));
|
||||
if(OMPI_SUCCESS != res) { printf("Error in MPI_Isend(%lu, %i, %lu, %i, %i, %lu) (%i)\n", (unsigned long)buf1, sendargs.count, (unsigned long)sendargs.datatype, sendargs.dest, handle->tag, (unsigned long)handle->comm, res); ret=res; goto error; }
|
||||
#ifdef NBC_TIMING
|
||||
Isend_time += MPI_Wtime();
|
||||
Isend_time += MPI_Wtime();
|
||||
#endif
|
||||
break;
|
||||
case RECV:
|
||||
NBC_DEBUG(5, " RECV (offset %li) ", (long)typeptr-(long)myschedule);
|
||||
recvargs = (NBC_Args_recv*)(typeptr+1);
|
||||
NBC_DEBUG(5, "*buf: %p, count: %i, type: %lu, source: %i, tag: %i)\n", recvargs->buf, recvargs->count, (unsigned long)recvargs->datatype, recvargs->source, handle->tag);
|
||||
typeptr = (NBC_Fn_type*)(((NBC_Args_recv*)typeptr)+1);
|
||||
NBC_DEBUG(5, " RECV (offset %li) ", (long)ptr-(long)myschedule);
|
||||
NBC_GET_BYTES(ptr,recvargs);
|
||||
NBC_DEBUG(5, "*buf: %p, count: %i, type: %lu, source: %i, tag: %i)\n", recvargs.buf, recvargs.count, (unsigned long)recvargs.datatype, recvargs.source, handle->tag);
|
||||
/* get an additional request - TODO: req_count NOT thread safe */
|
||||
handle->req_count++;
|
||||
/* get buffer */
|
||||
if(recvargs->tmpbuf) {
|
||||
buf1=(char*)handle->tmpbuf+(long)recvargs->buf;
|
||||
if(recvargs.tmpbuf) {
|
||||
buf1=(char*)handle->tmpbuf+(long)recvargs.buf;
|
||||
} else {
|
||||
buf1=recvargs->buf;
|
||||
buf1=recvargs.buf;
|
||||
}
|
||||
#ifdef NBC_TIMING
|
||||
Irecv_time -= MPI_Wtime();
|
||||
Irecv_time -= MPI_Wtime();
|
||||
#endif
|
||||
handle->req_array = (MPI_Request*)realloc((void*)handle->req_array, (handle->req_count)*sizeof(MPI_Request));
|
||||
NBC_CHECK_NULL(handle->req_array);
|
||||
res = MCA_PML_CALL(irecv(buf1, recvargs->count, recvargs->datatype, recvargs->source, handle->tag, handle->comm, handle->req_array+handle->req_count-1));
|
||||
if(OMPI_SUCCESS != res) { printf("Error in MPI_Irecv(%lu, %i, %lu, %i, %i, %lu) (%i)\n", (unsigned long)buf1, recvargs->count, (unsigned long)recvargs->datatype, recvargs->source, handle->tag, (unsigned long)handle->comm, res); ret=res; goto error; }
|
||||
res = MCA_PML_CALL(irecv(buf1, recvargs.count, recvargs.datatype, recvargs.source, handle->tag, handle->comm, handle->req_array+handle->req_count-1));
|
||||
if(OMPI_SUCCESS != res) { printf("Error in MPI_Irecv(%lu, %i, %lu, %i, %i, %lu) (%i)\n", (unsigned long)buf1, recvargs.count, (unsigned long)recvargs.datatype, recvargs.source, handle->tag, (unsigned long)handle->comm, res); ret=res; goto error; }
|
||||
#ifdef NBC_TIMING
|
||||
Irecv_time += MPI_Wtime();
|
||||
Irecv_time += MPI_Wtime();
|
||||
#endif
|
||||
break;
|
||||
case OP:
|
||||
NBC_DEBUG(5, " OP (offset %li) ", (long)typeptr-(long)myschedule);
|
||||
opargs = (NBC_Args_op*)(typeptr+1);
|
||||
NBC_DEBUG(5, "*buf1: %p, buf2: %p, count: %i, type: %lu)\n", opargs->buf1, opargs->buf2, opargs->count, (unsigned long)opargs->datatype);
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_op*)typeptr+1);
|
||||
NBC_DEBUG(5, " OP (offset %li) ", (long)ptr-(long)myschedule);
|
||||
NBC_GET_BYTES(ptr,opargs);
|
||||
NBC_DEBUG(5, "*buf1: %p, buf2: %p, count: %i, type: %lu)\n", opargs.buf1, opargs.buf2, opargs.count, (unsigned long)opargs.datatype);
|
||||
/* get buffers */
|
||||
if(opargs->tmpbuf1)
|
||||
buf1=(char*)handle->tmpbuf+(long)opargs->buf1;
|
||||
else
|
||||
buf1=opargs->buf1;
|
||||
if(opargs->tmpbuf2)
|
||||
buf2=(char*)handle->tmpbuf+(long)opargs->buf2;
|
||||
else
|
||||
buf2=opargs->buf2;
|
||||
if(opargs->tmpbuf3)
|
||||
buf3=(char*)handle->tmpbuf+(long)opargs->buf3;
|
||||
else
|
||||
buf3=opargs->buf3;
|
||||
ompi_3buff_op_reduce(opargs->op, buf1, buf2, buf3, opargs->count, opargs->datatype);
|
||||
if(opargs.tmpbuf1) {
|
||||
buf1=(char*)handle->tmpbuf+(long)opargs.buf1;
|
||||
} else {
|
||||
buf1=opargs.buf1;
|
||||
}
|
||||
if(opargs.tmpbuf2) {
|
||||
buf2=(char*)handle->tmpbuf+(long)opargs.buf2;
|
||||
} else {
|
||||
buf2=opargs.buf2;
|
||||
}
|
||||
if(opargs.tmpbuf3) {
|
||||
buf3=(char*)handle->tmpbuf+(long)opargs.buf3;
|
||||
} else {
|
||||
buf3=opargs.buf3;
|
||||
}
|
||||
ompi_3buff_op_reduce(opargs.op, buf1, buf2, buf3, opargs.count, opargs.datatype);
|
||||
break;
|
||||
case COPY:
|
||||
NBC_DEBUG(5, " COPY (offset %li) ", (long)typeptr-(long)myschedule);
|
||||
copyargs = (NBC_Args_copy*)(typeptr+1);
|
||||
NBC_DEBUG(5, "*src: %lu, srccount: %i, srctype: %lu, *tgt: %lu, tgtcount: %i, tgttype: %lu)\n", (unsigned long)copyargs->src, copyargs->srccount, (unsigned long)copyargs->srctype, (unsigned long)copyargs->tgt, copyargs->tgtcount, (unsigned long)copyargs->tgttype);
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_copy*)typeptr+1);
|
||||
NBC_DEBUG(5, " COPY (offset %li) ", (long)ptr-(long)myschedule);
|
||||
NBC_GET_BYTES(ptr,copyargs);
|
||||
NBC_DEBUG(5, "*src: %lu, srccount: %i, srctype: %lu, *tgt: %lu, tgtcount: %i, tgttype: %lu)\n", (unsigned long)copyargs.src, copyargs.srccount, (unsigned long)copyargs.srctype, (unsigned long)copyargs.tgt, copyargs.tgtcount, (unsigned long)copyargs.tgttype);
|
||||
/* get buffers */
|
||||
if(copyargs->tmpsrc)
|
||||
buf1=(char*)handle->tmpbuf+(long)copyargs->src;
|
||||
else
|
||||
buf1=copyargs->src;
|
||||
if(copyargs->tmptgt)
|
||||
buf2=(char*)handle->tmpbuf+(long)copyargs->tgt;
|
||||
else
|
||||
buf2=copyargs->tgt;
|
||||
res = NBC_Copy(buf1, copyargs->srccount, copyargs->srctype, buf2, copyargs->tgtcount, copyargs->tgttype, handle->comm);
|
||||
if(copyargs.tmpsrc) {
|
||||
buf1=(char*)handle->tmpbuf+(long)copyargs.src;
|
||||
} else {
|
||||
buf1=copyargs.src;
|
||||
}
|
||||
if(copyargs.tmptgt) {
|
||||
buf2=(char*)handle->tmpbuf+(long)copyargs.tgt;
|
||||
} else {
|
||||
buf2=copyargs.tgt;
|
||||
}
|
||||
res = NBC_Copy(buf1, copyargs.srccount, copyargs.srctype, buf2, copyargs.tgtcount, copyargs.tgttype, handle->comm);
|
||||
if(res != NBC_OK) { printf("NBC_Copy() failed (code: %i)\n", res); ret=res; goto error; }
|
||||
break;
|
||||
case UNPACK:
|
||||
NBC_DEBUG(5, " UNPACK (offset %li) ", (long)typeptr-(long)myschedule);
|
||||
unpackargs = (NBC_Args_unpack*)(typeptr+1);
|
||||
NBC_DEBUG(5, "*src: %lu, srccount: %i, srctype: %lu, *tgt: %lu\n", (unsigned long)unpackargs->inbuf, unpackargs->count, (unsigned long)unpackargs->datatype, (unsigned long)unpackargs->outbuf);
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_unpack*)typeptr+1);
|
||||
NBC_DEBUG(5, " UNPACK (offset %li) ", (long)ptr-(long)myschedule);
|
||||
NBC_GET_BYTES(ptr,unpackargs);
|
||||
NBC_DEBUG(5, "*src: %lu, srccount: %i, srctype: %lu, *tgt: %lu\n", (unsigned long)unpackargs.inbuf, unpackargs.count, (unsigned long)unpackargs.datatype, (unsigned long)unpackargs.outbuf);
|
||||
/* get buffers */
|
||||
if(unpackargs->tmpinbuf)
|
||||
buf1=(char*)handle->tmpbuf+(long)unpackargs->inbuf;
|
||||
else
|
||||
buf1=unpackargs->outbuf;
|
||||
if(unpackargs->tmpoutbuf)
|
||||
buf2=(char*)handle->tmpbuf+(long)unpackargs->outbuf;
|
||||
else
|
||||
buf2=unpackargs->outbuf;
|
||||
res = NBC_Unpack(buf1, unpackargs->count, unpackargs->datatype, buf2, handle->comm);
|
||||
if(unpackargs.tmpinbuf) {
|
||||
buf1=(char*)handle->tmpbuf+(long)unpackargs.inbuf;
|
||||
} else {
|
||||
buf1=unpackargs.outbuf;
|
||||
}
|
||||
if(unpackargs.tmpoutbuf) {
|
||||
buf2=(char*)handle->tmpbuf+(long)unpackargs.outbuf;
|
||||
} else {
|
||||
buf2=unpackargs.outbuf;
|
||||
}
|
||||
res = NBC_Unpack(buf1, unpackargs.count, unpackargs.datatype, buf2, handle->comm);
|
||||
if(res != NBC_OK) { printf("NBC_Unpack() failed (code: %i)\n", res); ret=res; goto error; }
|
||||
break;
|
||||
default:
|
||||
printf("NBC_Start_round: bad type %li at offset %li\n", (long)*typeptr, (long)typeptr-(long)myschedule);
|
||||
printf("NBC_Start_round: bad type %li at offset %li\n", (long)type, (long)ptr-(long)myschedule);
|
||||
ret=NBC_BAD_SCHED;
|
||||
goto error;
|
||||
}
|
||||
/* increase ptr by size of fn_type enum */
|
||||
typeptr = (NBC_Fn_type*)((NBC_Fn_type*)typeptr+1);
|
||||
}
|
||||
|
||||
/* check if we can make progress - not in the first round, this allows us to leave the
|
||||
|
@ -7,6 +7,8 @@
|
||||
*
|
||||
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
|
||||
*
|
||||
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef __NBC_INTERNAL_H__
|
||||
#define __NBC_INTERNAL_H__
|
||||
@ -135,7 +137,7 @@ int NBC_Sched_commit(NBC_Schedule *schedule);
|
||||
|
||||
#ifdef NBC_CACHE_SCHEDULE
|
||||
/* this is a dummy structure which is used to get the schedule out of
|
||||
* the collop sepcific structure. The schedule pointer HAS to be at the
|
||||
* the collop specific structure. The schedule pointer HAS to be at the
|
||||
* first position and should NOT BE REORDERED by the compiler (C
|
||||
* guarantees that */
|
||||
struct NBC_dummyarg {
|
||||
@ -254,52 +256,57 @@ int NBC_Create_fortran_handle(int *fhandle, NBC_Handle **handle);
|
||||
* [end] ::= 0 (char) - indicates that this is the last round
|
||||
*/
|
||||
|
||||
/*
|
||||
* The addresses of components of a round-schedule may be poorly aligned.
|
||||
* E.g., single-char delimiters can push addresses to odd-byte boundaries.
|
||||
* Or even ints can push 8-byte pointers to 4-byte boundaries.
|
||||
* So, for greater portability, we access components of a round-schedule with memcpy.
|
||||
*/
|
||||
#define NBC_GET_BYTES(ptr,x) {memcpy(&x,ptr,sizeof(x)); ptr += sizeof(x);}
|
||||
#define NBC_PUT_BYTES(ptr,x) {memcpy(ptr,&x,sizeof(x)); ptr += sizeof(x);}
|
||||
|
||||
/* NBC_GET_ROUND_SIZE returns the size in bytes of a round of a NBC_Schedule
|
||||
* schedule. A round has the format:
|
||||
* [num]{[type][type-args]}
|
||||
* e.g. [(int)2][(NBC_Fn_type)SEND][(NBC_Args_send)SEND-ARGS][(NBC_Fn_type)RECV][(NBC_Args_recv)RECV-ARGS] */
|
||||
#define NBC_GET_ROUND_SIZE(schedule, size) \
|
||||
{ \
|
||||
int *numptr; \
|
||||
NBC_Fn_type *typeptr; \
|
||||
int num; \
|
||||
char *p = (char*) schedule; \
|
||||
NBC_Fn_type type; \
|
||||
int i; \
|
||||
\
|
||||
numptr = (int*)schedule; \
|
||||
/*NBC_DEBUG(10, "GET_ROUND_SIZE got %i elements\n", *numptr); */\
|
||||
/* end is increased by sizeof(int) bytes to point to type */ \
|
||||
typeptr = (NBC_Fn_type*)((int*)(schedule)+1); \
|
||||
for (i=0; i<*numptr; i++) { \
|
||||
/* go sizeof op-data forward */ \
|
||||
switch(*typeptr) { \
|
||||
NBC_GET_BYTES(p,num); \
|
||||
/*NBC_DEBUG(10, "GET_ROUND_SIZE got %i elements\n", num); */\
|
||||
for (i=0; i<num; i++) { \
|
||||
NBC_GET_BYTES(p,type); \
|
||||
switch(type) { \
|
||||
case SEND: \
|
||||
/*printf("found a SEND at offset %i\n", (int)typeptr-(int)schedule); */\
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_send*)typeptr+1); \
|
||||
/*printf("found a SEND at offset %li\n", (long)p-(long)schedule); */\
|
||||
p += sizeof(NBC_Args_send); \
|
||||
break; \
|
||||
case RECV: \
|
||||
/*printf("found a RECV at offset %i\n", (int)typeptr-(int)schedule); */\
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_recv*)typeptr+1); \
|
||||
/*printf("found a RECV at offset %li\n", (long)p-(long)schedule); */\
|
||||
p += sizeof(NBC_Args_recv); \
|
||||
break; \
|
||||
case OP: \
|
||||
/*printf("found a OP at offset %i\n", (int)typeptr-(int)schedule); */\
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_op*)typeptr+1); \
|
||||
/*printf("found a OP at offset %li\n", (long)p-(long)schedule); */\
|
||||
p += sizeof(NBC_Args_op); \
|
||||
break; \
|
||||
case COPY: \
|
||||
/*printf("found a COPY at offset %i\n", (int)typeptr-(int)schedule); */\
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_copy*)typeptr+1); \
|
||||
/*printf("found a COPY at offset %li\n", (long)p-(long)schedule); */\
|
||||
p += sizeof(NBC_Args_copy); \
|
||||
break; \
|
||||
case UNPACK: \
|
||||
/*printf("found a UNPACK at offset %i\n", (int)typeptr-(int)schedule); */\
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_unpack*)typeptr+1); \
|
||||
/*printf("found a UNPACK at offset %li\n", (long)p-(long)schedule); */\
|
||||
p += sizeof(NBC_Args_unpack); \
|
||||
break; \
|
||||
default: \
|
||||
printf("NBC_GET_ROUND_SIZE: bad type %li at offset %li\n", (long)*typeptr, (long)typeptr-(long)schedule); \
|
||||
printf("NBC_GET_ROUND_SIZE: bad type %i at offset %li\n", type, (long)p-sizeof(type)-(long)schedule); \
|
||||
return NBC_BAD_SCHED; \
|
||||
} \
|
||||
/* increase ptr by size of fn_type enum */ \
|
||||
typeptr = (NBC_Fn_type*)((NBC_Fn_type*)typeptr+1); \
|
||||
} \
|
||||
/* this could be optimized if typeptr would be used directly */ \
|
||||
size = (long)typeptr-(long)schedule; \
|
||||
size = (long)p-(long)schedule; \
|
||||
}
|
||||
|
||||
/* returns the size of a schedule in bytes */
|
||||
@ -317,88 +324,79 @@ int NBC_Create_fortran_handle(int *fhandle, NBC_Handle **handle);
|
||||
/* increments the number of operations in the last round */
|
||||
#define NBC_INC_NUM_ROUND(schedule) \
|
||||
{ \
|
||||
int total_size; \
|
||||
int total_size, num_last_round; \
|
||||
long round_size; \
|
||||
char *ptr, *lastround; \
|
||||
\
|
||||
NBC_GET_SIZE(schedule, total_size); \
|
||||
\
|
||||
/* ptr begins at first round (first int is overall size) */ \
|
||||
ptr = (char*)((char*)schedule+sizeof(int)); \
|
||||
ptr = (char*)schedule+sizeof(int); \
|
||||
lastround = ptr; \
|
||||
while ((long)ptr-(long)schedule < total_size) { \
|
||||
NBC_GET_ROUND_SIZE(ptr, round_size); \
|
||||
/*printf("got round size %i\n", round_size);*/ \
|
||||
/*printf("got round_size %i\n", round_size);*/ \
|
||||
lastround = ptr; \
|
||||
/* add round size */ \
|
||||
ptr=ptr+round_size; \
|
||||
/* add sizeof(char) as barrier delimiter */ \
|
||||
ptr=ptr+sizeof(char); \
|
||||
/*printf("(int)ptr-(int)schedule=%i, size=%i\n", (int)ptr-(int)schedule, size); */\
|
||||
ptr += round_size; \
|
||||
ptr += sizeof(char); /* barrier delimiter */ \
|
||||
/*printf("(long)ptr-(long)schedule=%li, total_size=%i\n", (long)ptr-(long)schedule, total_size); */\
|
||||
} \
|
||||
/*printf("lastround count is at offset: %i\n", (int)lastround-(int)schedule);*/ \
|
||||
/* this is the count in the last round of the schedule */ \
|
||||
(*(int*)lastround)++; \
|
||||
/*printf("lastround count is at offset: %li\n", (long)lastround-(long)schedule);*/ \
|
||||
/* increment the count in the last round of the schedule */ \
|
||||
memcpy(&num_last_round, lastround, sizeof(int)); \
|
||||
num_last_round++; \
|
||||
memcpy(lastround, &num_last_round, sizeof(int)); \
|
||||
}
|
||||
|
||||
/* NBC_PRINT_ROUND prints a round in a schedule. A round has the format:
|
||||
* [num]{[op][op-data]} types: [int]{[enum][op-type]}
|
||||
* [num]{[type][type-args]} types: [int]{[enum][args-type]}
|
||||
* e.g. [2][SEND][SEND-ARGS][RECV][RECV-ARGS] */
|
||||
#define NBC_PRINT_ROUND(schedule) \
|
||||
{ \
|
||||
int myrank, *numptr; \
|
||||
NBC_Fn_type *typeptr; \
|
||||
NBC_Args_send *sendargs; \
|
||||
NBC_Args_recv *recvargs; \
|
||||
NBC_Args_op *opargs; \
|
||||
NBC_Args_copy *copyargs; \
|
||||
NBC_Args_unpack *unpackargs; \
|
||||
int i; \
|
||||
int myrank, i, num; \
|
||||
char *p = (char*) schedule; \
|
||||
NBC_Fn_type type; \
|
||||
NBC_Args_send sendargs; \
|
||||
NBC_Args_recv recvargs; \
|
||||
NBC_Args_op opargs; \
|
||||
NBC_Args_copy copyargs; \
|
||||
NBC_Args_unpack unpackargs; \
|
||||
\
|
||||
numptr = (int*)schedule; \
|
||||
NBC_GET_BYTES(p,num); \
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank); \
|
||||
printf("has %i actions: \n", *numptr); \
|
||||
/* end is increased by sizeof(int) bytes to point to type */ \
|
||||
typeptr = (NBC_Fn_type*)((int*)(schedule)+1); \
|
||||
for (i=0; i<*numptr; i++) { \
|
||||
/* go sizeof op-data forward */ \
|
||||
switch(*typeptr) { \
|
||||
printf("[%i] has %i actions: \n", myrank, num); \
|
||||
for (i=0; i<num; i++) { \
|
||||
NBC_GET_BYTES(p,type); \
|
||||
switch(type) { \
|
||||
case SEND: \
|
||||
printf("[%i] SEND (offset %li) ", myrank, (long)typeptr-(long)schedule); \
|
||||
sendargs = (NBC_Args_send*)(typeptr+1); \
|
||||
printf("*buf: %lu, count: %i, type: %lu, dest: %i)\n", (unsigned long)sendargs->buf, sendargs->count, (unsigned long)sendargs->datatype, sendargs->dest); \
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_send*)typeptr+1); \
|
||||
printf("[%i] SEND (offset %li) ", myrank, (long)p-(long)schedule); \
|
||||
NBC_GET_BYTES(p,sendargs); \
|
||||
printf("*buf: %lu, count: %i, type: %lu, dest: %i)\n", (unsigned long)sendargs.buf, sendargs.count, (unsigned long)sendargs.datatype, sendargs.dest); \
|
||||
break; \
|
||||
case RECV: \
|
||||
printf("[%i] RECV (offset %li) ", myrank, (long)typeptr-(long)schedule); \
|
||||
recvargs = (NBC_Args_recv*)(typeptr+1); \
|
||||
printf("*buf: %lu, count: %i, type: %lu, source: %i)\n", (unsigned long)recvargs->buf, recvargs->count, (unsigned long)recvargs->datatype, recvargs->source); \
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_recv*)typeptr+1); \
|
||||
printf("[%i] RECV (offset %li) ", myrank, (long)p-(long)schedule); \
|
||||
NBC_GET_BYTES(p,recvargs); \
|
||||
printf("*buf: %lu, count: %i, type: %lu, source: %i)\n", (unsigned long)recvargs.buf, recvargs.count, (unsigned long)recvargs.datatype, recvargs.source); \
|
||||
break; \
|
||||
case OP: \
|
||||
printf("[%i] OP (offset %li) ", myrank, (long)typeptr-(long)schedule); \
|
||||
opargs = (NBC_Args_op*)(typeptr+1); \
|
||||
printf("*buf1: %lu, buf2: %lu, count: %i, type: %lu)\n", (unsigned long)opargs->buf1, (unsigned long)opargs->buf2, opargs->count, (unsigned long)opargs->datatype); \
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_op*)typeptr+1); \
|
||||
printf("[%i] OP (offset %li) ", myrank, (long)p-(long)schedule); \
|
||||
NBC_GET_BYTES(p,opargs); \
|
||||
printf("*buf1: %lu, buf2: %lu, count: %i, type: %lu)\n", (unsigned long)opargs.buf1, (unsigned long)opargs.buf2, opargs.count, (unsigned long)opargs.datatype); \
|
||||
break; \
|
||||
case COPY: \
|
||||
printf("[%i] COPY (offset %li) ", myrank, (long)typeptr-(long)schedule); \
|
||||
copyargs = (NBC_Args_copy*)(typeptr+1); \
|
||||
printf("*src: %lu, srccount: %i, srctype: %lu, *tgt: %lu, tgtcount: %i, tgttype: %lu)\n", (unsigned long)copyargs->src, copyargs->srccount, (unsigned long)copyargs->srctype, (unsigned long)copyargs->tgt, copyargs->tgtcount, (unsigned long)copyargs->tgttype); \
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_copy*)typeptr+1); \
|
||||
printf("[%i] COPY (offset %li) ", myrank, (long)p-(long)schedule); \
|
||||
NBC_GET_BYTES(p,copyargs); \
|
||||
printf("*src: %lu, srccount: %i, srctype: %lu, *tgt: %lu, tgtcount: %i, tgttype: %lu)\n", (unsigned long)copyargs.src, copyargs.srccount, (unsigned long)copyargs.srctype, (unsigned long)copyargs.tgt, copyargs.tgtcount, (unsigned long)copyargs.tgttype); \
|
||||
break; \
|
||||
case UNPACK: \
|
||||
printf("[%i] UNPACK (offset %li) ", myrank, (long)typeptr-(long)schedule); \
|
||||
unpackargs = (NBC_Args_unpack*)(typeptr+1); \
|
||||
printf("*src: %lu, srccount: %i, srctype: %lu, *tgt: %lu\n",(unsigned long)unpackargs->inbuf, unpackargs->count, (unsigned long)unpackargs->datatype, (unsigned long)unpackargs->outbuf); \
|
||||
typeptr = (NBC_Fn_type*)((NBC_Args_unpack*)typeptr+1); \
|
||||
printf("[%i] UNPACK (offset %li) ", myrank, (long)p-(long)schedule); \
|
||||
NBC_GET_BYTES(p,unpackargs); \
|
||||
printf("*src: %lu, srccount: %i, srctype: %lu, *tgt: %lu\n",(unsigned long)unpackargs.inbuf, unpackargs.count, (unsigned long)unpackargs.datatype, (unsigned long)unpackargs.outbuf); \
|
||||
break; \
|
||||
default: \
|
||||
printf("[%i] NBC_PRINT_ROUND: bad type %li at offset %li\n", myrank, (long)*typeptr, (long)typeptr-(long)schedule); \
|
||||
printf("[%i] NBC_PRINT_ROUND: bad type %i at offset %li\n", myrank, type, (long)p-sizeof(type)-(long)schedule); \
|
||||
return NBC_BAD_SCHED; \
|
||||
} \
|
||||
/* increase ptr by size of fn_type enum */ \
|
||||
typeptr = (NBC_Fn_type*)((NBC_Fn_type*)typeptr+1); \
|
||||
} \
|
||||
printf("\n"); \
|
||||
}
|
||||
@ -414,15 +412,13 @@ int NBC_Create_fortran_handle(int *fhandle, NBC_Handle **handle);
|
||||
printf("[%i] printing schedule of size %i\n", myrank, size); \
|
||||
\
|
||||
/* ptr begins at first round (first int is overall size) */ \
|
||||
ptr = (char*)((char*)schedule+sizeof(int)); \
|
||||
ptr = (char*)schedule+sizeof(int); \
|
||||
while ((long)ptr-(long)schedule < size) { \
|
||||
NBC_GET_ROUND_SIZE(ptr, round_size); \
|
||||
printf("[%i] Round at byte %li (size %li) ", myrank, (long)ptr-(long)schedule, round_size); \
|
||||
NBC_PRINT_ROUND(ptr); \
|
||||
/* add round size */ \
|
||||
ptr=ptr+round_size; \
|
||||
/* add sizeof(char) as barrier delimiter */ \
|
||||
ptr=ptr+sizeof(char); \
|
||||
ptr += round_size; \
|
||||
ptr += sizeof(char); /* barrier delimiter */ \
|
||||
} \
|
||||
}
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user