From 71044a5cbd37bcb595f3d458e60c2649c8a42b55 Mon Sep 17 00:00:00 2001 From: secher Date: Mon, 16 Jan 2006 14:56:01 +0000 Subject: [PATCH] porting on Mandrake 10.1 --- salome_adm/unix/config_files/check_lam.m4 | 17 +++++++++++++++++ salome_adm/unix/config_files/check_pthreads.m4 | 2 ++ src/Communication/ReceiverFactory.cxx | 4 ++-- src/Communication/Receivers.cxx | 18 +++++++++--------- src/Communication/Receivers.hxx | 14 +++++++++++++- src/Communication/SALOME_Comm_i.cxx | 2 +- 6 files changed, 44 insertions(+), 13 deletions(-) diff --git a/salome_adm/unix/config_files/check_lam.m4 b/salome_adm/unix/config_files/check_lam.m4 index d15fdde31..4a9941e2c 100644 --- a/salome_adm/unix/config_files/check_lam.m4 +++ b/salome_adm/unix/config_files/check_lam.m4 @@ -88,8 +88,25 @@ if test "$WITHLAM" = yes; then 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::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 diff --git a/salome_adm/unix/config_files/check_pthreads.m4 b/salome_adm/unix/config_files/check_pthreads.m4 index 80aef2aad..d5033889e 100644 --- a/salome_adm/unix/config_files/check_pthreads.m4 +++ b/salome_adm/unix/config_files/check_pthreads.m4 @@ -38,6 +38,8 @@ if test $flag = no; then AC_CHECK_LIB(posix4,nanosleep, LIBS_PTHREADS="-lposix4",LIBS_PTHREADS="") AC_CHECK_LIB(pthread,pthread_mutex_lock, LIBS_PTHREADS="-lpthread $LIBS_PTHREADS",LIBS_PTHREADS="") +else + LDFLAGS="-pthread $LDFLAGS" fi if test $flag = no && x$LIBS_PTHREADS = x; then diff --git a/src/Communication/ReceiverFactory.cxx b/src/Communication/ReceiverFactory.cxx index f404a7ec3..94743bfae 100644 --- a/src/Communication/ReceiverFactory.cxx +++ b/src/Communication/ReceiverFactory.cxx @@ -115,7 +115,7 @@ double *ReceiverFactory::getValueOneShot(SALOME::SenderDouble_ptr sender,long &s else if(!CORBA::is_nil(mpi_ptr)) { CORBA::release(sender); - MPIReceiver rec(mpi_ptr); + MPIReceiver rec(mpi_ptr); return rec.getValue(size); } #endif @@ -165,7 +165,7 @@ int *ReceiverFactory::getValueOneShot(SALOME::SenderInt_ptr sender,long &size)th else if(!CORBA::is_nil(mpi_ptr)) { CORBA::release(sender); - MPIReceiver rec(mpi_ptr); + MPIReceiver rec(mpi_ptr); return rec.getValue(size); } #endif diff --git a/src/Communication/Receivers.cxx b/src/Communication/Receivers.cxx index f97b4a1a4..f2ce1fa89 100644 --- a/src/Communication/Receivers.cxx +++ b/src/Communication/Receivers.cxx @@ -154,17 +154,17 @@ T *CorbaWCWithCopyReceiver::get #ifdef HAVE_MPI2 -template -MPIReceiver::MPIReceiver(CorbaSender mySender):_mySender(mySender){ +template +MPIReceiver::MPIReceiver(CorbaSender mySender):_mySender(mySender){ } -template -MPIReceiver::~MPIReceiver(){ +template +MPIReceiver::~MPIReceiver(){ _mySender->release(); } -template -T *MPIReceiver::getDistValue(long &size){ +template +T *MPIReceiver::getDistValue(long &size){ int i=0; int myproc; int sproc; @@ -211,15 +211,15 @@ T *MPIReceiver::getDistValue(long &size){ } 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::MpiType, sproc,p->tag2,com,&status); _mySender->close(p); MPI_Comm_disconnect( &com ); size=_n; return _v; } -template -T *MPIReceiver::getValue(long &size) +template +T *MPIReceiver::getValue(long &size) { return Receiver::getValue(size,_mySender); } diff --git a/src/Communication/Receivers.hxx b/src/Communication/Receivers.hxx index 203bf64dc..2dd44a854 100644 --- a/src/Communication/Receivers.hxx +++ b/src/Communication/Receivers.hxx @@ -94,7 +94,19 @@ private: /*! Receiver for MPI transfert. */ -template +template +struct MPITRAITS +{ + static MPI_Datatype MpiType; +}; + +template<> +MPI_Datatype MPITRAITS::MpiType=MPI_DOUBLE; + +template<> +MPI_Datatype MPITRAITS::MpiType=MPI_INT; + +template class MPIReceiver : public Receiver { private: diff --git a/src/Communication/SALOME_Comm_i.cxx b/src/Communication/SALOME_Comm_i.cxx index f886b5387..632ce7a73 100644 --- a/src/Communication/SALOME_Comm_i.cxx +++ b/src/Communication/SALOME_Comm_i.cxx @@ -272,7 +272,7 @@ SALOME::MPISender::param* SALOME_MPISender_i::getParam() void SALOME_MPISender_i::send() { _type=getTypeOfDataTransmitted(); - _argsForThr=new (void *)[8]; + _argsForThr=new void *[8]; _argsForThr[0]=_portName; _argsForThr[1]=&_lgrTabToSend; _argsForThr[2]=(void *)_tabToSend; -- 2.39.2