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.


/* #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);
}
--
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 via email to