You code looks pretty much fine to me. The only issue I see is that you should pass argc and argv to MPI_Init, not NULL. That probably isn't causing the issue though.

Which version of MPICH are you using (mpicc -v)?


On Fri, Aug 23, 2013 at 1:35 AM, urmila pol <urmilec@gmail.com> wrote:
Dear sir,

     I have attached all the files and my errors into errorfile please
guide me what happen
in that case. program is not working for multiple host.
my host file is mfile. code is hello2.c
waitibg for ur reply.

On 8/22/13, Wesley Bland <wbland@mcs.anl.gov> wrote:
> Edit:
>
> Can you attach you machine file and the *smallest amount of code that will
> reproduce the error*. It's tough to dig through huge amounts of someone
> else's code to find the error and while you're trying to reduce the amount
> of code, you often find the issue.
>
> Thanks,
> Wesley
>
>
> On Thu, Aug 22, 2013 at 3:46 AM, Mahesh Doijade
> <maheshdoijade@gmail.com>wrote:
>
>> Can you attached your machinefile, your code and detailed error output.
>>
>>
>> On Tue, Aug 20, 2013 at 4:11 PM, urmila pol <urmilec@gmail.com> wrote:
>>
>>> Dear sir,
>>>
>>> I was given following command it will give floating point error .
>>> #mpirun -f mfile -np 2  hello4
>>> Floating point exception
>>>
>>> if I give following it will execute for single node
>>>
>>> [root@masternode ~]# mpirun -np 2 hello4
>>> Hello world from processor masternode.csd.com, rank 0 out of 2
>>> processors
>>> Hello world from processor masternode.csd.com, rank 1 out of 2
>>> processors
>>> [root@masternode ~]#
>>>
>>> Please guide me for above error .waiting for ur reply.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 8/20/13, urmila pol <urmilec@gmail.com> wrote:
>>> > I do everything now i have one error flaoting point exception i am
>>> > running my program now
>>> > waiting for ur reply
>>>
>>> >
>>> > With regards,
>>> >
>>> > Dr.Urmila R. Pol
>>> > Assistant Professor,
>>> > Department of computer Science,
>>> > Shivaji University, Kolhapur.
>>> >
>>> >
>>> > On Tue, Aug 20, 2013 at 10:44 AM, Mahesh Doijade
>>> > <maheshdoijade@gmail.com>wrote:
>>>
>>> >
>>> >>
>>> >>      The issue seems to be that you have probably not created a
>>> >> machinefile which consists of node name to number of processes
>>> >> mapping
>>> >> and
>>> >> this file should be present in the same dir. of the other nodes on
>>> which
>>> >> you are launching other MPI processes, this is required in case you
>>> want
>>> >> to
>>> >> run the MPI program across the two or more nodes, you can find more
>>> >> details
>>> >> of the format in which this information has to be in the machinefile
>>> and
>>> >> the other requisite steps need for running your MPI program across
>>> >> multiple
>>> >> nodes from this link
>>> >> http://wiki.mpich.org/mpich/index.php/Using_the_Hydra_Process_Manager
>>> >>        Also, in order to launch the processes across multiple nodes
>>> >> you
>>> >> need to do ssh passwordless login among those nodes, in case you are
>>> >> using
>>> >> ssh as the connection mechanism, you can find more details about the
>>> >> procedure for ssh passwordless login over here
>>> >> http://www.techlitic.com/ssh-passwordless-login.html
>>> >>
>>> >>
>>> >> Regards,
>>> >> Mahesh Doijade,
>>> >> http://www.techdarting.com/
>>> >>
>>> >>
>>> >> On Tue, Aug 20, 2013 at 8:34 AM, Pavan Balaji <balaji@mcs.anl.gov>
>>> wrote:
>>> >>
>>> >>>
>>> >>> I'm pasting the error inline, for others' information.
>>> >>>
>>> >>> FYI, the error is "unable to open host file: machinefile".
>>> >>>
>>> >>> ----8<----
>>> >>> mpirun -f machinefile -n 2 /home/urp/mpich-install/hello
>>> >>> [mpiexec@masternode.csd.com] HYDU_parse_hostfile
>>> >>> (./utils/args/args.c:323): unable to open host file: machinefile
>>> >>> [mpiexec@masternode.csd.com] mfile_fn (./ui/mpich/utils.c:341):
>>> >>> error
>>> >>> parsing hostfile
>>> >>> [mpiexec@masternode.csd.com] match_arg (./utils/args/args.c:153):
>>> match
>>> >>> handler returned error
>>> >>> [mpiexec@masternode.csd.com] HYDU_parse_array
>>> (./utils/args/args.c:175):
>>> >>> argument matching returned error
>>> >>> [mpiexec@masternode.csd.com] parse_args (./ui/mpich/utils.c:1609):
>>> error
>>> >>> parsing input array
>>> >>> [mpiexec@masternode.csd.com] HYD_uii_mpx_get_parameters
>>> >>> (./ui/mpich/utils.c:1660): unable to parse user arguments
>>> >>> [mpiexec@masternode.csd.com] main (./ui/mpich/mpiexec.c:153): error
>>> >>> parsing parameters
>>> >>> [root@masternode ~]#
>>> >>> ----8<----
>>> >>>
>>> >>> On 08/19/2013 01:27 AM, urmila pol wrote:
>>> >>>
>>> >>>> Dear sir,
>>> >>>>
>>> >>>> I have attaching the screenshots of my errors please guide me
>>> .waiting
>>> >>>> for reply.
>>> >>>>
>>> >>>>
>>> >>>> With regards,
>>> >>>>
>>> >>>> Dr.Urmila R. Pol
>>> >>>> Assistant Professor,
>>> >>>> Department of computer Science,
>>> >>>> Shivaji University, Kolhapur.
>>> >>>>
>>> >>>>
>>> >>> --
>>> >>> Pavan Balaji
>>> >>> http://www.mcs.anl.gov/~balaji
>>> >>> ______________________________**_________________
>>>
>>> >>> discuss mailing list     discuss@mpich.org
>>> >>> To manage subscription options or unsubscribe:
>>> >>> https://lists.mpich.org/**mailman/listinfo/discuss<
>>> https://lists.mpich.org/mailman/listinfo/discuss>
>>> >>>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >
>>>
>>>
>>> --
>>>
>>> With regards,
>>>
>>> Dr.Urmila R. Pol
>>> Assistant Professor,
>>> Department of computer Science,
>>> Shivaji University, Kolhapur.
>>>
>>
>>
>>
>> --
>>
>> Regards,
>> -- Mahesh Doijade
>>
>>
>>
>>
>>
>> _______________________________________________
>> discuss mailing list     discuss@mpich.org
>> To manage subscription options or unsubscribe:
>> https://lists.mpich.org/mailman/listinfo/discuss
>>
>


--
With regards,

Dr.Urmila R. Pol
Assistant Professor,
Department of computer Science,
Shivaji University, Kolhapur.