I am broadcasting a pointer to an array
MPI_Bcast(&xd_sim_send, Nooflines_Sim, MPI_FLOAT, root, MPI_COMM_WORLD);
from process 0 and receiving this broadcast from processes other than 0
MPI_Bcast(&xd_sim_recv, Nooflines_Sim, MPI_FLOAT, root, MPI_COMM_WORLD);
I get segmentation fault 11 when I try to read the received value.
Like this
for(i=0; i<Numlines_Sim; i++)
printf("%f\n",xd_sim_recv[i]);fflush(stdout);
What is wrong here, Could you please help me fix it?
If you want to receive the data in a vector other than the one used by root process, then you should do something like this (pseudocode):
without the
&, because the variablesxd_sim_sendxd_sim_recvare already pointers, that is whatMPI_Bcastneeds.