Search code examples
moduleinstallationcodeblocksopenmpi

How to add OpenMPI to Codeblocks?


I am trying to use OpenMPI on Code:Blocks. I have only used it before on a remote server where i just had to bash load module ... and everything was fine. In code::blocks this seems to be a bit more involved, but i am sure quite easy. I am using a windows, however there are only linux files available on their website ? Any help is appreciated


Solution

  • Windows is no longer a supported platform for Open MPI (since 1.7 or so). However, MPI has a standard API and you don't need to develop your application with a specific MPI implementation. In Windows, you could just as well use Microsoft MPI, which is freely available (including SDK in a separate installer) from the Microsoft web.

    I assume that you are using C/C++, a GCC-based compiler and 64-bit aplications.

    All I needed to do to enable MPI in Code::Blocks was the following:

    1. In project build options, add "Search directories" / "Compiler":
      C:\Program Files (x86)\Microsoft SDKs\MPI\Include
      C:\Program Files (x86)\Microsoft SDKs\MPI\Include\x64
    2. Also, add "Linker settings" / "Link libraries":
      C:\Windows\System32\msmpi.dll

    When using the "Run" or "Build and Run" button in Code::Blocks, the application will be started in one process. If execution of multiple processes is desired as well, you will need to do that in a terminal outside of Code::Blocks by means of the program mpiexec.exe located in C:\Program Files\Microsoft MPI\Bin.