Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] avoid usage of ssh on local machine
From: Sun, Yongqi (E F ES EN 72) (yongqi.sun_at_[hidden])
Date: 2008-11-17 07:04:03


Hello,

The OMPI is trying to launch 192.168.160.1, which is not in my ifconfig.
The contents of ifconfig and /etc/hosts are attached.
What should I do now?
 
To Jody: The gethostname() is actually called by OMPI routine. I just
tested it to see whether any error is there. Now it seems that the host
name is correctly set to my computer name. Thank you for your answer.

Best wishes

Sun

-----Original Message-----
From: users-bounces_at_[hidden] [mailto:users-bounces_at_[hidden]] On
Behalf Of jody
Sent: Montag, 17. November 2008 10:50
To: Open MPI Users
Subject: Re: [OMPI users] avoid usage of ssh on local machine

Hi Sun
i forgot to add that once you've called gethostname(), you can
determine the length of the name by using strlen() on your array
'name'.

Jody

On Mon, Nov 17, 2008 at 10:45 AM, jody <jody.xha_at_[hidden]> wrote:
> Hi Sun
>
> AFAIK, the second parameter (len) in gethostname is an input
> parameter, specifying the length of the array your passing
> as the first parameter. The name of the host will be placed in the
> array, but it will truncated after len characters.
>
> I don't know how to determine the length of the host name, but i think
> on most systems it must be less than 255.
>
>
> Jody
>
>
> On Mon, Nov 17, 2008 at 10:31 AM, Sun, Yongqi (E F ES EN 72)
> <yongqi.sun_at_[hidden]> wrote:
>> Hello,
>>
>> I still have no clue how to use the local machine by default.
>>
>> My /etc/hosts file and the result of ifconfig are attached.
>>
>> I've tried gethostname() by myself but an abnormal result generated.
>>
>> My code is:
>>
>> ///////////////////////////////////
>> #include <unistd.h>
>> #include <stdio.h>
>> int main() {
>> char name[20]; // a guess of the array size
>> size_t len;
>> int res;
>> res = gethostname(name, len);
>> printf("res = %d, name = %s, len = %lu", res, name, len); //
on
>> my 64-bit machine, size_t is long unsigned, or?
>> return 0;
>> }
>> /////////////////////////////////
>>
>> And the resulting output is:
>> "res = 0, name = W71c-140644, len = 140737469359496"
>> Where len is abnormally large.
>>
>>
>> Best regards
>>
>> Sun
>>
>> _______________________________________________
>> users mailing list
>> users_at_[hidden]
>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>>
>
_______________________________________________
users mailing list
users_at_[hidden]
http://www.open-mpi.org/mailman/listinfo.cgi/users



  • application/octet-stream attachment: hosts.out