2

I am trying to learn MPI and running into slow performance using MPI on Windows on my laptop (i5-4260U and 4 GB of RAM). I have installed Cygwin and the appropriate libraries for MPI. I am also using CLion and set up MPI using this guide.

I have successfully built the code on CLion as well as compiling it on MPICC. However, when I use MPI Run, the program takes a very long time to run. When I run the program normally without using mpirun, it runs just fine. Even when I specify only 1 process, the program still takes over a minute to print out "Hello World".

Is my laptop the reason for the slow performance or have I not setup MPI correctly to get optimal performance? Thanks!

Code:

/*Simple MPI Hello World Program*/
#include <stdio.h>
#include <mpi.h>

int main(int argc, char **argv)
{
    int node;

    MPI_Init(&argc,&argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &node);

    printf("Hello World from Node %d\n",node);

    MPI_Finalize();
}

CMake:

cmake_minimum_required(VERSION 3.8)
project(MPI_Example)

set(CMAKE_C_STANDARD 99)

set(SOURCE_FILES main.c)
add_executable(MPI_Example ${SOURCE_FILES})

# Require MPI for this project:
find_package(MPI REQUIRED)
set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS})
include_directories(${MPI_INCLUDE_PATH})
target_link_libraries(MPI_Example ${MPI_LIBRARIES})
Zulan
  • 21,896
  • 6
  • 49
  • 109
VectorConvoy
  • 187
  • 1
  • 4
  • 14
  • Definately not your programe or build options. Not normal. Probably [cygwin](https://stackoverflow.com/questions/11032161/why-is-cygwin-so-slow) but hard to tell. – Zulan Nov 14 '17 at 23:14
  • @Zulan That is probably it. Unfortunately, I don't know how to configure MinGW with MPICH2 on CLion so I am most likely stuck with this for the time being. Thanks for the help! – VectorConvoy Nov 15 '17 at 01:15
  • if a firewall is running, start by disabling it. then make sure all your interfaces get resolved (e.g. all IP has hostname and the other way around) – Gilles Gouaillardet Nov 15 '17 at 02:00
  • Is ditching cygwin an option for you? I believe there are native implementations of MPI for Windows. – Zulan Nov 15 '17 at 08:30
  • @Zulan I do have a old laptop that has Ubuntu on it. I plan to try using that since the slow performance will hinder me. – VectorConvoy Nov 15 '17 at 13:15

2 Answers2

1

The most likely issue is a network/virtual interface timeout. Try disabling WIFI network or VPN interface as test.

For reference of expected timing for MPI hello you can see

https://cygwin.com/ml/cygwin/2016-12/msg00192.html

matzeri
  • 8,062
  • 2
  • 15
  • 16
  • You mean disabling Wi-Fi on my laptop? If so, I did that and I ran into the following error: `[[24995,1],0] tcp_peer_send_blocking: send() to socket 12 failed: Transport endpoint is not connected (128).` This did occur almost immediately as I ran the program. – VectorConvoy Nov 15 '17 at 13:13
  • Figured it out. Disabling my Wi-Fi network as well as my Bluetooth network did the trick. The program runs as fast as it should now. Thank you for the help! – VectorConvoy Nov 15 '17 at 13:25
  • May be it is only the Bluetooth – matzeri Nov 15 '17 at 13:27
  • It seems to be both the Bluetooth Network Connection 2 and Wireless Network Connection adapters. Disabling just the Bluetooth still resulted in long run times but disabling both did the trick. I am not running any VPN or virtual networks. Thanks again for the solution! – VectorConvoy Nov 15 '17 at 18:24
1

1. Open the Cygwin terminal.

mpicc --version

mpirun --version

If not execute, follow the document below.Document

2. Try turning off Bluetooth and test the operation speed.

3. Try closing the Wifi and test the operation speed (you can connect to the wired internete)

4. Open C:\Windows\System32\drivers\etc\hosts add line

127.0.0.1 localhost cygdrive wpad

and test the operation speed.

5. If you have a virtual network like VirtualBox or similar, turn off the control panel and test the operation speed.

6. If possible, uninstall VirtualBox completely. Restart your computer and test the operation speed.

7. Try turning off the Windows Firewall and test the operating speed.

The above steps solved both the "tcp_peer_send_blocking: send () to socket 12 failed: transport endpoint is not connected" error and the slowness problem for Windows 10 - Cygwin.