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})