AC_CHECK_LIB(mpi,MPI_Init,WITHLAM="yes",WITHLAM="no")
if test "$WITHLAM" = "yes";then
MPI_LIBS="-lmpi $MPI_LIBS"
+ LIBS="-lmpi $LIBS"
fi
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ LIBS="-llammpi++ $LIBS"
+ AC_MSG_CHECKING(for MPI_Init in -llammpi++)
+ AC_TRY_LINK([
+ #include <mpi.h>
+ ], [MPI::Init();],
+ WITHLAM="yes",WITHLAM="no")
+ if test "$WITHLAM" = "yes";then
+ AC_MSG_RESULT(yes)
+ MPI_LIBS="-llammpi++ $MPI_LIBS"
+ else
+ AC_MSG_RESULT(no)
+ fi
+ AC_LANG_RESTORE
+
AC_CHECK_LIB(mpi,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no")
fi
else if(!CORBA::is_nil(mpi_ptr))
{
CORBA::release(sender);
- MPIReceiver<double,MPI_DOUBLE,SALOME::MPISenderDouble_ptr,SALOME::SenderDouble_ptr,SALOME_SenderDouble_i> rec(mpi_ptr);
+ MPIReceiver<double,SALOME::MPISenderDouble_ptr,SALOME::SenderDouble_ptr,SALOME_SenderDouble_i> rec(mpi_ptr);
return rec.getValue(size);
}
#endif
else if(!CORBA::is_nil(mpi_ptr))
{
CORBA::release(sender);
- MPIReceiver<int,MPI_INT,SALOME::MPISenderInt_ptr,SALOME::SenderInt_ptr,SALOME_SenderInt_i> rec(mpi_ptr);
+ MPIReceiver<int,SALOME::MPISenderInt_ptr,SALOME::SenderInt_ptr,SALOME_SenderInt_i> rec(mpi_ptr);
return rec.getValue(size);
}
#endif
#ifdef HAVE_MPI2
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
-MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::MPIReceiver(CorbaSender mySender):_mySender(mySender){
+template<class T,class CorbaSender,class servForT,class ptrForT>
+MPIReceiver<T,CorbaSender,servForT,ptrForT>::MPIReceiver(CorbaSender mySender):_mySender(mySender){
}
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
-MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::~MPIReceiver(){
+template<class T,class CorbaSender,class servForT,class ptrForT>
+MPIReceiver<T,CorbaSender,servForT,ptrForT>::~MPIReceiver(){
_mySender->release();
}
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
-T *MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
+template<class T,class CorbaSender,class servForT,class ptrForT>
+T *MPIReceiver<T,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
int i=0;
int myproc;
int sproc;
}
MPI_Recv( &_n, 1, MPI_LONG, sproc,p->tag1,com,&status);
_v = new T[_n];
- MPI_Recv( _v, _n, T2, sproc,p->tag2,com,&status);
+ MPI_Recv( _v, _n, MPITRAITS<T>::MpiType, sproc,p->tag2,com,&status);
_mySender->close(p);
MPI_Comm_disconnect( &com );
size=_n;
return _v;
}
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
-T *MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::getValue(long &size)
+template<class T,class CorbaSender,class servForT,class ptrForT>
+T *MPIReceiver<T,CorbaSender,servForT,ptrForT>::getValue(long &size)
{
return Receiver<T,servForT,ptrForT>::getValue(size,_mySender);
}
/*!
Receiver for MPI transfert.
*/
-template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
+template<class T>
+struct MPITRAITS
+{
+ static MPI_Datatype MpiType;
+};
+
+template<>
+MPI_Datatype MPITRAITS<double>::MpiType=MPI_DOUBLE;
+
+template<>
+MPI_Datatype MPITRAITS<int>::MpiType=MPI_INT;
+
+template<class T,class CorbaSender,class servForT,class ptrForT>
class MPIReceiver : public Receiver<T,servForT,ptrForT>
{
private: