none
MPI program help RRS feed

  • Question

  • Hey,

    I am trying to build an MPI program for Uni. I am getting a identifier not found error.

    My code is: 

    #include "mpi.h"
    #include <stdio.h>
    #include "stdafx.h"
    
    int main(int argc, char** argv) {
    	// Initialize the MPI environment. The two arguments to MPI Init are not
    	// currently used by MPI implementations, but are there in case future
    	// implementations might need the arguments.
    	MPI_Init(NULL, NULL);
    
    	// Get the number of processes
    	int world_size;
    	MPI_Comm_size(MPI_COMM_WORLD, &world_size);
    
    	// Get the rank of the process
    	int world_rank;
    	MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
    
    	// Get the name of the processor
    	char processor_name[MPI_MAX_PROCESSOR_NAME];
    	int name_len;
    	MPI_Get_processor_name(processor_name, &name_len);
    
    	// Print off a hello world message
    	printf("Hello world from processor %s, rank %d out of %d processors\n",
    		processor_name, world_rank, world_size);
    
    	// Finalize the MPI environment. No more MPI calls can be made after this
    	MPI_Finalize();
    }

    I have installed both the MPI and SDK. I am trying to run it in x64. I have added $(MSMPI_INC)\x64;$(MSMPI_INC); to my C/C++ Additional include Directories and also $(MSMPI_LIB64); to my Linker Additional Library Directories.

    Any thoughts on this?

    Friday, August 25, 2017 2:07 AM

All replies

  • Hi,

    Can you copy and paste the errors that you're getting?

    Thanks

    Anh

    Friday, August 25, 2017 4:52 AM
  • Severity	Code	Description	Project	File	Line	Suppression State
    Error	C3861	'MPI_Init': identifier not found	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	18	
    Error	C2065	'MPI_SUCCESS': undeclared identifier	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	19	
    Error	C2065	'MPI_COMM_WORLD': undeclared identifier	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	21	
    Error	C3861	'MPI_Abort': identifier not found	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	21	
    Error	C2065	'MPI_COMM_WORLD': undeclared identifier	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	23	
    Error	C3861	'MPI_Comm_size': identifier not found	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	23	
    Error	C2065	'MPI_COMM_WORLD': undeclared identifier	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	24	
    Error	C3861	'MPI_Comm_rank': identifier not found	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	24	
    Error	C2065	'cout': undeclared identifier	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	26	
    Error	C2065	'endl': undeclared identifier	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	26	
    Error	C3861	'MPI_Finalize': identifier not found	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	27	
    Error	C1075	the left brace '{' was unmatched at the end of the file	MPIHello	d:\cab401\mpi\mpihello\mpihello\mpihello.cpp	14	
    

    I am using this guide:http://www.math.ucla.edu/~mputhawala/PPT.pdf to set it up.

    Thanks

    Friday, August 25, 2017 6:35 AM
  • OK. So I have gotten the program running. I can compile and run it on my machine and the 2nd machine as stand alone programs. The issues I'm currently having is getting it to run over both machines.

    MS MPI and the SDK's have been installed on both machines, same versions. I have shared a folder that both machines have access too. All I get when I run: 

    mpiexec -d 3 -hosts 2  Athena 1 Zues 1 "\\Zeus\mpi\MPIHello\x64\Release\MPIHello.exe"

    [00:19528] host tree:
    [00:19528]  host: Athena, parent: 0, id: 1
    [00:19528]  host: Zues, parent: 1, id: 2
    [00:19528] mpiexec started smpd manager listening on port 65451
    [00:19528] using spn msmpi/Athena to contact server
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] Failed to connect with error 1722, retrying...
    [00:19528] ERROR: Failed RpcCliCreateContext error 1722
    
    Aborting: mpiexec on ZEUS is unable to connect to the smpd service on Athena:8677
    Other MPI error, error stack:
    connect failed - The RPC server is unavailable.  (errno 1722)
    [00:19528] smpd manager successfully stopped listening.

    If I run smpd -d on the host machine(Athena) It fails immediately with this error:

    [00:9336] host tree:
    [00:9336]  host: Athena, parent: 0, id: 1
    [00:9336]  host: Zues, parent: 1, id: 2
    [00:9336] mpiexec started smpd manager listening on port 49224
    [00:9336] using spn msmpi/Athena to contact server
    [00:9336] Previous attempt failed with error 5, trying to authenticate without Kerberos
    [00:9336] ERROR: Failed RpcCliCreateContext error 5
    
    Aborting: mpiexec on ZEUS is unable to connect to the smpd service on Athena:8677
    Other MPI error, error stack:
    connect failed - Access is denied.  (errno 5)
    [00:9336] smpd manager successfully stopped listening.

    Firewall is turned off on both machines.

    Any ideas?

    Saturday, August 26, 2017 7:10 AM
  • Do you have the same user with same password running on both machine? They also have to be an account with password, not the Windows Live account. In addition, if you try to use IP addresses instead of machine names, do they work?

    Saturday, August 26, 2017 3:07 PM
  • How did you fix the errors ? I am getting the same errors. I see that you got the program running.
    Saturday, August 25, 2018 9:32 PM
  • @prad30458, are you seeing compilation errors or the runtime errors?

    - For compilation errors please make sure you have installed the MSMPI SDK.
    - The above runtime errors happen usually due to firewall issues or different username password.

    Friday, September 21, 2018 4:59 PM