Hello,
I am trying to use the Windows HPC MPI library from c++ using windows SUA.
So i am pretty new to this
Here is my simple c++ example:
| #include <iostream> |
| using namespace std; |
| |
| int main(){ |
| cout << "Hello World!\n"; |
| return 0 |
| } |
Compiled and ran it like this:
| bash-3.2$ cc -o main.exe main.cpp |
| bash-3.2$./main.exe |
| Hello World! |
| bash-3.2$ |
All looking good so far.
Now i want to include the mpi.h, here is my simple example:
| #include <stdlib.h> |
| #include <iostream> |
| #include <mpi.h> |
| |
| using namespace std; |
| |
| static int mypid; // PID of *this* node |
| static int nnodes; // number of nodes |
| |
| int main(int argc, char *argv[]) |
| { |
| cout << "Starting..." << endl; |
| |
| // fire up MPI |
| cout << "call MPI_Init().." << endl; |
| MPI_Init(&argc, &argv); |
| MPI_Comm_rank(MPI_COMM_WORLD, &mypid); |
| MPI_Comm_size(MPI_COMM_WORLD, &nnodes); |
| |
| // this test required two nodes |
| cout << "Rank " << mypid << " of " << nnodes << endl; |
| |
| // clean up and exit |
| cout << "Clean up and exit..." << endl; |
| MPI_Finalize(); |
| return(0); |
| } |
Now here is where i get confused, if i try to compile this i get this error:
| bash-3.2$ cc -o simplempi.exe simplempi.cpp |
| C:\Users\Administrator\mpiTest\simplempi.cpp(7) : fatal error C1083: Cannot open |
| include file: 'mpi.h': No such file or directory |
| bash-3.2$ |
Which is ok as there is not an mpi.h for SUA. Now i would like to use the HPC mpi.h.
I downloaded and installed the HPC SDK pack (now i get the header files i need)
| bash-3.2$ ls -al "/dev/fs/C/Program Files/Microsoft HPC Pack 2008 SDK/Include/" |
| total 312 |
| drwxrwx---+ 1 +SYSTEM +SYSTEM 0 Oct 3 08:33 . |
| drwxrwx---+ 1 +SYSTEM +SYSTEM 4096 Oct 3 08:33 .. |
| -rwxrwx---+ 1 +SYSTEM +SYSTEM 13674 Sep 2 15:12 job-v2.xsd |
| -rwxrwx---+ 1 +SYSTEM +SYSTEM 47551 Sep 11 14:51 mpi.f90 |
| -rwxrwx---+ 1 +SYSTEM +SYSTEM 53132 Sep 11 14:51 mpi.h |
| -rwxrwx---+ 1 +SYSTEM +SYSTEM 15750 Sep 11 14:51 mpif.h |
| -rwxrwx---+ 1 +SYSTEM +SYSTEM 18153 Sep 11 14:51 mpio.h |
| -rwxrwx---+ 1 +SYSTEM +SYSTEM 6466 Sep 2 15:12 task-v2.xsd |
| bash-3.2$ |
I then tried to link these headers to my /usr/include (symbolic) (Maybe this is where i am going wrong??)
| bash-3.2$ ln -s "/dev/fs/C/Program Files/Microsoft HPC Pack 2008 SDK/Include/"* /usr/include/ |
| |
Then tried to recompile, it attempts to load the mpi.h file but has trouble reading it.???
I tried mixed mode and g++/cc89/cc but without any luck
| bash-3.2$ cc -o simplempi.exe simplempi.cpp |
| flip: /tmp/cc_tmp3_1117 is a binary file, not converted |
| C:\Windows\SUA\usr\include\mpi.h(1) : error C2018: unknown character '0x1' |
| C:\Windows\SUA\usr\include\mpi.h(1) : error C2143: syntax error : missing ';' before '/' |
| C:\Windows\SUA\usr\include\mpi.h(1) : error C4430: missing type specifier - intassumed. Note: C++ does not support default-int |
| C:\Users\Administrator\mpiTest\simplempi.cpp(16) : error C2065: 'cout' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(16) : error C2065: 'endl' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(19) : error C2065: 'cout' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(19) : error C2065: 'endl' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(20) : error C3861: 'MPI_Init': identifier not found |
| C:\Users\Administrator\mpiTest\simplempi.cpp(21) : error C2065: 'MPI_COMM_WORLD' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(21) : error C3861: 'MPI_Comm_rank': identifier not found |
| C:\Users\Administrator\mpiTest\simplempi.cpp(22) : error C2065: 'MPI_COMM_WORLD' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(22) : error C3861: 'MPI_Comm_size': identifier not found |
| C:\Users\Administrator\mpiTest\simplempi.cpp(25) : error C2065: 'cout' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(25) : error C2065: 'endl' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(28) : error C2065: 'cout' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(28) : error C2065: 'endl' : undeclared identifier |
| C:\Users\Administrator\mpiTest\simplempi.cpp(29) : error C3861: 'MPI_Finalize':identifier not found |
| bash-3.2$ |
So... I guess my question now is , is it possible?
Has anyone out there got an MPI example that works with the windows mpi.h from SUA?
Can anyone see something wrong in the way i am approaching this problem?
Any help is very gratefully received!
Regards
Steven
sjj