public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Marco Atzeri <marco.atzeri@gmail.com>
To: cygwin@cygwin.com
Subject: Re: OpenMPI Problem
Date: Mon, 19 Dec 2016 09:58:00 -0000	[thread overview]
Message-ID: <53c8b252-6e7c-bdbf-3712-a4aea3b0885d@gmail.com> (raw)
In-Reply-To: <b0c5ec41-ff71-72bc-3912-6b43e39fb57f@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]

On 19/12/2016 07:58, Marco Atzeri wrote:
> On 18/12/2016 15:55, Bahadır Öncel wrote:
>> Hello all!
>> I've installed cygwin and openmpi successfully. I can compile and run
>> mpi programs. Twist is, even the openmpi test program hello_c.c approx
>> takes a minute to run. When I try in my virtual machine (linux) the
>> same program takes less than a second to run.
>> I've found that other users asked the same question but did not find
>> any solution.
>> Thanks in advance.
>>
>> --
>
> the most likely issue is a network interface timeout.
> Try disabling WIFI network or VPN interface as test.
>
> Regards
> Marco
>

Hi Bahadır,
this is the normal behaviour of the hello_c run on my machine.

$ time mpirun -n 2 ./hello_c.exe
Hello, world, I am 0 of 2, (Open MPI v1.10.4, package: Open MPI , ident: 
1.10.4, repo rev: v1.10.3-45-gaafbd34, Sep 01, 2016, 129)
Hello, world, I am 1 of 2, (Open MPI v1.10.4, package: Open MPI , ident: 
1.10.4, repo rev: v1.10.3-45-gaafbd34, Sep 01, 2016, 129)

real    0m3.428s
user    0m1.293s
sys     0m2.930s

The timing should be in the second range.


Attached a program that will allow you to identify all the
network interfaces as seen by Cygwin with their Windows name.

$ gcc -o get-interface get-interface.c

$ ./get-interface
internal_name:  {EC2ABB5C-42A8-431D-A133-8F4BE0F309AF}
  flags:         AF_INET6 up multicast
  address:       fe80::a479:1393:b7d0:fb25%18
  friendly_name: Local Area Connection 2

internal_name:  {EC2ABB5C-42A8-431D-A133-8F4BE0F309AF}
  flags:         AF_INET  up broadcast multicast
  address:       169.254.251.37
  friendly_name: Local Area Connection 2
...and so on.



[-- Attachment #2: get-interface.c --]
[-- Type: text/plain, Size: 2969 bytes --]

/* #define _GNU_SOURCE  * To get defns of NI_MAXSERV and NI_MAXHOST */
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#include <ifaddrs.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <net/if.h>


void print_flags(unsigned int flags)
{
        const char* sep = "", *sp = " ";
        if (flags & IFF_UP) {
                printf("%sup", sep);
                sep = sp;
        }
        if (flags & IFF_BROADCAST) {
                printf("%sbroadcast", sep);
                sep = sp;
        }
        if (flags & IFF_LOOPBACK) {
                printf("%sloopback", sep);
                sep = sp;
        }
        if (flags & IFF_NOTRAILERS) {
                printf("%snotrailers", sep);
                sep = sp;
        }
        if (flags & IFF_RUNNING) {
                printf("%srunning", sep);
                sep = sp;
        }
        if (flags & IFF_PROMISC) {
                printf("%spromisc", sep);
                sep = sp;
        }
        if (flags & IFF_MULTICAST) {
                printf("%smulticast", sep);
                sep = sp;
        }
}

int main(int argc, char *argv[])
{
    struct ifaddrs *ifaddr, *ifa;
    int family, s, n;
    char host[NI_MAXHOST];

    struct ifreq ifr;
    struct ifreq_frndlyname iff;
    struct ifreq_frndlyname * iffp;
    
    struct ifaddrs_hwdata * ifhwdata;

    if (getifaddrs(&ifaddr) == -1) {
        perror("getifaddrs");
        exit(EXIT_FAILURE);
    }

    /* Walk through linked list, maintaining head pointer so we
       can free list later */

    for (ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++) {
        if (ifa->ifa_addr == NULL)
            continue;

        family = ifa->ifa_addr->sa_family;

        /* Display interface name and family (including symbolic
           form of the latter for the common families) */

        printf("internal_name: \t%s\n",ifa->ifa_name);

	printf(" flags: \t%s ",
               (family == AF_INET) ? "AF_INET " :
               (family == AF_INET6) ? "AF_INET6" : "unknown ");

        print_flags(ifa->ifa_flags);
	printf("\n");

        /* For an AF_INET* interface address, display the address */

        if (family == AF_INET || family == AF_INET6) {
            s = getnameinfo(ifa->ifa_addr,
                    (family == AF_INET) ? sizeof(struct sockaddr_in) :
                                          sizeof(struct sockaddr_in6),
                    host, NI_MAXHOST,
                    NULL, 0, NI_NUMERICHOST);
            if (s != 0) {
                printf("getnameinfo() failed: %s\n", gai_strerror(s));
                exit(EXIT_FAILURE);
            }

            printf(" address:\t%s\n", host);
            ifhwdata=ifa->ifa_data;
            iffp=&(ifhwdata->ifa_frndlyname);
            printf(" friendly_name:\t%s\n\n", iffp->ifrf_friendlyname);

        }
    }

    freeifaddrs(ifaddr);
    exit(EXIT_SUCCESS);
}

[-- Attachment #3: Type: text/plain, Size: 219 bytes --]


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

      reply	other threads:[~2016-12-19  9:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-18 14:56 Bahadır Öncel
2016-12-18 17:52 ` cyg Simple
2016-12-19  6:58 ` Marco Atzeri
2016-12-19  9:58   ` Marco Atzeri [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53c8b252-6e7c-bdbf-3712-a4aea3b0885d@gmail.com \
    --to=marco.atzeri@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).