On 30/05/2014 13:45, Sergii Veremieiev wrote:
Dear Sir/Madam,I'm trying to compile and run a simple "Hello World" C++/MPI code on my personal desktop machine (6-core Intel Core i7-3930K CPU with Windows 7 SP1 and Cygwin with the default built-in Open MPI 1.7.5 and GCC 4.8.2). I'm beginner with this, never run parallel codes on desktops, only on a cluster. Here is the code: using namespace std; #include "mpi.h" int main(int argc, char *argv[]) { int noprocs, nid; MPI::Init(argc,argv); nid = MPI::COMM_WORLD.Get_rank(); noprocs = MPI::COMM_WORLD.Get_size(); if (nid==0) cout << "Hello from processor " << nid << " of " << noprocs << endl; MPI::Finalize(); } Using “mpicxx -o Hello Hello.cpp” the code compiles without any problems and generates an executable. However when I try to run the code using “mpirun -np 1 Hello” or “mpiexec -n 1 Hello” the following error message is returned:
Hi Sergii mpirun -np 1 ./Hello works fine for me : "Hello from processor 0 of 1" As the message is "opal_os_dirpath_create: Error: Unable to create the sub-directory /tmp/openmpi-sessions-enrsvere@byenr502b-01f_0/11302" you need to check the location and permission of /tmp You can also follows guidelines on https://cygwin.com/problems.html and follow up on cygwin mailing list https://cygwin.com/lists.html Not relevant, but please note your code is missing something as $ mpirun -np 4 ./Hello Hello from processor 0 of 4 While the standard hello_cxx.cc ---------------------------- #include "mpi.h" #include <iostream> int main(int argc, char **argv) { int rank, size, len; char version[MPI_MAX_LIBRARY_VERSION_STRING]; MPI::Init(); rank = MPI::COMM_WORLD.Get_rank(); size = MPI::COMM_WORLD.Get_size(); MPI_Get_library_version(version, &len); std::cout << "Hello, world! I am " << rank << " of " << size << "(" << version << ", " << len << ")" << std::endl; MPI::Finalize(); return 0; } ------------------------------- produces $ mpirun -np 4 ./hello_cxx Hello, world! I am 1 of 4 ... Hello, world! I am 0 of 4 ... Hello, world! I am 2 of 4 ... Hello, world! I am 3 of 4 ...
