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 04:31:41


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




  • application/octet-stream attachment: hosts.out