- install MSMPI : msmpi. We need install both msmpisdk.msi (to get include\ & lib\) and MSMpiSetup.exe (to get bin\mpiexec.exe)
- set environment variables :
- MSMPI_BIN=C:\Program Files\Microsoft MPI\Bin\
- MSMPI_INC=C:\Program Files (x86)\Microsoft SDKs\MPI\Include\
- MSMPI_LIB32=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x86\
- MSMPI_LIB64=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64\
- create a new C++ empty project :
- change linker's system configuration to CONSOLE(SUBSYSTEM:CONSOLE)
- add linker additional lib directories (x86 or x64) this machine is x86:
- add linker input additional dependencies , Type msmpi.lib to the list
- add location of mpi header file
- Add a C++ file to write your first MPI program and write the following codes as a test:
#include<iostream> #include<mpi.h> using namespace std; int main(int argc, char** argv){ int mynode, totalnodes; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &totalnodes); MPI_Comm_rank(MPI_COMM_WORLD, &mynode); cout << "Hello world from process " << mynode; cout << " of " << totalnodes << endl; MPI_Finalize(); return 0; }
- build the program and if there is no error , then test it by running mpiexec: "mpiexec -n 4 mpi_hello.exe"
- use msmpi ; use msmpi 2 : 主要参考
Wednesday, November 11, 2015
Windows visual studio 2013 install MS_MPI and run mpi program
Labels:
mpi,
visual studio,
Windows
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment