Frage

I succeded, with some help, at compiling and running a MPI program from commandline on windows. Now I'm trying to compile this program with my IDE code::blocks and it fails.

Under Settings -> Compiler... -> Other Settings -> Advanced Options -> Command line macros I removed all the unnecessary flags and simly left:

$compiler $file

Settings -> Compiler... -> Toolchain executables I simly have the MPI wrapper mpicc.exe for C prgrams and mpic++.exe for C++.

When I now click on Build (Ctrl +F9) a small popup window opens stating:

cl.exe - application error

the error code is 0xc00000be

in the build log window of code::blocks I get:

mpicc.exe C:\Entwicklung\src\mpi_prime.c
Skipping linking (no linker program set): C:\Entwicklung\src\mpi_prime.exe
Process terminated with status -1073741634 (1 minutes, 37 seconds) 0 errors, 0 warnings (1 minutes, 37 seconds)

And here I'm stuck again, left with a few questions?

  1. should I keep the mpicc.exe wrapper?
  2. code::blocks tries always to invoke a linker etc. where can I turn that off?
  3. I wanted to change my compiler from cl to gcc from the start, should I try that first?

EDIT 1:

mpicc.exe /nologo /W3  /MD /Ox /DNDEBUG    /IC:\Entwicklung\CUDA\VS2012~1\VC\include /IC:\Entwicklung\CUDA\VS2012~1\VC\include  /c main.c /Foobj\Release\main.obj
link.exe /nologo /LIBPATH:C:\Entwicklung\CUDA\VS2012~1\VC\include /LIBPATH:C:\Entwicklung\CUDA\VS2012~1\VC\include  /out:bin\Release\mpi_test_projektarbeit.exe "..\..\..\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\Kernel32.Lib" msvcrt.lib msvcprt.lib "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\Kernel32.Lib"  obj\Release\main.obj   
Process terminated with status -1073741634 (0 minutes, 1 seconds)
0 errors, 0 warnings (0 minutes, 1 seconds)

I believe I did set up everything as it should be, however I still get the popup with the error code. I will fiddle with it. If nothing works, I'll try reinstalling code::blocks maybe this will help.

EDIT 2:

First, it's still not running. Second, I believe I have a much better understanding now whats going on and whats wrong.

By trying out diffrent things, I tried using cl.exe directly without the mpicc.exe wrapper. I chose Settings -> Compiler... -> Microsoft Visual C++ 2010, codeblocks was offering me. Trying to build project I received exactly the same error message (had to discipline my noScript to show me the message) as with mpicc.exe. mpicc.exe invokes cl.exe in its mpicc-wrapper-data.txt manifesto.

So with some google magic, I found at the codeblocks forum this page, where someone else had exactly the same error message. Their suggestion was to add the additional environment PATHs, which made me think. Before I ran mpicc from command line I had to run vcvarsall.bat first because I got an error that mspdb110.dll was missing. So I took a closer look at vcvarsall.bat which was invoking another batch-file vcvars32.bat. That file temporarily added PATH variables. So I added

C:\Entwicklung\CUDA\VS 2012\Common7\IDE\

permanently to my PATH, and mpicc.exe can be invoked without any missing DLL error message, but trying to compile, shows up with some linker error unable to find advapi32.lib. I will look into it deeper and as soon as it runs on commandline without the help of vcvars32.bat I'll try it from CB again. I hope this is causing all my problems.

There is still one other thing confusing me a little bit, nothing serious but when I uninstalled CB and installed it again, CB had may "new" mpi compiler setup somewhere saved. I checked my installation folder: all files were deleted after uninstalling it, so I also deleted the CB folder under USER\AppData\. However installing CB anew, the compiler settings where still present at CB startup, asking me if I wanted to import them?!?

War es hilfreich?

Lösung

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 link kernel32.lib, and for that you will need to an up-to-date Windows SDK, e.g. http://msdn.microsoft.com/en-US/windows/desktop/bg162891

  • In 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.
  • 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 the mpi 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 your CUDA 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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top