8

I am a computer science student and this season we have a course in MPI programming in C language. I don't have enough hard disk space to install visual studio on my computer and I have installed codeblocks, and MinGW as compiler, and I also installed Microsoft MPI to run mpi .exe code. Now I think that I need to install Open mpi to compile my code to exe and run it using MSMPI. Please correct me if I'm wrong until now :)

In OpenMPI download page we just have binary codes, and I don't know how to install binary code in windows...

Thanks all

techenthu
  • 158
  • 11
Hamid Haghdoost
  • 740
  • 1
  • 6
  • 15
  • I don't know if this will work for your circumstance, but to compile C code on Windows, I enabled the [Linux Subsystem for Ubuntu](https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/) which is available on Windows 10, then I installed [gcc](https://www.developerinsider.in/compile-c-program-with-gcc-compiler-on-bash-on-ubuntu-on-windows-10/) with `sudo apt-get install gcc` which allows for compiling code via the Linux Subsystem. This let me avoid having to deal with things like CodeBlocks and MinGW entirely. – Davy M Jan 10 '18 at 18:28
  • If you use the Linux Subsystem for Ubuntu on Windows 10, then [this Stack Overflow question](https://stackoverflow.com/questions/38786014/how-to-compile-executable-for-windows-with-gcc-with-linux-subsystem) shows how to compile C code as `.exe` files for windows, which may work for what you desire, though I am not completely sure if it will work for all the `mpi` programming you want to do. – Davy M Jan 10 '18 at 18:29
  • @DavyM I already have gcc and I can run regular `c` programs by it, but I need mpicc to compile a mpi code... – Hamid Haghdoost Jan 10 '18 at 18:42
  • Since you are learning the C language, I recommend staying away from C++. They are two distinct languages. For example, C++ has `std::string` which can dynamically grow. The C language uses fixed length character arrays, which must be compared using `strcmp`. Please adjust your tags. – Thomas Matthews Jan 10 '18 at 20:49

1 Answers1

4

If you plan to build your code with Open MPI and then run it with Microsoft MPI, then just drop that idea ! MPI is standard in a sense that a code can be built with any MPI implementation. There is no guarantee a binary can be ran with any MPI implementation.

Open MPI is not supported under windows, but you can use cygwin and install the openmpi packages. Linux subsystem for Ubuntu is an option i never tried but that might work too.

Gilles Gouaillardet
  • 8,193
  • 11
  • 24
  • 30