Dear developers of Open MPI,

I've created two applications: parent and child. Parent spawns children
using MPI_Comm_spawn. I would like to use shared memory when they
communicate. However, applications do not start when I try using sm. Please
comment on that issue. If this feature is not supported, are there any
plans to add support? Also, are there any examples showing MPI_Comm_spawn
and shared memory?

I am using Open MPI 1.6.5 on Ubuntu. Both applications are run locally on
the same host.

// Works fine
mpirun --mca btl self,tcp ./parent

// Application terminates
mpirun --mca btl self,sm ./parent

"At least one pair of MPI processes are unable to reach each other for
MPI communications.  This means that no Open MPI device has indicated
that it can be used to communicate between these processes.  This is
an error; Open MPI requires that all MPI processes be able to reach
each other.  This error can sometimes be the result of forgetting to
specify the "self" BTL."

Below are code snippets:

parent.cc:
#include <string>
#include <unistd.h>

int main(int argc, char** argv) {
  MPI_Init(NULL, NULL);

  std::string lProgram = "./child";
  MPI_Comm lIntercomm;
  int lRv;
  lRv = MPI_Comm_spawn( const_cast< char* >(lProgram.c_str()),
MPI_ARGV_NULL, 3,
                       MPI_INFO_NULL, 0, MPI_COMM_WORLD, &lIntercomm,
                       MPI_ERRCODES_IGNORE);

  if ( MPI_SUCCESS == lRv) {
      std::cout << "SPAWN SUCCESS" << std::endl;
      sleep(10);
  }
  else {
      std::cout << "SPAWN ERROR " << lRv << std::endl;
  }

  MPI_Finalize();
}

child.cc:
#include <mpi.h>
#include <iostream>
#include <unistd.h>

int main(int argc, char** argv) {
  // Initialize the MPI environment
  MPI_Init(NULL, NULL);

  std::cout << "CHILD" << std::endl;
  sleep(10);

  MPI_Finalize();
}

makefile (note, there are tabs not spaces preceding each target):
EXECS=child parent
MPICC?=mpic++

all: ${EXECS}

child: child.cc
    ${MPICC} -o child child.cc

parent: parent.cc
    ${MPICC} -o parent parent.cc

clean:
    rm -f ${EXECS}


Greetings to all of you,
Radek Martyniszyn
#include <mpi.h>
#include <iostream>
#include <unistd.h>

int main(int argc, char** argv) {
  // Initialize the MPI environment
  MPI_Init(NULL, NULL);

  std::cout << "CHILD" << std::endl;
  sleep(10);

  MPI_Finalize();
}

Attachment: makefile
Description: Binary data

#include <mpi.h>
#include <iostream>
#include <string>
#include <unistd.h>

int main(int argc, char** argv) {
  MPI_Init(NULL, NULL);

  std::string lProgram = "./child";
  MPI_Comm lIntercomm;
  int lRv;
  lRv = MPI_Comm_spawn( const_cast< char* >(lProgram.c_str()), MPI_ARGV_NULL, 3,
                       MPI_INFO_NULL, 0, MPI_COMM_WORLD, &lIntercomm,
                       MPI_ERRCODES_IGNORE);

  if ( MPI_SUCCESS == lRv) {
      std::cout << "SPAWN SUCCESS" << std::endl;
      sleep(10);
  }
  else {
      std::cout << "SPAWN ERROR " << lRv << std::endl;
  }

  MPI_Finalize();
}

Reply via email to