[mpich-discuss] Error while using MPI platform with CPP program
Junchao Zhang
jczhang at mcs.anl.gov
Tue May 19 12:27:57 CDT 2015
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> 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>
> 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>
>> 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>
>>> 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
>>>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20150519/d94ba2e2/attachment.html>
-------------- next part --------------
_______________________________________________
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