From 89330b808b4cde11c8c5012a7251afa0f20d70a0 Mon Sep 17 00:00:00 2001 From: ribes Date: Mon, 30 Mar 2009 09:30:33 +0000 Subject: [PATCH] - Adding a new flag for configure: --enable-mpi-seq-container It permits to choose if you enable mpi support into SALOME_Container (default is no even if mpi is ok) --- configure.ac | 1 + salome_adm/unix/config_files/production.m4 | 22 ++++++++++++++++++++++ src/Container/Makefile.am | 14 ++++++++++---- src/Container/SALOME_Container.cxx | 16 +++++++++++----- 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 844d28f58..3716d879e 100644 --- a/configure.ac +++ b/configure.ac @@ -126,6 +126,7 @@ echo # production.m4 AC_ENABLE_DEBUG(no) AC_ENABLE_PRODUCTION(no) +AC_ENABLE_MPI_SEQ_CONTAINER(no) echo echo --------------------------------------------- diff --git a/salome_adm/unix/config_files/production.m4 b/salome_adm/unix/config_files/production.m4 index e109a03dc..6b61d9207 100644 --- a/salome_adm/unix/config_files/production.m4 +++ b/salome_adm/unix/config_files/production.m4 @@ -82,3 +82,25 @@ fi # AC_DISABLE_DEBUG - set the default flag to --disable-debug AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)]) + +dnl AC_ENABLE_MPI_SEQ_CONTAINER +dnl +dnl This macro enables mpi into the sequential container +dnl default = not enabled +dnl +AC_DEFUN([AC_ENABLE_MPI_SEQ_CONTAINER], + [define([AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT], ifelse($1, no, no, yes))dnl + AC_ARG_ENABLE([mpi-seq-container], + [AC_HELP_STRING([--enable-mpi-seq-container], + [enable mpi into seq container @<:@default=]AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT[@:>@])], + [ + enable_mpi_seq_container=$enableval + ], + [enable_mpi_seq_container=]AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT) + +if test "X$enable_mpi_seq_container" = "Xyes"; then + CFLAGS="$CFLAGS -D_MPI_SEQ_CONTAINER_ " + CXXFLAGS="$CXXFLAGS -D_MPI_SEQ_CONTAINER_ " +fi +AM_CONDITIONAL([WITH_MPI_SEQ_CONTAINER], [test "x$enable_mpi_seq_container" = "xyes"]) +]) diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 5f8172cff..394ea1035 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -61,7 +61,6 @@ dist_salomescript_SCRIPTS=\ # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS=\ @PYTHON_INCLUDES@ \ - @MPI_INCLUDES@ \ @HDF5_INCLUDES@ \ -I$(srcdir)/../Batch \ -I$(srcdir)/../Basics \ @@ -89,10 +88,14 @@ COMMON_LIBS =\ ../HDFPersist/libSalomeHDFPersist.la \ ../Batch/libSalomeBatch.la \ $(top_builddir)/idl/libSalomeIDLKernel.la \ - @MPI_LIBS@ \ @CORBA_LIBS@ \ $(PYTHON_LIBS) +if WITH_MPI_SEQ_CONTAINER +COMMON_CPPFLAGS += @MPI_INCLUDES@ +COMMON_LIBS += @MPI_LIBS@ +endif + # # =============================================================== # Libraries targets @@ -142,10 +145,13 @@ SALOME_Container_LDADD = \ libSalomeContainer.la \ ../Basics/libSALOMEBasics.la \ $(HDF5_LIBS) \ - $(MPI_LIBS) \ $(CORBA_LIBS) \ $(PYTHON_LIBS) +if WITH_MPI_SEQ_CONTAINER +SALOME_Container_LDADD += $(MPI_LIBS) +endif + SALOME_Container_LDFLAGS =\ -Xlinker -export-dynamic @@ -159,6 +165,6 @@ TestSalome_file_LDADD =\ libSalomeContainer.la \ ../Basics/libSALOMEBasics.la \ $(HDF5_LIBS) \ - $(MPI_LIBS) \ $(CORBA_LIBS) \ $(PYTHON_LIBS) + diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index 07024cd13..fe1959ff0 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -25,8 +25,10 @@ // Module : SALOME // $Header$ // -#ifdef HAVE_MPI2 +#ifdef _MPI_SEQ_CONTAINER_ + #ifdef HAVE_MPI2 #include + #endif #endif #include @@ -118,9 +120,11 @@ void unexpectedHandler(void) int main(int argc, char* argv[]) { -#ifdef HAVE_MPI2 +#ifdef _MPI_SEQ_CONTAINER_ + #ifdef HAVE_MPI2 MPI_Init(&argc,&argv); -#endif + #endif +#endif #ifndef WIN32 if(getenv ("DEBUGGER")) @@ -225,9 +229,11 @@ int main(int argc, char* argv[]) INFOS("Caught unknown exception."); } -#ifdef HAVE_MPI2 +#ifdef _MPI_SEQ_CONTAINER_ + #ifdef HAVE_MPI2 MPI_Finalize(); -#endif + #endif +#endif //END_OF(argv[0]); //LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); -- 2.39.2