This will get you as far as building a 32-bit "Hello world" console project
in Code::Blocks (12.11, at least) using the OpenMPI windows C compiler wrapper mpicc.exe
, with the MS Visual Studio 10 toolchain (or later) installed:
I presume:
Code::Blocks has detected the MS VC++10 compiler and it is listed as an available compiler in Settings -> Compiler under the drop-down menu Selected Compiler
You have configured a new compiler, let's say, mpi, for the MPI wrapper, and that is the one in which you have changed the advanced compiler settings and other things.
You have OpenMPI installed in
C:\Program Files (x86)\OpenMPI_v1.6.2-win32
Then:
For a native
win32
build you will need to linkkernel32.lib
, and for that you will need to an up-to-date Windows SDK, e.g. http://msdn.microsoft.com/en-US/windows/desktop/bg162891In the Code::Blocks IDE, Navigate Settings -> Compiler. Select mpi and delete that compiler. (We'll start again)
From the drop-down menu select Microsoft Visual Studio 2010; click Copy and call the new compiler again mpi.
In the tab-menu, tab to Toolchain executables and set:
- Compiler's installation directory =
<empty>
- C compiler = "C:\Program Files (x86)\OpenMPI_v1.6.2-win32\bin\mpicc.exe"
- C++ compiler = "C:\Program Files (x86)\OpenMPI_v1.6.2-win32\bin\mpicc.exe"
- Leave the other settings in Toolchain executables as they are and OK.
- Compiler's installation directory =
The compiler will need access to Standard C Library headers (at least) and will need space-free (DOS) search pathnames. So now tab to Search Directories -> Compiler, where you will see
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
.Select this path; click Edit and replace it with the DOS version of same,
C:\PROGRA~2\MICROS~1.0\VC\include
.OK out of Compiler settings.
Next set up the project.
Navigate File -> New -> Project. Click the Console Application icon
Click through the wizard:
Set language = C
Choose a project name and location
Set Compiler = mpi
Finish
Code::Blocks will then pop up a warning saying Can't find compiler executable in your configured search paths for mpi (and will do likewise whenever your visit the project's build options). This is a false alarm.
Locate
kernel32.lib
under your SDK installation and get its pathname, say:"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\kernel32.lib"
Navigate Settings -> Project -> Build options and select Compiler = mpi
In the tab-menu, tab to Linker settings
Click Add beneath the Link libraries list. Add the full, quoted pathname you have noted for
kernel32.lib
and OK out of Build options.Build the project. A successful build log should look like:
-------------- Build: Debug in mpi_test (compiler: mpi)--------------- "C:\Program Files (x86)\OpenMPI_v1.6.2-win32\bin\mpicc.exe" /nologo /W3 /MDd /Zi /D_DEBUG /IC:\PROGRA~2\MICROS~1.0\VC\include /c main.c /Foobj\Debug\main.obj main.c link.exe /nologo /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib" /out:bin\Debug\mpi_test.exe msvcrtd.lib msvcprtd.lib "C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\kernel32.lib" obj\Debug\main.obj /DEBUG LINK : bin\Debug\mpi_test.exe not found or not built by the last incremental link; performing full link Output size is 17.50 KB Process terminated with status 0 (0 minutes, 0 seconds) 0 errors, 0 warnings (0 minutes, 0 seconds)
From there you can move on to some real MPI project, for which of course you will need to configure additional search directories and linkage options.
UPDATE 1:
Some problems I see with your latest failing build log:
The compiler is being invoked as
mpicc.exe
, but per my answer it should be invoked by its full pathname, e.g."C:\Program Files (x86)\OpenMPI_v1.6.2-win32\bin\mpicc.exe"
. Can you attach a screenshot of the toolchain executables tab?The compiler option
/IC:\Entwicklung\CUDA\VS2012~1\VC\include
appears twice. This suggests you have configured this option globally for thempi
compiler and also for the project. Just configure it for the project.The linker option
/LIBPATH:C:\Entwicklung\CUDA\VS2012~1\VC\include
also appears twice, probably for the same reason. But/LIBPATH:
should point to a directory containing library binaries (.lib
) and you are pointing it at the same place as yourCUDA
header files -/IC:\Entwicklung\CUDA\VS2012~1\VC\include
The
kernel32.lib
is in the linkage twice, first with a relative path"..\..\..\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\Kernel32.Lib"
, which may be invalid, and later with the absolute path"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\Kernel32.Lib"
. Again this probably results from combining redundant or incorrect global compiler configuration with project configuration.
Would urge you to get the mpi compiler working for the default "Hello World" console app by the steps I've given then move up to an elementary MPI app and get it working, confining the additional configuration that you will require to the project rather than the compiler