+// Copyright (C) 2011-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
#include <iostream>
#include <math.h>
#include <mpi.h>
int main(int argc, char**argv)
{
int *indg;
- double *vector, sum=0., norm, etalon;
+ double *vector, sum=0., norm=1., etalon=0.;
int rank, size, grank, gsize, rsize;
int vsize=20, lvsize, rlvsize;
int i, k1, k2, imin, imax, nb;
int srv=0;
MPI_Comm com, icom;
- MPI_Status status;
+ MPI_Status status;
+ MPI_Info info;
char port_name [MPI_MAX_PORT_NAME];
char port_name_clt [MPI_MAX_PORT_NAME];
std::string service = "SERVICE";
bool debug=false;
-#ifndef WITHOPENMPI
- std::cout << "This test only works with openmpi implementation" << std::endl;
- exit(1);
-#endif
-
for(i=1;i<argc;i++){
std::string sargv = argv[i];
if(sargv.find("-debug")!=std::string::npos)
MPI_Barrier(MPI_COMM_WORLD);
MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
+#ifdef HAVE_MPI2
+ MPI_Info_create(&info);
+ MPI_Info_set(info, "ompi_unique", "true");
if(rank==0){
MPI_Open_port(MPI_INFO_NULL, port_name);
if ( MPI_Lookup_name((char*)service.c_str(), MPI_INFO_NULL, port_name_clt) == MPI_SUCCESS ) {
std::cout << "[" << rank << "] I am client: I get the service " << service << " !" << std::endl;
MPI_Close_port( port_name );
}
- else if ( MPI_Publish_name((char*)service.c_str(), MPI_INFO_NULL, port_name) == MPI_SUCCESS ) {
+ else if ( MPI_Publish_name((char*)service.c_str(), info, port_name) == MPI_SUCCESS ) {
if(debug)
std::cout << "[" << rank << "] I am server: I've managed to publish the service " << service << " !" << std::endl;
srv = 1;
free(indg);
free(vector);
+#endif
MPI_Finalize();
if(rank==0){