mpi p2p send receive communication between c and c++ codes -
does 1 need special when communicating between 2 code parts/function sources written in different languages (c , c++)?
i have injected c++ code send used parallel slave tasks different ranks:
if (rank != 0) { const long bufferlength = 1000000; char filename[300]; double array[bufferlength*4]; mpi_send(filename, 300, mpi_char, 0, rank, mpi_comm_world); mpi_send(array, bufferlength*4, mpi_double, 0, rank, mpi_comm_world); }
in c source corresponding receive placed , called master 0 process only, many times slave tasks exist (here num_process
):
if (rank==0) { typedef struct array_s { char filename[300];//text file name identifier double *t;//time buffer double *x;//x coordinate buffer double *y;//y coordinate buffer double *z;//z coordinate buffer } arraystruc; arraystruc arraybuffer; double array[bufferlength*4]; for(i=1;i<num_process;i++) { mpi_recv(arraybuffer.filename, 300, mpi_char, i, mpi_any_tag, mpi_comm_world,&status); mpi_recv(array, bufferlength*4, mpi_double, i, mpi_any_tag, mpi_comm_world,&status); } }
the character array arriving correctly, unfortunatly array buffer not arriving @ master correctly. empty.
Comments
Post a Comment