HP-MPI Version 2.0 for Windows Release Note
2. Submit a script. Verify MPI_ROOT is set in the environment (See the mpirun manpage for
more information):
C:\> job add 4288 /numprocessors:1 /env:MPI_ROOT="%MPI_ROOT%" /exclusive:true
/stdout:\\node\path\to\a\shared\file.out /stderr:\\node\path\to\a\shared\file.err path\submission_script.vbs
Where submission_script.vbs contains code such as:
Option Explicit
Dim sh, oJob, JobNewOut, appfile, Rsrc, I, fs
Set sh = WScript.CreateObject(“WScript.Shell”)
Set fs = CreateObject(“Scripting.FileSystemObject”)
Set oJob = sh.exec(“%MPI_ROOT%\bin\mpi_nodes.exe”)
JobNewOut = oJob.StdOut.Readall
Set appfile = fs.CreateTextFile(“<path>\appfile”, True)
Rsrc = Split(JobNewOut, “ “)
For I = LBound(Rsrc) + 1 to UBound(Rsrc) Step 2
appfile.WriteLine(“-h” + Rsrc(I) + “-np” + Rsrc(I+1) + _
“ ““<path>\foo.exe”” “)
Next
appfile.Close
Set oJob = sh.exec(“““%MPI_ROOT%\bin\mpirun.exe”” -TCP -f _
““<path>\appfile”” “)
wscript.Echo oJob.StdOut.Readall
3. Submit the job as in the previous example:
C:\> job submit /id:4288
The above example using submission_script.vbs is only an example. Other scripting
languages can be used to convert the output ofmpi_nodes.exe into an appropriate appfile.
9.4 Building an MPI Application with Visual Studio and Using the Property
Pages
To build an MPI application in C or C++ with VS2008, use the property pages provided by HP-MPI
to help link applications.
Two pages are included with HP-MPI, and are located at the installation location in %MPI_ROOT%\
help\HPMPI.vsprops and %MPI_ROOT%\help\HPMPI64.vsprops.
Go to VS Project→View→Property Manager and expand the project. This displays the different
configurations and platforms set up for builds. Include the appropriate property page
(HPMPI.vsprops for 32-bit applications, HPMPI64.vsprops for 64-bit applications) in
Configuration→Platform.
Select this page by either double-clicking the page or by right-clicking on the page and selecting
Properties. Go to the User Macros section. Set MPI_ROOT to the desired location (for example,
the installation location of HP-MPI). This should be set to the default installation location:
%ProgramFiles (x86)%\Hewlett-Packard\HP-MPI
NOTE: This is the default location on 64-bit machines. The location for 32-bit machines is
%ProgramFiles%\Hewlett-Packard\HP-MPI
The MPI application can now be built with HP-MPI.
The property page sets the following fields automatically, but can also be set manually if the
property page provided is not used:
9.4 Building an MPI Application with Visual Studio and Using the Property Pages 41