[mpich-discuss] Error while using MPI platform with CPP program

Kenneth Raffenetti raffenet at mcs.anl.gov
Thu May 21 08:25:21 CDT 2015


Hi,

Please do not use this list for general programming questions. Either 
take this discussion offline, or move it to a more appropriate forum. 
This list is for questions about MPICH.

Thanks,
Ken

On 05/21/2015 06:54 AM, Umesh Shisode wrote:
> Hello Antoine Rougier,
>
> I did not understand,   [You have to change your code if you want to
> keep using blocking communication.]    you ask me about. Also now the
> code is working fine, but it is only for same process and same numbers
> of rows. For other cases it is giving me error (segmentation fault).
> Please check it, I am attaching here the tar file of compile code. But
> it is working for only following commands
>
>  >> mpic++ main.cpp -o result
>  >> mpirun -np 4 result
>
> But for this case input matrix is (4 X 4) only.
>
> If you find any mistake please let me know.
>
>
>
> Regards,
>
> Umesh Sharad Shisode,
> M.Tech in Modeling and Simulation(2013-15),
> Centre for Modeling and Simulation,
> University of Pune.
>
> On Wed, May 20, 2015 at 11:29 PM, Antoine Rougier
> <rougier at par.tuwien.ac.at <mailto:rougier at par.tuwien.ac.at>> wrote:
>
>     First, as far as I understand, the broadcast should not be between
>     blocking send on a process and blocking recv on the others. You have to
>     change your code if you want to keep using blocking communication.
>
>     Then, by running (with the previous modifications), I have got:
>     Fatal error in MPI_Recv: Invalid buffer pointer, error stack:
>     MPI_Recv(187): MPI_Recv(buf=(nil), count=8, MPI_DOUBLE, src=0, tag=3,
>     MPI_COMM_WORLD, status=0x7fffbc4e02d0) failed
>     MPI_Recv(126): Null buffer pointer
>
>     It is probably an issue on your side, such as bad index.
>
>     Antoine Rougier
>
>     On 05/20/2015 05:17 PM, Umesh Shisode wrote:
>      > Hello Antoine Rougier,
>      >
>      > Thanks for your reply. Now I have code which can broadcast vector
>     as well
>      > as Matrix object (Attached here). But it is giving error when I
>     tried to
>      > send and receive part of matrix object it is giving me error.
>     Thanks again
>      > for your time. Please help me out. As it is not giving me correct
>     answer. I
>      > am waiting for your reply.
>      > Sorry for your inconvenience.
>      >
>      > I have attached here new code. It compiles when I want to
>     broadcast. But
>      > giving error for send and receive. I also attached error in png file.
>      >
>      > Regards,
>      >
>      > Umesh Sharad Shisode,
>      > M.Tech in Modeling and Simulation(2013-15),
>      > Centre for Modeling and Simulation,
>      > University of Pune.
>      >
>      > On Wed, May 20, 2015 at 4:07 PM, Antoine Rougier
>     <rougier at par.tuwien.ac.at <mailto:rougier at par.tuwien.ac.at>>
>      > wrote:
>      >
>      >> Hello,
>      >>
>      >> I think your issue comes from b.vect=NULL (according to the used
>      >> constructor) which is not a checked value in T
>     Vector<T>::get(int i). By
>      >> the way Ncol is no initialized before using it in MPI_Bcast.
>      >>
>      >> best regards,
>      >>
>      >> Antoine Rougier
>      >>
>      >>
>      >> On 05/20/2015 11:55 AM, Umesh Shisode wrote:
>      >>> Hello Junchao,
>      >>>
>      >>> I initialize vector b, but even then it is not working for
>     broadcasting.
>      >> It
>      >>> gives same error. As the vector class is user defined and also
>     I use
>      >>> dynamic memory allocation. This may be the reason for failing.
>     If you
>      >> know
>      >>> about it then please tell.
>      >>> I am here attaching the zip file which contains only the vector
>     class and
>      >>> main file as well as error I am facing. Please have a look at
>     it. Thanks
>      >>> for your time. I am waiting for your reply.
>      >>>
>      >>>
>      >>> Regards,
>      >>>
>      >>> Umesh Sharad Shisode,
>      >>> M.Tech in Modeling and Simulation(2013-15),
>      >>> Centre for Modeling and Simulation,
>      >>> University of Pune.
>      >>>
>      >>> On Tue, May 19, 2015 at 10:57 PM, Junchao Zhang
>     <jczhang at mcs.anl.gov <mailto:jczhang at mcs.anl.gov>>
>      >> wrote:
>      >>>
>      >>>> Your code "MPI_Bcast(&b(0), b.get_row(), MPI_DOUBLE, 1,
>     MPI_COMM_WORLD)"
>      >>>>  is OK.  You can find manual of MPI_Bcast at
>      >>>> http://mpi.deino.net/mpi_functions/MPI_Bcast.html
>      >>>> Don't forget to initialize the vector b, in other words,
>     allocate memory
>      >>>> for it, on ALL ranks.
>      >>>>
>      >>>>
>      >>>> --Junchao Zhang
>      >>>>
>      >>>> On Tue, May 19, 2015 at 9:27 AM, Umesh Shisode
>     <ushisode1 at gmail.com <mailto:ushisode1 at gmail.com>>
>      >>>> wrote:
>      >>>>
>      >>>>> Hi Junchao,
>      >>>>>
>      >>>>> I sort out the problem for MPI_Send() and MPI_Recv(), as I
>     requested in
>      >>>>> last mail. Now I have one more difficulty which is how can I
>     broadcast
>      >>>>> class object using MPI_Bcast() function. In my case, class is
>     Vector
>      >> (you
>      >>>>> can check it at vect_fun.h header file). I want to broadcast
>     it to all
>      >>>>> processes. I have used dynamic memory allocation in the code.
>     Please
>      >> help
>      >>>>> me to solved the issue. I am waiting for your reply. Thanks.
>      >>>>>
>      >>>>>
>      >>>>> Regards,
>      >>>>>
>      >>>>> Umesh Sharad Shisode,
>      >>>>> M.Tech in Modeling and Simulation(2013-15),
>      >>>>> Centre for Modeling and Simulation,
>      >>>>> University of Pune.
>      >>>>>
>      >>>>> On Tue, May 19, 2015 at 7:51 AM, Umesh Shisode
>     <ushisode1 at gmail.com <mailto:ushisode1 at gmail.com>>
>      >>>>> wrote:
>      >>>>>
>      >>>>>> Sorry Junchao,
>      >>>>>>
>      >>>>>> Thanks for your reply. But my problem is with MPICH only. My
>     question
>      >> is
>      >>>>>> how to send part of class object (in my case matrix object)
>     from one
>      >>>>>> process to another process using MPI_Send and receive using
>     MPI_Recv
>      >>>>>> functions. I tried a lot of way but couldn't do it. I hope
>     you will
>      >> help
>      >>>>>> me. Thanks in advance. I have write a function to get the
>     pointer
>      >> address
>      >>>>>> for first parameter of MPI_Send() function. Waiting for your
>     reply.
>      >>>>>>
>      >>>>>> Regards,
>      >>>>>>
>      >>>>>> Umesh Sharad Shisode,
>      >>>>>> M.Tech in Modeling and Simulation(2013-15),
>      >>>>>> Centre for Modeling and Simulation,
>      >>>>>> University of Pune.
>      >>>>>>
>      >>>>>> On Mon, May 18, 2015 at 7:31 PM, Junchao Zhang
>     <jczhang at mcs.anl.gov <mailto:jczhang at mcs.anl.gov>>
>      >>>>>> wrote:
>      >>>>>>
>      >>>>>>> Could not reproduce it with the latest MPICH.  If the
>     problem is not
>      >>>>>>> specific to MPICH, you'd better move your question to other
>     forums
>      >> like
>      >>>>>>> stackoverflow.
>      >>>>>>>
>      >>>>>>> $mpirun -n 2 ./test
>      >>>>>>> Matrix A :
>      >>>>>>>
>      >>>>>>> 1 2 3 4
>      >>>>>>> 1 2 3 4
>      >>>>>>> 1 2 3 4
>      >>>>>>> 1 2 3 4
>      >>>>>>>
>      >>>>>>> Vector b before broadcast:
>      >>>>>>>  1.000000,  2.000000,  3.000000,  4.000000
>      >>>>>>> Matrix A column : 4
>      >>>>>>> after sending:  lLim = 2 uLim = 4  for rank : 1
>      >>>>>>> count = 8
>      >>>>>>>
>      >>>>>>> Matrix A column : 0for rank = 1
>      >>>>>>> after receive:  lLim = 2 uLim = 4  for rank : 1
>      >>>>>>> Ncol after broadcasting = 4
>      >>>>>>>
>      >>>>>>>
>      >>>>>>> --Junchao Zhang
>      >>>>>>>
>      >>>>>>> On Mon, May 18, 2015 at 6:33 AM, Umesh Shisode
>     <ushisode1 at gmail.com <mailto:ushisode1 at gmail.com>>
>      >>>>>>> wrote:
>      >>>>>>>
>      >>>>>>>> Hello Sir / Madam,
>      >>>>>>>>
>      >>>>>>>> This is Umesh Sharad Shisode, pursuing Masters in Modeling and
>      >>>>>>>> Simulation, at Centre for Modeling and Simulation, Pune
>     University.
>      >> I am in
>      >>>>>>>> the final stage of my course. My Masters Thesis title is :
>      >>>>>>>>
>      >>>>>>>>     Development of Conjugate Gradient solver in OpenFOAM /
>     CPP using
>      >>>>>>>> MPI
>      >>>>>>>>
>      >>>>>>>> I am now doing MPI part of my project and facing some
>     problems with
>      >>>>>>>> MPI functions syntax. I am trying to use CPP class object
>     with MPI
>      >>>>>>>> functions but it is giving some error. Which I don't
>     understand.
>      >>>>>>>>
>      >>>>>>>> Operating system         : LINUX
>      >>>>>>>> Programming Language : CPP
>      >>>>>>>>
>      >>>>>>>> Commands I am using are :
>      >>>>>>>>
>      >>>>>>>>        > mpic++ main.cpp -o result
>      >>>>>>>>        > mpirun -np 2 result
>      >>>>>>>>
>      >>>>>>>> Please help me to sort out this issue . I am attaching
>     herewith zip
>      >>>>>>>> file containing the code which I want to parallelize with
>     the png
>      >> file
>      >>>>>>>> containing error. Waiting for your reply. Thanks in advance.
>      >>>>>>>>
>      >>>>>>>> Regards,
>      >>>>>>>>
>      >>>>>>>> Umesh Sharad Shisode,
>      >>>>>>>> M.Tech in Modeling and Simulation(2013-15),
>      >>>>>>>> Centre for Modeling and Simulation,
>      >>>>>>>> University of Pune.
>      >>>>>>>>
>      >>>>>>>>
>      >>>>>>>> _______________________________________________
>      >>>>>>>> discuss mailing list discuss at mpich.org
>     <mailto:discuss at mpich.org>
>      >>>>>>>> To manage subscription options or unsubscribe:
>      >>>>>>>> https://lists.mpich.org/mailman/listinfo/discuss
>      >>>>>>>>
>      >>>>>>>
>      >>>>>>>
>      >>>>>>> _______________________________________________
>      >>>>>>> discuss mailing list discuss at mpich.org
>     <mailto:discuss at mpich.org>
>      >>>>>>> To manage subscription options or unsubscribe:
>      >>>>>>> https://lists.mpich.org/mailman/listinfo/discuss
>      >>>>>>>
>      >>>>>>
>      >>>>>>
>      >>>>>
>      >>>>> _______________________________________________
>      >>>>> discuss mailing list discuss at mpich.org <mailto:discuss at mpich.org>
>      >>>>> To manage subscription options or unsubscribe:
>      >>>>> https://lists.mpich.org/mailman/listinfo/discuss
>      >>>>>
>      >>>>
>      >>>>
>      >>>> _______________________________________________
>      >>>> discuss mailing list discuss at mpich.org <mailto:discuss at mpich.org>
>      >>>> To manage subscription options or unsubscribe:
>      >>>> https://lists.mpich.org/mailman/listinfo/discuss
>      >>>>
>      >>>
>      >>>
>      >>>
>      >>> _______________________________________________
>      >>> discuss mailing list discuss at mpich.org <mailto:discuss at mpich.org>
>      >>> To manage subscription options or unsubscribe:
>      >>> https://lists.mpich.org/mailman/listinfo/discuss
>      >>>
>      >>
>      >>
>      >> _______________________________________________
>      >> discuss mailing list discuss at mpich.org <mailto:discuss at mpich.org>
>      >> To manage subscription options or unsubscribe:
>      >> https://lists.mpich.org/mailman/listinfo/discuss
>      >>
>      >
>      >
>      >
>      > _______________________________________________
>      > discuss mailing list discuss at mpich.org <mailto:discuss at mpich.org>
>      > To manage subscription options or unsubscribe:
>      > https://lists.mpich.org/mailman/listinfo/discuss
>      >
>
>
>     _______________________________________________
>     discuss mailing list discuss at mpich.org <mailto:discuss at mpich.org>
>     To manage subscription options or unsubscribe:
>     https://lists.mpich.org/mailman/listinfo/discuss
>
>
>
>
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
>
_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list