HP-MPI User's Guide (11th Edition)
Getting started
Getting started using Windows
Chapter 2 31
The source code for hello_world.c is stored in %MPI_ROOT%\help and
can be seen in “Compiling and running your first application” on page 22.
Building and running on a single host
The example teaches you the basic compilation and run steps to execute
hello_world.c on your local host with four-way parallelism. To build
and run hello_world.c on a local host named mpiccp1:
Step 1. Change to a writable directory.
Step 2. Open a Visual Studio command window. (This example uses a 64-bit
version, so a Visual Studio x64 command window is opened.)
Step 3. Compile the hello_world executable file:
X:\Demo> "%MPI_ROOT%\bin\mpicc" -mpi64 ^
"%MPI_ROOT%\help\hello_world.c"
Microsoft C/C++ Optimizing Compiler Version 14.00.50727.42 for
x64
Copyright Microsoft Corporation. All rights reserved.
hello_world.c
Microsoft Incremental Linker Version 8.00.50727.42
Copyright Microsoft Corporation. All rights reserved.
/out:hello_world.exe
"/libpath:C:\Program Files (x86)\Hewlett-Packard\HP-MPI\lib"
/subsystem:console
libhpmpi64.lib
libmpio64.lib
hello_world.obj
Step 4. Run the hello_world executable file:
X:\Demo> "%MPI_ROOT%\bin\mpirun" -np 4 hello_world.exe
where -np 4 specifies 4 as the number of processors to run.
Step 5. Analyze hello_world output.
HP-MPI prints the output from running the hello_world executable in
non-deterministic order. The following is an example of the output:
Hello world! I'm 0 of 4 on mpiccp1
Hello world! I'm 3 of 4 on mpiccp1
Hello world! I'm 1 of 4 on mpiccp1
Hello world! I'm 2 of 4 on mpiccp1