Hi,
if I insert following lines somewhere openmpi, such as ompi/mpi/c/iscatter.c
printf(" --- in MPI_Iscatter\n");
//MPI_Datatype dt00 = (MPI_Datatype) MPI_INT;
*MPI_Datatype dt00 = (MPI_Datatype) -1;*
if(*!ompi_datatype_is_valid(dt00)* ) {
printf(" --- dt00 is NOT valid \n");
}
The attached test code will give the errors:
*** Process received signal ***
Signal: Segmentation fault (11)
Signal code: Address not mapped (1)
Failing at address: 0xf
[ 0] [0x3fff9d480478]
...
Is it a bug in the function *ompi_datatype_is_valid(..) *? or I miss
something?
Dahai
/* */
/* MPI_Scatter linkage: */
/* */
/* int MPI_Scatter ( const void *sendbuf, */
/* int sendcount, */
/* MPI_Datatype sendtype, */
/* void *recvbuf, */
/* const int recvcount, */
/* MPI_Datatype recvtype, */
/* int root, */
/* MPI_Comm comm ) */
/* */
/* */
/* MPI_Iscatter linkage: */
/* */
/* int MPI_Iscatter ( const void *sendbuf, */
/* int sendcount, */
/* MPI_Datatype sendtype, */
/* void *recvbuf, */
/* const int recvcount, */
/* MPI_Datatype recvtype, */
/* int root, */
/* MPI_Comm comm, */
/* MPI_Request *request) */
/* */
/************************************************************************/
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <values.h>
/*********************************************************************/
int main(int argc, char *argv[]) {
int cur_cntr_val;
int rc;
u_int i,j,k;
int numtask;
MPI_Datatype type;
long long send_buf[16384];
long long recv_buf[16384];
long long *send_buf_ignore=NULL;
long long *recv_buf_ignore=NULL;
long long *send_data_ptr;
int send_pid;
int errno;
MPI_Status status;
int root;
int send_count;
int save_ct;
int myrank;
MPI_Request scatter_request;
MPI_Status scatter_status;
rc=MPI_Init (&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numtask);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
root = 0;
if ( myrank == 0 ) {
fprintf(stdout,"numtask = %d\n",numtask);
fflush(stdout);
}
send_count = 2;
type = MPI_LONG_LONG;
send_buf[0] = 001;
send_buf[1] = 002;
send_buf[2] = 101;
send_buf[3] = 102;
if ( myrank == root ) {
fprintf(stdout,"\n\nDoing MPI_Scatter: \n");
fprintf(stdout,"[task 0] MPI_Scatter(send_buf,send_count,type,MPI_IN_PLACE,-1,(MPI_Datatype) -1,root,MPI_COMM_WORLD)\n");
fflush(stdout);
rc = MPI_Scatter( send_buf, send_count, type,
MPI_IN_PLACE, -1, (MPI_Datatype) -1, root, MPI_COMM_WORLD );
}
else {
// for non-root tasks, send count and sent type are ignored...
rc = MPI_Scatter( send_buf_ignore, -1, MPI_CHAR,
recv_buf, send_count, type, root, MPI_COMM_WORLD );
}
if ( myrank != root ) {
fprintf(stdout,"(Scatter) myrank = %d recv_buf = %lld %lld\n",
myrank,recv_buf[0],recv_buf[1]);
fprintf(stdout," values should be 101,102...\n\n");
fflush(stdout);
}
recv_buf[0] = -99;
recv_buf[1] = -99;
MPI_Barrier(MPI_COMM_WORLD);
// MPI_Finalize();
// exit(0);
if ( myrank == root ) {
fprintf(stdout,"\n\nDoing first MPI_Iscatter [no anticipated problem]: \n");
fprintf(stdout,"[task 0] MPI_Iscatter(send_buf,send_count,type,MPI_IN_PLACE,-1,MPI_CHAR, root,MPI_COMM_WORLD,&scatter_request)\n");
fflush(stdout);
rc = MPI_Iscatter( send_buf, send_count, type,
MPI_IN_PLACE, -1, MPI_CHAR , root, MPI_COMM_WORLD, &scatter_request );
}
else {
// for non-root tasks, send count and sent type are ignored...
rc = MPI_Iscatter( send_buf_ignore, -1, MPI_CHAR,
recv_buf, send_count, type, root, MPI_COMM_WORLD, &scatter_request );
}
MPI_Wait ( &scatter_request, &status );
if ( myrank != root ) {
fprintf(stdout,"(Iscatter #1) myrank = %d recv_buf = %lld %lld\n",
myrank,recv_buf[0],recv_buf[1]);
fprintf(stdout," values should be 101,102...\n\n");
fflush(stdout);
}
recv_buf[0] = -99;
recv_buf[1] = -99;
MPI_Barrier(MPI_COMM_WORLD);
if ( myrank == root ) {
fprintf(stdout,"\n\nDoing MPI_Iscatter [anticipated problem]: \n");
fprintf(stdout,"[task 0] MPI_Iscatter(send_buf,send_count,type,MPI_IN_PLACE,-1,(MPI_Datatype) -1,root,MPI_COMM_WORLD,&scatter_request)\n");
fflush(stdout);
rc = MPI_Iscatter( send_buf, send_count, type,
MPI_IN_PLACE, -1, (MPI_Datatype) -1, root, MPI_COMM_WORLD, &scatter_request );
}
else {
// for non-root tasks, send count and sent type are ignored...
rc = MPI_Iscatter( send_buf_ignore, -1, MPI_CHAR,
recv_buf, send_count, type, root, MPI_COMM_WORLD, &scatter_request );
}
MPI_Wait ( &scatter_request, &status );
if ( myrank != root ) {
fprintf(stdout,"(Iscatter #2) myrank = %d recv_buf = %lld %lld\n",
myrank,recv_buf[0],recv_buf[1]);
fprintf(stdout," values should be 101,102...\n\n");
fflush(stdout);
}
MPI_Barrier(MPI_COMM_WORLD);
fprintf(stdout,"About to finalize and exit\n");
fflush(stdout);
MPI_Finalize();
exit(0);
}
_______________________________________________
devel mailing list
[email protected]
https://rfd.newmexicoconsortium.org/mailman/listinfo/devel