-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix broken test #25
fix broken test #25
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix and the new tests!
I'm approving but it would be really nice to clean up the code a bit before merging.
recv.c
Outdated
@@ -12,7 +12,8 @@ | |||
|
|||
static int mpi_match_send(void *r, void *tag) | |||
{ | |||
return( *((int *)tag) == MPI_ANY_TAG || | |||
// printf("mpi_match_send %d %d\n",*(int *)tag, ((Req *) r)->tag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can (and should IMHO) be removed.
send.c
Outdated
@@ -11,7 +11,8 @@ | |||
|
|||
static int mpi_match_recv(void *r, void *tag) | |||
{ | |||
return( ((Req *)r)->tag == MPI_ANY_TAG || | |||
// printf("mpi_match_recv %d %d\n",*((int *) tag), ((Req *)r)->tag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can (and should IMHO) be removed.
send.c
Outdated
if (( match=AP_list_search_func(mycomm->recvlist,mpi_match_recv,&tag))) | ||
{ | ||
rreq=(Req *)AP_listitem_data(match); | ||
AP_list_delete_item(mycomm->recvlist,match); | ||
|
||
// memcpy(rreq->buf,buf,count * datatype); | ||
copy_data2(buf, count, datatype, rreq->buf, count, datatype); | ||
// printf("calling copy datatype %d %d %d %d\n",(int) datatype, count, rreq->type, rreq->count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove all debugging print statements.
type.c
Outdated
|
||
|
||
/* | ||
int MPI_Type_get_envelope(MPI_Datatype type, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner) | ||
{ | ||
*num_integers = | ||
|
||
} | ||
|
||
*/ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed for anything? If not, please remove.
type.c
Outdated
printf("<"); | ||
count = array_of_ints[0]; | ||
for (i = 0; i < count; i++) { // count | ||
blocklength = array_of_ints[i + 1]; // array of blocklength | ||
tmpPrevExtent = prevExtentTot; | ||
tmpPrevExtent += array_of_adds[i]; // + displacement in byte | ||
printf( "BL : %d - ", blocklength); | ||
for (j = 0; j < blocklength; j++) { | ||
tmpPrevExtent = printdatatype( array_of_dtypes[0], tmpPrevExtent); | ||
printf(", "); | ||
tmpPrevExtent += subExtent; | ||
} | ||
} | ||
printf(">, "); | ||
|
||
prevExtentTot = tmpPrevExtent; | ||
|
||
break; | ||
} | ||
case MPI_COMBINER_INDEXED_BLOCK:{ | ||
MPI_Aint tmpPrevExtent; | ||
int count; | ||
MPI_Type_get_contents( datatype, num_ints, num_adds, num_dtypes, array_of_ints, array_of_adds, array_of_dtypes ); | ||
|
||
MPI_Type_extent(array_of_dtypes[0], &subExtent); // no need to do in loop because same type | ||
|
||
printf("<"); | ||
count = array_of_ints[0]; | ||
for (i = 0; i < count; i++) { // count | ||
tmpPrevExtent = prevExtentTot; | ||
tmpPrevExtent += array_of_ints[i + 2] * subExtent; // + displacement * size of block | ||
printf( "BL : %d - ", array_of_ints[i + 1]); | ||
for (j = 0; j < array_of_ints[1]; j++) { // blocklength | ||
tmpPrevExtent = printdatatype( array_of_dtypes[0], tmpPrevExtent); | ||
printf(", "); | ||
tmpPrevExtent += subExtent; | ||
} | ||
} | ||
printf(">, "); | ||
|
||
prevExtentTot = tmpPrevExtent; | ||
|
||
break; | ||
} | ||
case MPI_COMBINER_STRUCT: | ||
case MPI_COMBINER_STRUCT_INTEGER:{ | ||
MPI_Aint tmpPrevExtent; | ||
MPI_Type_get_contents( datatype, num_ints, num_adds, num_dtypes, array_of_ints, array_of_adds, array_of_dtypes ); | ||
|
||
printf( "{"); | ||
for (i = 0; i < array_of_ints[0]; i++) { // count | ||
tmpPrevExtent = prevExtentTot + array_of_adds[i]; // origin + displacement | ||
printf( "BL : %d - ", array_of_ints[i + 1]); | ||
tmpPrevExtent = printdatatype( array_of_dtypes[i], tmpPrevExtent); | ||
tmpPrevExtent += subExtent; | ||
printf(", "); | ||
} | ||
printf("}, "); | ||
|
||
prevExtentTot = tmpPrevExtent; | ||
|
||
break; | ||
} | ||
case MPI_COMBINER_SUBARRAY: | ||
// I don't know what is interresting to display here... | ||
printf("... subarray not handled ..."); | ||
break; | ||
case MPI_COMBINER_DARRAY: | ||
// Same | ||
printf("... darray not handled ..."); | ||
break; | ||
case MPI_COMBINER_RESIZED: | ||
MPI_Type_get_contents( datatype, num_ints, num_adds, num_dtypes, array_of_ints, array_of_adds, array_of_dtypes ); | ||
|
||
prevExtentTot = printdatatype( array_of_dtypes[0], prevExtentTot); | ||
|
||
printf(", \n"); | ||
|
||
break; | ||
default: | ||
printf( "Unrecognized combiner type\n" ); | ||
} | ||
|
||
free( array_of_ints ); | ||
free( array_of_adds ); | ||
free( array_of_dtypes ); | ||
|
||
return prevExtentTot; | ||
} | ||
|
||
void printMapDatatype(MPI_Datatype datatype) { | ||
MPI_Aint lb, ub; | ||
MPI_Type_lb(datatype, &lb); | ||
MPI_Type_ub(datatype, &ub); | ||
|
||
printf("\"(LB, %ld), ", lb); | ||
printdatatype(datatype, 0); | ||
printf("(UB, %ld)\"\n", ub); | ||
} | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this commented out code is confusing. Either remove it or maybe bracket it with something like #ifdef DEBUG_PRINT
.
Fixes issue #11
The issue was that the recv datatype sent to the irecv call was ignored by the copy data called in the send call. In order to fix this I added datatype and count to the Req structure so that they can be used in the send.