Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

msbuild

Adrian_F_1
Beginner
2,946 Views

I have traditionally done my solution builds at the command line using devenv.exe.  However this doesn't use all my cores.  I did a search online and saw that msbuild does just this and with /m:8 uses all of my 8 cores.  However it only builds the (C++) vcxproj projects in my solution not the vfproj ones.  Are Fortran projects not supported under msbuild?  If not how can I use all my 8 cores at the command line?  I can do this using the Visual Studio environment, so presumably I can at the command line.

0 Kudos
18 Replies
Steven_L_Intel1
Employee
2,946 Views

Fortran projects are not supported with msbuild.  Set the Fortran project property Fortran > General > Multiprocessor compilation, and it will use more of your cores. How many depends on the structure of your project.

0 Kudos
Adrian_F_1
Beginner
2,946 Views

But won't this just parallelize the compiling of the files in that project?  I have 30+ vfproj files which I want to build in parallel.

Further to the above statement, I checked another large solution I have for which the projects do build in parallel using all my cores (different machine).  So I went into the Fortran -> General section of those projects, but the line "Multi-processor Compilation" is not there!  So I don't how this solution parallelizes.

Update, I see the old solution has: Tools -> Options -> Projects and Solutions -> Build and Run -> maximum number of parallel project builds set to 8.  So I set this in the new solution.  This now does parallelize the build, but only from Visual Studio.  It is still built in serial using devenv at the command prompt.  The old solution does parallelize at the command prompt, just that I don't know how.

So I just want my new solution to do the same as my older solution.  Help!

0 Kudos
Steven_L_Intel1
Employee
2,946 Views

There are two parallel build settings. The one you mention builds whole projects in parallel, which is useful if your solution has many projects, and sounds like what you are interested in. The one I mentioned will compile multiple sources in parallel if there are no dependencies. Unlike C, where any source can be built in any order, Fortran applications that use modules have to be compiled so that a module is compiled before it is used.

What version is your Fortran where you don't find the Multi-processor Compilation option?

0 Kudos
Adrian_F_1
Beginner
2,946 Views

The version where I don't see that feature is 11.1.065.  The version where I do see that feature is Version 14.0.2.176 Build 20140130.  However it is the older version which does parallel building on the command line (I don't know how it knows to do this), but the newer version does not.  I want to get this newer version to do that.  To be specific I want projects to build in parallel at the command prompt just like it does in Visual Studio.

0 Kudos
Steven_L_Intel1
Employee
2,946 Views

11.1 doesn't have that parallel build option.

The projects-in-parallel build is a VS feature and is a user preference rather than a solution or project option, so I would expect that if you use devenv from the command line you should get it. I don't see any command line options to devenv that control this.

0 Kudos
Adrian_F_1
Beginner
2,946 Views

Your first paragraph: that is for parallel building within projects which is not what I want.  My 11.1 environment builds projects in parallel from both VS and the command line, which I'm happy with (as a side topic - how does it do this?).

So back to 14.0 which is where I have my question: You say "so I would expect that if you use devenv from the command line you should get it".  I don't see why you say this as devenv from the command line only looks at the SLN/VFPROJ files and this option is not in there as you state.  Anyway I don't get it from the command line.  Any idea of how I get it?

0 Kudos
Steven_L_Intel1
Employee
2,946 Views

VS looks at project dependencies and will spawn as many processes to do the project builds in parallel as you have configured. This is a per-user configuration and doesn't come from the .sln or .vfproj files.

The "build multiple sources in parallel" is the /MP option to the ifort command. It corresponds to the Multi-processor compilation option in the project. It may be that your project is structured in such a way that it can't build files in parallel due to module dependencies. Attach a zip of the buildlog.htm from one of these builds so that I can look at it.

0 Kudos
Adrian_F_1
Beginner
2,946 Views

I won't attach the buildlog.htm file since as I mentioned it does parallelize in VS (due to the Tools -> Options -> Build and Run -> maximum number of parallel project builds -> 8 setting.  My point is that it does not parallelize from the command prompt.  Here is the output from devenv.447847

0 Kudos
Steven_L_Intel1
Employee
2,946 Views

The buildlog.htm would show the use of the Multi-processor compilation option. Since you want the parallel build option, I took the NQueens sample from the product and built it from the command line. Here's what I got:

C:\Projects\NQueens>devenv nqueens.sln /build "Release|Win32"

Microsoft (R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: NQueens-Serial, Configuration: Release Win32 --
----
2>------ Build started: Project: NQueens-OpenMP, Configuration: Release Win32 --
----
3>------ Build started: Project: NQueens-BtTree, Configuration: Release Win32 --
----
3>Compiling with Intel(R) Visual Fortran Compiler XE 15.0.1.148 [IA-32]...
2>Compiling with Intel(R) Visual Fortran Compiler XE 15.0.1.148 [IA-32]...
1>Compiling with Intel(R) Visual Fortran Compiler XE 15.0.1.148 [IA-32]...
1>nq-serial.f90
3>nq-bttree.f90
2>nq-openmp.f90
3>Linking...
1>Linking...
2>Linking...
1>Embedding manifest...
2>Embedding manifest...
3>Embedding manifest...
2>
2>Build log written to  "file://C:\Projects\NQueens\NQueens-OpenMP\Release\Build
Log.htm"
2>NQueens-OpenMP - 0 error(s), 0 warning(s)
1>
3>
1>Build log written to  "file://C:\Projects\NQueens\NQueens-Serial\Release\Build
Log.htm"
3>Build log written to  "file://C:\Projects\NQueens\NQueens-BtTree\Release\Build
Log.htm"
3>NQueens-BtTree - 0 error(s), 0 warning(s)
1>NQueens-Serial - 0 error(s), 0 warning(s)
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

As you can see, it built all three projects in parallel. How sure are you that you have the parallel build option set to more than 1? If I set that to 1 then I get output similar to yours.

0 Kudos
Adrian_F_1
Beginner
2,946 Views

Again you're doing this from the GUI (Visual Studio).  I don't have a problem in VS.  It is from the command line.

0 Kudos
Steven_L_Intel1
Employee
2,946 Views

No, I'm not.  I did it from the command line.  By the way, are you sure you're using the same version of VS from the command line as you are in the GUI?

0 Kudos
Adrian_F_1
Beginner
2,946 Views

output from the command line, no parallelization

447854

0 Kudos
Steven_L_Intel1
Employee
2,946 Views

You didn't show me the command you used, though that should not matter. Now show me the output from doing it in the GUI.

0 Kudos
Adrian_F_1
Beginner
2,946 Views

I used these at the command line.

devenv AllTechDll.sln /clean "Debug"
devenv AllTechDll.sln /build "Debug"

Also I attach the GUI log.447905

 

0 Kudos
Steven_L_Intel1
Employee
2,946 Views

Which VS version are you using for the GUI?  What happens if you use "Debug|Win32" on the command line?

0 Kudos
Adrian_F_1
Beginner
2,946 Views

VS 2010 Premium

It makes no difference, all still runs in serial.

0 Kudos
Steven_L_Intel1
Employee
2,946 Views

I have no idea why there's a difference. It's not under our control. Can you try the experiment with the Nqueens sample from the Fortran install? Unzip it to a folder (not under Program Files). Then use the devenv command I showed above.

0 Kudos
Adrian_F_1
Beginner
2,946 Views

ok will do, thanks Steve

0 Kudos
Reply