From: secher Date: Wed, 10 Nov 2004 11:53:05 +0000 (+0000) Subject: merge from V1_2_4_with_MPI pour portage CCRT X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=904e7df3dd1b8030d7d5e18814dc0ed3967be789;p=modules%2Fkernel.git merge from V1_2_4_with_MPI pour portage CCRT --- diff --git a/configure.in.base b/configure.in.base index 0eef838db..e0760a01e 100644 --- a/configure.in.base +++ b/configure.in.base @@ -14,7 +14,7 @@ # # Created from configure.in.base # - +AS_SHELL_SANITIZES AC_INIT(src) AC_CONFIG_AUX_DIR(salome_adm/unix/config_files) AC_CANONICAL_HOST @@ -48,6 +48,10 @@ echo Build root directory : $ROOT_BUILDDIR echo echo +dnl Modification B. Secher portage sur osf +AC_CHECK_PROG(SHELL,sh) +AC_SUBST(SHELL) + if test -z "$AR"; then AC_CHECK_PROGS(AR,ar xar,:,$PATH) fi @@ -68,9 +72,6 @@ AC_PROG_INSTALL dnl dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques ! -AC_ENABLE_DEBUG(yes) -AC_DISABLE_PRODUCTION - echo --------------------------------------------- echo testing libtool echo --------------------------------------------- @@ -86,7 +87,7 @@ dnl Fix up the INSTALL macro if it s a relative path. We want the dnl full-path to the binary instead. case "$INSTALL" in *install-sh*) - INSTALL='\${top_srcdir}'/salome_adm/unix/config_files/install-sh + INSTALL="${ROOT_SRCDIR}/salome_adm/unix/config_files/install-sh -c" ;; esac @@ -100,22 +101,34 @@ cc_ok=no dnl inutil car libtool dnl AC_PROG_CC AC_PROG_CXX +AC_CXX_WARNINGS +AC_CXX_TEMPLATE_OPTIONS AC_DEPEND_FLAG # AC_CC_WARNINGS([ansi]) cc_ok=yes +AC_ENABLE_DEBUG(yes) +AC_DISABLE_PRODUCTION + dnl Library libdl : AC_CHECK_LIB(dl,dlopen) +dnl Library librt : for alpha/osf +AC_CHECK_LIB(rt,nanosleep) + dnl add library libm : AC_CHECK_LIB(m,ceil) -dnl -dnl Well we use sstream which is not in gcc pre-2.95.3 -dnl We must test if it exists. If not, add it in include ! +AC_CXX_USE_STD_IOSTREAM +AC_CXX_HAVE_SSTREAM + +dnl +dnl --------------------------------------------- +dnl testing linker +dnl --------------------------------------------- dnl -AC_CXX_HAVE_SSTREAM +AC_LINKER_OPTIONS echo echo --------------------------------------------- diff --git a/idl/Makefile.in b/idl/Makefile.in index 7de067f74..6e46e61bd 100644 --- a/idl/Makefile.in +++ b/idl/Makefile.in @@ -22,9 +22,8 @@ IDL_FILES = \ SALOME_Component.idl \ SALOME_TestComponent.idl \ SALOME_Registry.idl \ - TypeData.idl \ - MPIObject.idl \ - MPIContainer.idl \ + SALOME_MPIObject.idl \ + SALOME_MPIContainer.idl \ Logger.idl \ SALOME_GenericObj.idl \ SALOME_TestModuleCatalog.idl diff --git a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 index 7c87413dd..5dd873fd2 100644 --- a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 +++ b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 @@ -35,17 +35,34 @@ ac_cv_depend_flag, echo "conftest.o: conftest.c" > conftest.verif echo "int main() { return 0; }" > conftest.c +dnl Evolution portage sur CCRT/osf system + case $host_os in + osf*) +dnl sur CCRT/osf pas d'equivalent de l'option -MG de gcc avec compilo natif +dnl on utilise donc gnu pour generer les dependances. + DEPCC=gcc + DEPCXX=g++ + DEPCXXFLAGS="-Wno-deprecated -funsigned-char" + DIFFFLAGS="-w" + ;; + *) + DEPCC=${CC-cc} + DEPCXX=${CXX-c++} + DEPCXXFLAGS="\${CXXFLAGS}" + DIFFFLAGS="-b -B" + ;; + esac C_DEPEND_FLAG= for ac_C_DEPEND_FLAG in -xM -MM -M ; do rm -f conftest.d conftest.err - ${CC-cc} ${ac_C_DEPEND_FLAG} -c conftest.c 1> conftest.d 2> conftest.err + ${DEPCC} ${ac_C_DEPEND_FLAG} -c conftest.c 1> conftest.d 2> conftest.err if test -f conftest.u ; then mv conftest.u conftest.d fi rm -f conftest - diff -b -B conftest.d conftest.verif > conftest + diff ${DIFFFLAGS} conftest.d conftest.verif > conftest if test ! -s conftest ; then C_DEPEND_FLAG=${ac_C_DEPEND_FLAG} break @@ -54,12 +71,12 @@ ac_cv_depend_flag, dnl use gcc option -MG : asume unknown file will be construct later rm -f conftest.d conftest.err - ${CC-cc} ${C_DEPEND_FLAG} -MG -c conftest.c 1> conftest.d 2> conftest.err + ${DEPCC} ${C_DEPEND_FLAG} -MG -c conftest.c 1> conftest.d 2> conftest.err if test -f conftest.u ; then mv conftest.u conftest.d fi rm -f conftest - diff -b -B conftest.d conftest.verif > conftest + diff ${DIFFFLAGS} conftest.d conftest.verif > conftest if test ! -s conftest ; then C_DEPEND_FLAG=${C_DEPEND_FLAG}" -MG" fi @@ -70,7 +87,7 @@ dnl use gcc option -MG : asume unknown file will be construct later exit fi - echo -n " C : " ${C_DEPEND_FLAG} + printf " C : ${DEPCC} ${C_DEPEND_FLAG}" AC_LANG_CPLUSPLUS echo "conftest.o: conftest.cxx" > conftest.verif @@ -80,13 +97,13 @@ dnl use gcc option -MG : asume unknown file will be construct later for ac_CXX_DEPEND_FLAG in -xM -MM -M ; do rm -f conftest.d conftest.err - ${CXX-c++} ${ac_CXX_DEPEND_FLAG} -c conftest.cxx 1> conftest.d 2> conftest.err + ${DEPCXX} ${ac_CXX_DEPEND_FLAG} -c conftest.cxx 1> conftest.d 2> conftest.err if test -f conftest.u ; then mv conftest.u conftest.d fi rm -f conftest - diff -b -B conftest.d conftest.verif > conftest + diff ${DIFFFLAGS} conftest.d conftest.verif > conftest if test ! -s conftest ; then CXX_DEPEND_FLAG=${ac_CXX_DEPEND_FLAG} break @@ -95,12 +112,12 @@ dnl use gcc option -MG : asume unknown file will be construct later dnl use g++ option -MG : asume unknown file will be construct later rm -f conftest.d conftest.err - ${CXX-c++} ${CXX_DEPEND_FLAG} -MG -c conftest.cxx 1> conftest.d 2> conftest.err + ${DEPCXX} ${CXX_DEPEND_FLAG} -MG -c conftest.cxx 1> conftest.d 2> conftest.err if test -f conftest.u ; then mv conftest.u conftest.d fi rm -f conftest - diff -b -B conftest.d conftest.verif > conftest + diff ${DIFFFLAGS} conftest.d conftest.verif > conftest if test ! -s conftest ; then CXX_DEPEND_FLAG=${CXX_DEPEND_FLAG}" -MG" fi @@ -112,9 +129,12 @@ dnl use g++ option -MG : asume unknown file will be construct later exit fi - echo -n " C++ : " ${CXX_DEPEND_FLAG} + printf " C++ : ${DEPCXX} ${CXX_DEPEND_FLAG}" AC_LANG_RESTORE + AC_SUBST(DEPCC) + AC_SUBST(DEPCXX) + AC_SUBST(DEPCXXFLAGS) AC_SUBST(C_DEPEND_FLAG) AC_SUBST(CXX_DEPEND_FLAG) ]) diff --git a/salome_adm/unix/config_files/check_cas.m4 b/salome_adm/unix/config_files/check_cas.m4 index 85d8f0c73..eed46982c 100644 --- a/salome_adm/unix/config_files/check_cas.m4 +++ b/salome_adm/unix/config_files/check_cas.m4 @@ -36,7 +36,6 @@ AC_SUBST(CAS_MODELER) AC_SUBST(CAS_OCAF) AC_SUBST(CAS_DATAEXCHANGE) AC_SUBST(CAS_LDFLAGS) - AC_SUBST(CAS_LDPATH) OWN_CONFIG_H=no @@ -47,7 +46,6 @@ CAS_LDFLAGS="" occ_ok=no own_config_h=no - dnl libraries directory location case $host_os in linux*) @@ -62,7 +60,7 @@ case $host_os in irix6.*) casdir=Linux ;; - osf4.*) + osf*) casdir=Linux ;; solaris2.*) @@ -73,6 +71,20 @@ case $host_os in ;; esac +AC_MSG_CHECKING(for OpenCascade directories) +if test -d ${CASROOT}/${casdir}/lib; then + CAS_LDPATH="-L$CASROOT/$casdir/lib " + AC_MSG_RESULT(yes) +else + if test -d ${CASROOT}/lib; then + CAS_LDPATH="-L$CASROOT/lib " + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +fi + + dnl were is OCC ? if test -z $CASROOT; then AC_MSG_WARN(You must provide CASROOT variable : see OCC installation manual) @@ -90,13 +102,19 @@ fi if test "x$occ_ok" = "xyes"; then +dnl test c++ compiler flag for unsigned character + for opt in -funsigned-char -unsigned ; do + AC_CXX_OPTION($opt,CXXFLAGS,flag=yes,flag=no) + if test "$flag" = "yes"; then + break + fi + done + dnl cascade headers CPPFLAGS_old="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -I$CASROOT -I$KERNEL_ROOT_DIR/include/salome -Wno-deprecated -DHAVE_WOK_CONFIG_H" - CXXFLAGS_old="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -funsigned-char" - + CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H -I$CASROOT/inc" + CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS" echo echo @@ -125,32 +143,19 @@ dnl cascade headers OWN_CONFIG_H=yes fi - CPPFLAGS="$CPPFLAGS -I$ROOT_BUILDDIR/salome_adm/unix" - AC_CHECK_HEADER(Standard_Type.hxx,occ_ok=yes ,occ_ok=no) - CPPFLAGS="$CPPFLAGS_old" - CXXFLAGS="$CXXFLAGS_old" fi -AC_SUBST(OWN_CONFIG_H) - if test "x$occ_ok" = xyes ; then - CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -I$CASROOT -DHAVE_WOK_CONFIG_H" - CAS_CXXFLAGS="-funsigned-char" - AC_MSG_CHECKING(for OpenCascade libraries) - CPPFLAGS_old="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome -I$ROOT_BUILDDIR/salome_adm/unix -Wno-deprecated" - CXXFLAGS_old="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $CAS_CXXFLAGS" LIBS_old="$LIBS" - LIBS="$LIBS -L$CASROOT/$casdir/lib -lTKernel" + LIBS="$LIBS $CAS_LDPATH -lTKernel" + AC_CACHE_VAL(salome_cv_lib_occ,[ AC_TRY_LINK( -using namespace std; #include , size_t size; const Standard_CString aName="toto"; @@ -160,28 +165,36 @@ using namespace std; ]) occ_ok="$salome_cv_lib_occ" - CPPFLAGS="$CPPFLAGS_old" - CXXFLAGS="$CXXFLAGS_old" - LIBS="$LIBS_old" fi +CPPFLAGS="$CPPFLAGS_old" +LIBS="$LIBS_old" if test "x$occ_ok" = xno ; then AC_MSG_RESULT(no) AC_MSG_WARN(Opencascade libraries not found) else AC_MSG_RESULT(yes) - CAS_LDPATH="-L$CASROOT/$casdir/lib " CAS_KERNEL="$CAS_LDPATH -lTKernel -lTKMath" - CAS_OCAF="$CAS_LDPATH -lPTKernel -lTKCAF -lFWOSPlugin -lTKPShape -lTKPCAF -lTKStdSchema -lTKShapeSchema -lPAppStdPlugin -lTKPAppStd -lTKCDF" -dnl CAS_VIEWER="-L$CASROOT/$casdir/lib -lTKOpenGl -lTKV3d -lTKV2d -lTKService" + + # E.A. compatibility version 4 and 5.x + CAS_OCAF="$CAS_LDPATH -lPTKernel -lTKCAF -lFWOSPlugin -lTKPShape -lTKPCAF -lTKStdSchema -lTKShapeSchema -lPAppStdPlugin" + if test $OCC_VERSION_MAJOR -lt 5 ; then + CAS_OCAF="$CAS_OCAF -lTKPAppStd" + fi + CAS_OCAF="$CAS_OCAF -lTKCDF" + CAS_VIEWER="$CAS_LDPATH -lTKOpenGl -lTKV3d -lTKService" -# CAS_MODELER="-L$CASROOT/$casdir/lib -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBool -lTKHLR -lTKFillet -lTKFeat -lTKOffset" CAS_MODELER="$CAS_LDPATH -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBool -lTKHLR -lTKFillet -lTKOffset" -dnl CAS_DATAEXCHANGE="-L$CASROOT/$casdir/lib -lTKXSBase -lTKIGES -lTKSTEP -lTKShHealing -lTKShHealingStd -lTKSTL -lTKVRML " - CAS_DATAEXCHANGE="$CAS_LDPATH -lTKXSBase -lTKIGES -lTKSTEP -lTKShHealing -lTKShHealingStd" + + # E.A. compatibility version 4 and 5.x + CAS_DATAEXCHANGE="$CAS_LDPATH -lTKXSBase -lTKIGES -lTKSTEP -lTKShHealing" + if test $OCC_VERSION_MAJOR -lt 5 ; then + CAS_DATAEXCHANGE="$CAS_DATAEXCHANGE -lTKShHealingStd" + fi + + CAS_LDFLAGS="$CAS_KERNEL $CAS_OCAF $CAS_VIEWER $CAS_MODELER $CAS_DATAEXCHANGE" - - + fi AC_LANG_RESTORE diff --git a/salome_adm/unix/config_files/check_mpich.m4 b/salome_adm/unix/config_files/check_mpich.m4 index 5b34bcd80..ea7b9d1bf 100644 --- a/salome_adm/unix/config_files/check_mpich.m4 +++ b/salome_adm/unix/config_files/check_mpich.m4 @@ -52,16 +52,14 @@ if test "$WITHMPICH" = yes; then if test "$WITHMPICH" = "yes";then LDFLAGS_old="$LDFLAGS" LDFLAGS="$MPI_LIBS $LDFLAGS" - AC_CHECK_LIB(mpich,MPI_Init, - AC_CHECK_LIB(pmpich, PMPI_Init,WITHMPICH="yes",WITHMPICH="no"), - WITHMPICH="no") + AC_CHECK_LIB(mpich,MPI_Init,WITHMPICH="yes",WITHMPICH="no") AC_CHECK_LIB(mpich,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no") LDFLAGS="$LDFLAGS_old" fi if test "$WITHMPICH" = "yes";then mpi_ok=yes - MPI_LIBS="$MPI_LIBS -lpmpich -lmpich" + MPI_LIBS="$MPI_LIBS -lmpich" else mpi_ok=no fi diff --git a/salome_adm/unix/config_files/check_pthreads.m4 b/salome_adm/unix/config_files/check_pthreads.m4 index 0608c4a40..983bfc200 100644 --- a/salome_adm/unix/config_files/check_pthreads.m4 +++ b/salome_adm/unix/config_files/check_pthreads.m4 @@ -30,22 +30,21 @@ dnl@id $Id$ dnl ---------------------------------------------------------------- dnl CHECK_PTHREADS AC_DEFUN(CHECK_PTHREADS,[ -AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl -AC_CHECK_HEADER(pthread.h,AC_DEFINE(HAVE_PTHREAD_H)) -AC_CHECK_LIB(posix4,nanosleep, LIBS_PTHREADS="-lposix4",LIBS_PTHREADS="") -AC_CHECK_LIB(pthread,pthread_mutex_lock, - LIBS_PTHREADS="-lpthread $LIBS_PTHREADS") -AC_MSG_CHECKING([parameters for using pthreads]) -case $build_os in - freebsd*) - CFLAGS_PTHREADS="-pthread" - CXXFLAGS_PTHREADS="-pthread" - ;; - *) - ;; -esac -AC_MSG_RESULT(["flags: $CFLAGS_PTHREADS\;libs: $LIBS_PTHREADS"]) -threads_ok=yes +AC_CXX_OPTION(-pthread,CPPFLAGS,flag=yes,flag=no) + +if test $flag = no; then + AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl + AC_CHECK_HEADER(pthread.h,AC_DEFINE(HAVE_PTHREAD_H)) + AC_CHECK_LIB(posix4,nanosleep, LIBS_PTHREADS="-lposix4",LIBS_PTHREADS="") + AC_CHECK_LIB(pthread,pthread_mutex_lock, + LIBS_PTHREADS="-lpthread $LIBS_PTHREADS",LIBS_PTHREADS="") +fi + +if test $flag = no && x$LIBS_PTHREADS = x; then + threads_ok=no +else + threads_ok=yes +fi ])dnl dnl dnl diff --git a/salome_adm/unix/config_files/check_sip.m4 b/salome_adm/unix/config_files/check_sip.m4 index feecb0dde..48a025918 100644 --- a/salome_adm/unix/config_files/check_sip.m4 +++ b/salome_adm/unix/config_files/check_sip.m4 @@ -28,10 +28,17 @@ else sip_vers=new ;; 3.5*) sip_vers=new ;; + 3.6*) + sip_vers=new ;; + 3.7*) + sip_vers=new ;; + 3.8*) + sip_vers=new ;; + 3.9*) + sip_vers=new ;; *) sip_vers=no ;; esac - sip_ok=no if test "x$sip_vers" = "xold" @@ -44,11 +51,11 @@ else if test "x$sip_vers" = "xnew" then - if test -d ${SIPDIR}/include ; then - sip_ok=yes + sip_ok=yes + if test -d ${SIPDIR}/include/python${PYTHON_VERSION} ; then SIP_ROOT="$SIPDIR" - SIP_INCLUDES="${PYTHON_INCLUDES} -I${SIPDIR}/include" - SIP_LIBS="-L${SIPDIR}/lib -lsip" + SIP_INCLUDES="${PYTHON_INCLUDES} -I${SIPDIR}/include/python${PYTHON_VERSION}" + SIP_LIBS="-L${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages -lsip" else sip_ok=yes SIP_ROOT="$SIPDIR" diff --git a/salome_adm/unix/config_files/check_vtk.m4 b/salome_adm/unix/config_files/check_vtk.m4 index 1b1a8d1a1..4b4b1454f 100644 --- a/salome_adm/unix/config_files/check_vtk.m4 +++ b/salome_adm/unix/config_files/check_vtk.m4 @@ -48,10 +48,16 @@ then AC_MSG_WARN(vtk needs OpenGL correct configuration, check configure output) fi +if test "x$x_libraries" != "x" +then + LXLIB="-L$x_libraries" +else + LXLIB="" +fi LOCAL_INCLUDES="$OGL_INCLUDES" -LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid $OGL_LIBS -L$x_libraries -lX11 -lXt" -TRY_LINK_LIBS="-lvtkCommon $OGL_LIBS -L$x_libraries -lX11 -lXt" +LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid $OGL_LIBS $LXLIB -lX11 -lXt" +TRY_LINK_LIBS="-lvtkCommon $OGL_LIBS $LXLIB -lX11 -lXt" if test -z $VTKHOME then @@ -64,7 +70,7 @@ fi dnl vtk headers CPPFLAGS_old="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES -Wno-deprecated" +CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES" AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no") @@ -82,7 +88,7 @@ AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no") # LIBS="$LIBS $TRY_LINK_LIBS" LIBS="$LIBS $LOCAL_LIBS" CPPFLAGS_old="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $VTK_INCLUDES -Wno-deprecated" + CPPFLAGS="$CPPFLAGS $VTK_INCLUDES" dnl VTKPY_MODULES="$VTKHOME/python" diff --git a/salome_adm/unix/config_files/production.m4 b/salome_adm/unix/config_files/production.m4 index b115b8aab..1cebe979e 100644 --- a/salome_adm/unix/config_files/production.m4 +++ b/salome_adm/unix/config_files/production.m4 @@ -53,16 +53,25 @@ no) enable_production=no ;; esac], enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl -CXXFLAGS="$CXXFLAGS -Wno-deprecated -Wparentheses -Wreturn-type -Wmissing-declarations -Wunused " +# portage alpha/OSF +# CXXFLAGS="$CXXFLAGS -Wno-deprecated -Wparentheses -Wreturn-type -Wmissing-declarations -Wunused " +echo $CXX +AC_CXX_OPTION(-Wparentheses,CXXFLAGS) +AC_CXX_OPTION(-Wreturn-type,CXXFLAGS) +AC_CXX_OPTION(-Wmissing-declarations,CXXFLAGS) +AC_CXX_OPTION(-Wunused,CXXFLAGS) -CXXVERSION=`$CXX --version` -if test "X$CXXVERSION" != "X2.95.3"; then - CXXFLAGS="${CXXFLAGS} -fmessage-length=0 " -fi +# supprimer car ne marche qu'avec compilo gnu +# CXXVERSION=`$CXX --version` +# if test "X$CXXVERSION" != "X2.95.3"; then +# CXXFLAGS="${CXXFLAGS} -fmessage-length=0 " +# fi if test "X$enable_production" = "Xyes"; then CFLAGS="$CFLAGS -O" - CXXFLAGS="$CXXFLAGS -O -Wuninitialized " +# CXXFLAGS="$CXXFLAGS -O -Wuninitialized " + AC_CXX_OPTION(-Wuninitialized,CXXFLAGS) + CXXFLAGS="$CXXFLAGS -O " fi ]) diff --git a/salome_adm/unix/config_files/python.m4 b/salome_adm/unix/config_files/python.m4 index b86c21d35..b99b9d138 100644 --- a/salome_adm/unix/config_files/python.m4 +++ b/salome_adm/unix/config_files/python.m4 @@ -126,8 +126,8 @@ fi]) AC_MSG_CHECKING([if we need libdb]) PY_NEEDOPENDB=`nm $PYTHON_LIBA | grep dbopen | grep U` if test "x$PY_NEEDOPENDB" != "x"; then - PYTHON_LIBS="$PYTHON_LIBS -ldb" AC_MSG_RESULT(yes) + AC_CHECK_LIB(db,dbopen,PYTHON_LIBS="$PYTHON_LIBS -ldb",db_ok=no) else AC_MSG_RESULT(no) fi @@ -135,8 +135,8 @@ fi]) AC_MSG_CHECKING([if we need libdl]) PY_NEEDOPENDL=`nm $PYTHON_LIBA | grep dlopen | grep U` if test "x$PY_NEEDOPENDL" != "x"; then - PYTHON_LIBS="$PYTHON_LIBS -ldl" AC_MSG_RESULT(yes) + AC_CHECK_LIB(dl,dlopen,PYTHON_LIBS="$PYTHON_LIBS -ldl",dl_ok=no) else AC_MSG_RESULT(no) fi @@ -144,8 +144,8 @@ fi]) AC_MSG_CHECKING([if we need libutil]) PY_NEEDOPENPTY=`nm $PYTHON_LIBA | grep openpty | grep U` if test "x$PY_NEEDOPENPTY" != "x"; then - PYTHON_LIBS="$PYTHON_LIBS -lutil" AC_MSG_RESULT(yes) + AC_CHECK_LIB(util,openpty,PYTHON_LIBS="$PYTHON_LIBS -lutil",openpty_ok=no) else AC_MSG_RESULT(no) fi @@ -153,8 +153,8 @@ fi]) AC_MSG_CHECKING([if we need tcltk]) PY_NEEDTCLTK=`nm $PYTHON_LIBA | grep Tcl_Init | grep U` if test "x$PY_NEEDTCLTK" != "x"; then - PYTHON_LIBS="$PYTHON_LIBS -ltcl -ltk" AC_MSG_RESULT(yes) + AC_CHECK_LIB(tcl,Tcl_Init,PYTHON_LIBS="$PYTHON_LIBS -ltcl -ltk",tclinit_ok=no) else AC_MSG_RESULT(no) fi diff --git a/salome_adm/unix/make_commence.in b/salome_adm/unix/make_commence.in index e42171246..e294c2f1c 100644 --- a/salome_adm/unix/make_commence.in +++ b/salome_adm/unix/make_commence.in @@ -2,7 +2,8 @@ inc_builddir=$(top_builddir)/include/salome @SET_MAKE@ -SHELL=/bin/sh +# Modifcation B. Secher portage sur osf +SHELL=@SHELL@ # header missing @@ -10,9 +11,10 @@ HAVE_SSTREAM=@HAVE_SSTREAM@ LIBS=@LIBS@ -LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome +# LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome +LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome # add libstdc++ to link c++ library with libtool ! -LDFLAGS+= -lstdc++ +LDFLAGS+= @STDLIB@ CP=@CP@ diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index e960a3b83..6a65dcb3c 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -91,7 +91,7 @@ protected: std::map remove_map ; omni_mutex _numInstanceMutex ; // if several threads on the same object -private: + //private: int _argc ; char** _argv ; diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index 2338fe34c..23b4e8797 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -55,7 +55,7 @@ protected: SALOME_NamingService *_NS; Engines::Container_var _FactoryServer ; -private: + //private: std::string ContainerName( const char * aComputerContainer , std::string * theComputer , std::string * theContainer ) ; diff --git a/src/MPIContainer/MPIContainer_i.cxx b/src/MPIContainer/MPIContainer_i.cxx index e02449626..ad729c45a 100644 --- a/src/MPIContainer/MPIContainer_i.cxx +++ b/src/MPIContainer/MPIContainer_i.cxx @@ -28,26 +28,34 @@ #include #include #include "MPIContainer_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_SINGLETON.hxx" +#include "OpUtil.hxx" #include "utilities.h" using namespace std; -MPIContainer_i::MPIContainer_i(int nbproc, int numproc, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - char * containerName) - : Engines_Container_i(orb,poa,containerName,0,0), MPIObject_i(nbproc,numproc) +// L'appel au registry SALOME ne se fait que pour le process 0 +Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc, + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + char * containerName, + int argc, char *argv[]) + : Engines_Container_i(orb,poa,containerName,argc,argv,false,false), MPIObject_i(nbproc,numproc) { + MESSAGE("[" << numproc << "] activate object"); _id = _poa->activate_object(this); - MESSAGE("[" << _numproc << "] containerName=" << _containerName); - if( _numproc == 0 ){ + if(numproc==0){ + + // _NS = new SALOME_NamingService(_orb); _NS = SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()) ; _NS->init_orb( orb ) ; Engines::Container_ptr pCont = Engines::Container::_narrow(POA_Engines::MPIContainer::_this()); - _NS->Register(pCont, _containerName.c_str()); + SCRUTE(_containerName); + _NS->Register(pCont, _containerName.c_str()); } // Root recupere les ior des container des autre process @@ -55,52 +63,176 @@ MPIContainer_i::MPIContainer_i(int nbproc, int numproc, BCastIOR(_orb,pobj,true); } -MPIContainer_i::~MPIContainer_i(void) +Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc) + : Engines_Container_i(), MPIObject_i(nbproc,numproc) { +} + +Engines_MPIContainer_i::~Engines_MPIContainer_i(void) +{ + MESSAGE("[" << _numproc << "] Engines_MPIContainer_i::~Engines_MPIContainer_i()"); if( !handle_map.empty() ){ - MESSAGE("[" << _numproc << "] MPIContainer_i::~MPIContainer_i: warning destroy a not empty container"); + MESSAGE("[" << _numproc << "] Engines_MPIContainer_i::~Engines_MPIContainer_i: warning destroy a not empty container"); + } +} + +// Start MPI Container +Engines::MPIContainer_ptr Engines_MPIContainer_i::start_MPIimpl( + const char* ContainerName, + CORBA::Short nbproc ) +{ + + char nbp[1024]; + + MESSAGE("[" << _numproc << "] start_impl argc " << _argc << " ContainerName " << ContainerName + << hex << this << dec) ; + _numInstanceMutex.lock() ; // lock on the instance number + + CORBA::Object_var obj = Engines::MPIContainer::_nil() ; + bool nilvar = true ; + try { + string cont("/Containers/"); + cont += machineName() ; + cont += "/" ; + cont += ContainerName; + INFOS("[" << _numproc << "] " << machineName() << " start_impl unknown container " << cont.c_str() + << " try to Resolve" ); + obj = _NS->Resolve( cont.c_str() ); + nilvar = CORBA::is_nil( obj ) ; + if ( nilvar ) { + INFOS("[" << _numproc << "] " << machineName() << " start_impl unknown container " + << ContainerName); + } + } + catch (ServiceUnreachable&) { + INFOS("[" << _numproc << "] " << machineName() << "Caught exception: Naming Service Unreachable"); + } + catch (...) { + INFOS("[" << _numproc << "] " << machineName() << "Caught unknown exception."); + } + if ( !nilvar ) { + _numInstanceMutex.unlock() ; + MESSAGE("[" << _numproc << "] start_impl container found without new launch") ; + return Engines::MPIContainer::_narrow(obj); + } + int i = 0 ; + while ( _argv[ i ] ) { + MESSAGE("[" << _numproc << "] argv" << i << " " << _argv[ i ]) ; + i++ ; + } + sprintf(nbp,"mpirun -np %d SALOME_MPIContainer ",nbproc); + string shstr(nbp); + shstr += ContainerName ; + if ( _argc == 4 ) { + shstr += " " ; + shstr += _argv[ 2 ] ; + shstr += " " ; + shstr += _argv[ 3 ] ; + } + shstr += " > /tmp/" ; + shstr += ContainerName ; + shstr += ".log 2>&1 &" ; + MESSAGE("system(" << shstr << ")") ; + int status = system( shstr.c_str() ) ; + if (status == -1) { + INFOS("[" << _numproc << "] Engines_MPIContainer_i::start_impl SALOME_MPIContainer failed (system command status -1)") ; + } + else if (status == 217) { + INFOS("[" << _numproc << "] Engines_MPIContainer_i::start_impl SALOME_MPIContainer failed (system command status 217)") ; } + INFOS("[" << _numproc << "] " << machineName() << " Engines_MPIContainer_i::start_impl SALOME_MPIContainer launch done"); + + obj = Engines::MPIContainer::_nil() ; + try { + string cont("/Containers/"); + cont += machineName() ; + cont += "/" ; + cont += ContainerName; + nilvar = true ; + int count = 20 ; + while ( nilvar && count >= 0) { + sleep( 1 ) ; + obj = _NS->Resolve(cont.c_str()); + nilvar = CORBA::is_nil( obj ) ; + if ( nilvar ) { + INFOS("[" << _numproc << "] " << count << ". " << machineName() + << " start_impl unknown container " << cont.c_str()); + count -= 1 ; + } + } + _numInstanceMutex.unlock() ; + if ( !nilvar ) { + MESSAGE("[" << _numproc << "] start_impl container found after new launch of SALOME_MPIContainer") ; + } + return Engines::MPIContainer::_narrow(obj); + } + catch (ServiceUnreachable&) { + INFOS("[" << _numproc << "] " << machineName() << "Caught exception: Naming Service Unreachable"); + } + catch (...) { + INFOS("[" << _numproc << "] " << machineName() << "Caught unknown exception."); + } + _numInstanceMutex.unlock() ; + MESSAGE("[" << _numproc << "] start_impl MPI container not found after new launch of SALOME_MPIContainer") ; + return Engines::MPIContainer::_nil() ; } // Load component -Engines::Component_ptr MPIContainer_i::load_impl(const char* nameToRegister, +Engines::Component_ptr Engines_MPIContainer_i::load_impl(const char* nameToRegister, const char* componentName) { int ip; - Engines::Component_var iobject; - Engines::MPIObject_var pobj; - char cproc[4]; if( _numproc == 0 ){ // Invocation du chargement du composant dans les autres process for(ip= 1;ip<_nbproc;ip++) - (Engines::MPIContainer::_narrow((*_tior)[ip]))->load_impl(nameToRegister, + (Engines::MPIContainer::_narrow((*_tior)[ip]))->SPload_impl(nameToRegister, componentName); } + return Lload_impl(nameToRegister,componentName); + +} + +// Load component +void Engines_MPIContainer_i::SPload_impl(const char* nameToRegister, + const char* componentName) +{ + Lload_impl(nameToRegister,componentName); +} + +Engines::Component_ptr Engines_MPIContainer_i::Lload_impl( + const char* nameToRegister, + const char* componentName) +{ + Engines::Component_var iobject; + Engines::MPIObject_var pobj; + char cproc[4]; + sprintf(cproc,"_%d",_numproc); - BEGIN_OF("[" << _numproc << "] MPIContainer_i::load_impl"); + BEGIN_OF("[" << _numproc << "] MPIContainer_i::Lload_impl"); _numInstanceMutex.lock() ; // lock on the instance number _numInstance++ ; char _aNumI[12]; sprintf(_aNumI,"%d",_numInstance) ; - _numInstanceMutex.unlock() ; string _impl_name = componentName; - string instanceName = string(nameToRegister) + "_inst_" + _aNumI + cproc; + string _nameToRegister = nameToRegister; + string instanceName = _nameToRegister + "_inst_" + _aNumI + cproc; + MESSAGE("[" << _numproc << "] instanceName=" << instanceName); string absolute_impl_name(_impl_name); MESSAGE("[" << _numproc << "] absolute_impl_name=" << absolute_impl_name); void * handle = dlopen(absolute_impl_name.c_str(), RTLD_LAZY); if(!handle){ - MESSAGE("[" << _numproc << "] Can't load shared library : " << absolute_impl_name); - MESSAGE("[" << _numproc << "] error dlopen: " << dlerror()); + INFOS("[" << _numproc << "] Can't load shared library : " << absolute_impl_name); + INFOS("[" << _numproc << "] error dlopen: " << dlerror()); return Engines::Component::_nil() ; } - string factory_name = string(nameToRegister) + string("Engine_factory"); + string factory_name = _nameToRegister + string("Engine_factory"); MESSAGE("[" << _numproc << "] factory_name=" << factory_name) ; PortableServer::ObjectId * (*MPIComponent_factory) (int,int, @@ -121,6 +253,7 @@ Engines::Component_ptr MPIContainer_i::load_impl(const char* nameToRegister, if ((error = dlerror()) != NULL){ // Try to load a sequential component MESSAGE("[" << _numproc << "] Try to load a sequential component"); + _numInstanceMutex.unlock() ; iobject = Engines_Container_i::load_impl(nameToRegister,componentName); if( CORBA::is_nil(iobject) ) return Engines::Component::_duplicate(iobject); } @@ -128,32 +261,32 @@ Engines::Component_ptr MPIContainer_i::load_impl(const char* nameToRegister, // Instanciation du composant parallele MESSAGE("[" << _numproc << "] Try to load a parallel component"); PortableServer::ObjectId * id = (MPIComponent_factory) - (_nbproc,_numproc,_orb, _poa, _id, instanceName.c_str(), nameToRegister); + (_nbproc,_numproc,_orb, _poa, _id, instanceName.c_str(), _nameToRegister.c_str()); // get reference from id CORBA::Object_var o = _poa->id_to_reference(*id); pobj = Engines::MPIObject::_narrow(o) ; - iobject = Engines::Component::_narrow(pobj) ; + iobject = Engines::Component::_narrow(o) ; } - // Root recupere les ior des composants des autre process - BCastIOR(_orb,pobj,false); - if( _numproc == 0 ){ // utiliser + tard le registry ici : // register the engine under the name containerName.dir/nameToRegister.object - string component_registerName = _containerName + "/" + nameToRegister; + string component_registerName = _containerName + "/" + _nameToRegister; _NS->Register(iobject, component_registerName.c_str()) ; } - _numInstanceMutex.lock() ; // lock on the add on handle_map (necessary ?) handle_map[instanceName] = handle; _numInstanceMutex.unlock() ; - END_OF("[" <<_numproc << "] MPIContainer_i::load_impl"); + + // Root recupere les ior des composants des autre process + BCastIOR(_orb,pobj,false); + + END_OF("[" <<_numproc << "] MPIContainer_i::Lload_impl"); return Engines::Component::_duplicate(iobject); } -void MPIContainer_i::remove_impl(Engines::Component_ptr component_i) +void Engines_MPIContainer_i::remove_impl(Engines::Component_ptr component_i) { int ip; Engines::Component_ptr cptr; @@ -168,10 +301,29 @@ void MPIContainer_i::remove_impl(Engines::Component_ptr component_i) for(ip= 1;ip<_nbproc;ip++){ spcptr = Engines::MPIObject::_narrow((*(pcptr->tior()))[ip]); cptr = (Engines::Component_ptr)spcptr; - (Engines::MPIContainer::_narrow((*_tior)[ip]))->remove_impl(cptr); + (Engines::MPIContainer::_narrow((*_tior)[ip]))->SPremove_impl(cptr); } } + Lremove_impl(component_i); +} + +void Engines_MPIContainer_i::SPremove_impl(Engines::Component_ptr component_i) +{ + Lremove_impl(component_i); +} + +void Engines_MPIContainer_i::Lremove_impl(Engines::Component_ptr component_i) +{ + int ip; + Engines::Component_ptr cptr; + Engines::MPIObject_ptr pcptr; + Engines::MPIObject_ptr spcptr; + + BEGIN_OF("[" << _numproc << "] MPIContainer_i::Lremove_impl"); + + ASSERT(! CORBA::is_nil(component_i)); + string instanceName = component_i->instanceName() ; MESSAGE("[" << _numproc << "] unload component " << instanceName); component_i->destroy() ; @@ -190,29 +342,45 @@ void MPIContainer_i::remove_impl(Engines::Component_ptr component_i) { MESSAGE("[" << _numproc << "] stay " << (*im).first); } + + END_OF("[" << _numproc << "] MPIContainer_i::Lremove_impl"); + } -void MPIContainer_i::finalize_removal() +void Engines_MPIContainer_i::finalize_removal() { int ip; - MESSAGE("[" << _numproc << "] finalize unload : dlclose"); - if( _numproc == 0 ){ // Invocation de la destruction du composant dans les autres process for(ip= 1;ip<_nbproc;ip++) - (Engines::MPIContainer::_narrow((*_tior)[ip]))->finalize_removal(); + (Engines::MPIContainer::_narrow((*_tior)[ip]))->SPfinalize_removal(); } + Lfinalize_removal(); +} + +void Engines_MPIContainer_i::SPfinalize_removal() +{ + Lfinalize_removal(); +} + +void Engines_MPIContainer_i::Lfinalize_removal() +{ + BEGIN_OF("[" << _numproc << "] MPIContainer_i::Lfinalize_removal"); + map::iterator im ; - _numInstanceMutex.lock() ; // lock on the explore remove_map & dlclose + // lock on the explore remove_map & dlclose + _numInstanceMutex.lock() ; for (im = remove_map.begin() ; im != remove_map.end() ; im ++) { void * handle = (*im).second ; - dlclose(handle) ; MESSAGE("[" << _numproc << "] dlclose " << (*im).first); + dlclose(handle) ; } + MESSAGE("[" << _numproc << "] remove_map.clear()"); remove_map.clear() ; _numInstanceMutex.unlock() ; - MESSAGE("[" << _numproc << "] remove_map.clear()"); + + END_OF("[" << _numproc << "] MPIContainer_i::Lfinalize_removal"); } diff --git a/src/MPIContainer/MPIContainer_i.hxx b/src/MPIContainer/MPIContainer_i.hxx index 390f6ce73..7d9ddc9a2 100644 --- a/src/MPIContainer/MPIContainer_i.hxx +++ b/src/MPIContainer/MPIContainer_i.hxx @@ -28,34 +28,55 @@ #define _SALOME_PCONTAINER_ #include -#include CORBA_SERVER_HEADER(MPIContainer) +#include CORBA_SERVER_HEADER(SALOME_MPIContainer) #include "SALOME_Container_i.hxx" -#include "SALOME_NamingService.hxx" -#include "Utils_SINGLETON.hxx" -#include "OpUtil.hxx" #include "MPIObject_i.hxx" -class MPIContainer_i : public POA_Engines::MPIContainer, - public Engines_Container_i, - public MPIObject_i +class Engines_MPIContainer_i : public POA_Engines::MPIContainer, + public Engines_Container_i, + public MPIObject_i { public: // Constructor - MPIContainer_i( int nbproc, int numproc, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - char * containerName); + Engines_MPIContainer_i( int nbproc, int numproc, + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + char * containerName, + int argc, char *argv[]); + Engines_MPIContainer_i(int nbproc, int numproc); // Destructor - ~MPIContainer_i(); + ~Engines_MPIContainer_i(); - // Load a component + // Launch a new MPI container from the current container + Engines::MPIContainer_ptr start_MPIimpl(const char* ContainerName, + CORBA::Short nbproc); + + // Load a component in current MPI container + // synchronous version for process 0 Engines::Component_ptr load_impl(const char* nameToRegister, const char* componentName); + // asynchronous version for other process + void SPload_impl(const char* nameToRegister, const char* componentName); - // Unload a component + // Unload a component from current MPI container + // synchronous version for process 0 void remove_impl(Engines::Component_ptr component_i); + // asynchronous version for other process + void SPremove_impl(Engines::Component_ptr component_i); + + // synchronous version for process 0 void finalize_removal(); + // asynchronous version for other process + void SPfinalize_removal(); + + private: + // local version to not duplicate code + // called by synchronous and asynchronous version + Engines::Component_ptr Lload_impl(const char* nameToRegister, + const char* componentName); + void Lremove_impl(Engines::Component_ptr component_i); + void Lfinalize_removal(); }; #endif diff --git a/src/MPIContainer/MPIObject_i.cxx b/src/MPIContainer/MPIObject_i.cxx index c32e204bd..0da19e33c 100644 --- a/src/MPIContainer/MPIObject_i.cxx +++ b/src/MPIContainer/MPIObject_i.cxx @@ -31,8 +31,8 @@ using namespace std; MPIObject_i::MPIObject_i() { - _nbproc = 1; - _numproc = 0; + MPI_Comm_size( MPI_COMM_WORLD, &_nbproc ); + MPI_Comm_rank( MPI_COMM_WORLD, &_numproc ); _tior=NULL; } @@ -50,11 +50,11 @@ MPIObject_i::~MPIObject_i() Engines::IORTab* MPIObject_i::tior() { - Engines::IORTab* tior = new Engines::IORTab; + Engines::IORTab_var tior = new Engines::IORTab; tior->length(_tior->length()); for(unsigned int ip=0;iplength();ip++) - (*tior)[ip] = (*_tior)[ip]; - return tior; + tior[ip] = (*_tior)[ip]; + return tior._retn(); }; void MPIObject_i::tior(const Engines::IORTab& ior) @@ -65,23 +65,20 @@ void MPIObject_i::tior(const Engines::IORTab& ior) (*_tior)[ip] = ior[ip]; } -void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_var pobj, +void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj, bool amiCont) { int err, ip, n; char *ior; MPI_Status status; /* status de reception de message MPI */ - // Conversion IOR vers string - CORBA::String_var sior(orb->object_to_string(pobj)); - if( _numproc == 0 ){ //Allocation du tableau des IOR - Engines::IORTab *iort = new Engines::IORTab; + Engines::IORTab_var iort = new Engines::IORTab; iort->length(_nbproc); - (*iort)[0] = pobj; + iort[0] = pobj; // Process 0 recupere les ior de l'object sur les autres process for(ip=1;ip<_nbproc;ip++){ @@ -91,35 +88,38 @@ void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_var pobj, exit(1); } // Allocation de la chaine de longueur n - ior = (char*)calloc(n,sizeof(char)); + ior = new char[n]; err = MPI_Recv(ior,n,MPI_CHAR,ip,2*ip,MPI_COMM_WORLD,&status); if(err){ MESSAGE("[" << _numproc << "] MPI_RECV error"); exit(1); } - (*iort)[ip] = Engines::MPIObject::_narrow(orb->string_to_object(ior)); - free(ior); + iort[ip] = orb->string_to_object(ior); + delete [] ior; } // On donne le tableau des ior a l'objet Corba du process 0 if( amiCont ) - tior(*iort); + tior(*(iort._retn())); else - pobj->tior(*iort); + pobj->tior(*(iort._retn())); } else{ + // Conversion IOR vers string + ior = orb->object_to_string(pobj); + n = strlen(ior) + 1; // On envoie l'IOR au process 0 - n = strlen((char*)sior); err = MPI_Send(&n,1,MPI_INT,0,_numproc,MPI_COMM_WORLD); if(err){ MESSAGE("[" << _numproc << "] MPI_SEND error"); exit(1); } - err = MPI_Send((char*)sior,n,MPI_CHAR,0,2*_numproc,MPI_COMM_WORLD); + err = MPI_Send(ior,n,MPI_CHAR,0,2*_numproc,MPI_COMM_WORLD); if(err){ MESSAGE("[" << _numproc << "] MPI_SEND error"); exit(1); } + CORBA::string_free(ior); } } diff --git a/src/MPIContainer/MPIObject_i.hxx b/src/MPIContainer/MPIObject_i.hxx index e504bb829..d15a1b4d5 100644 --- a/src/MPIContainer/MPIObject_i.hxx +++ b/src/MPIContainer/MPIObject_i.hxx @@ -28,7 +28,7 @@ #define _SALOME_POBJECT_I_H_ #include -#include CORBA_SERVER_HEADER(MPIObject) +#include CORBA_SERVER_HEADER(SALOME_MPIObject) class MPIObject_i: public POA_Engines::MPIObject { @@ -48,7 +48,7 @@ class MPIObject_i: public POA_Engines::MPIObject // IOR des objets paralleles sur tous les process mpi Engines::IORTab* _tior; // Echange des IOR de l'objet entre process - void BCastIOR(CORBA::ORB_ptr orb,Engines::MPIObject_var pobj,bool amiCont); + void BCastIOR(CORBA::ORB_ptr orb,Engines::MPIObject_ptr pobj,bool amiCont); } ; #endif diff --git a/src/MPIContainer/Makefile.in b/src/MPIContainer/Makefile.in index 5576a570a..ae1ab2757 100644 --- a/src/MPIContainer/Makefile.in +++ b/src/MPIContainer/Makefile.in @@ -44,15 +44,19 @@ EXPORT_HEADERS = \ LIB = libSalomeMPIContainer.la LIB_SRC = MPIObject_i.cxx MPIContainer_i.cxx -LIB_SERVER_IDL = TypeData.idl MPIObject.idl MPIContainer.idl +LIB_SERVER_IDL = SALOME_MPIObject.idl SALOME_MPIContainer.idl # Executables targets BIN = SALOME_MPIContainer BIN_SRC = -BIN_SERVER_IDL = TypeData.idl MPIObject.idl MPIContainer.idl +BIN_SERVER_IDL = SALOME_MPIObject.idl SALOME_MPIContainer.idl -CXXFLAGS+=${MPI_INCLUDES} -CXX_DEPEND_FLAG+=${MPI_INCLUDES} -LDFLAGS+= -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil ${MPI_LIBS} +LDFLAGS+= -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace + +ifeq (@WITHMPI@,yes) + CXXFLAGS+=${MPI_INCLUDES} + CXX_DEPEND_FLAG+=${MPI_INCLUDES} + LDFLAGS+= ${MPI_LIBS} +endif @CONCLUDE@ diff --git a/src/MPIContainer/SALOME_MPIContainer.cxx b/src/MPIContainer/SALOME_MPIContainer.cxx index 5f008c70c..d6fb4474f 100644 --- a/src/MPIContainer/SALOME_MPIContainer.cxx +++ b/src/MPIContainer/SALOME_MPIContainer.cxx @@ -1,54 +1,31 @@ -// SALOME MPIContainer : implemenation of container based on MPI libraries -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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. -// -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOME_MPIContainer.cxx -// Module : SALOME - #include #include "MPIContainer_i.hxx" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" #include "utilities.h" -#include "LocalTraceCollector.hxx" #include using namespace std; int main(int argc, char* argv[]) { - LocalTraceCollector *myThreadTrace = LocalTraceCollector::instance(); int nbproc, numproc; - MPIContainer_i * myContainer; + int flag; + Engines_MPIContainer_i * myContainer=NULL; BEGIN_OF(argv[0]) try { MESSAGE("Connection MPI"); - MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nbproc); MPI_Comm_rank(MPI_COMM_WORLD,&numproc); - MESSAGE("Initialisation CORBA"); + MESSAGE("[" << numproc << "] Initialisation CORBA"); // Initialise the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + // CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + CORBA::ORB_var &orb = init( argc , argv ) ; // Obtain a reference to the root POA. CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); @@ -88,37 +65,37 @@ int main(int argc, char* argv[]) containerName = argv[1] ; } - MESSAGE("Chargement container sur proc: " << numproc); - myContainer = new MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName); - MESSAGE("Fin chargement container"); + MESSAGE("[" << numproc << "] Chargement container"); + myContainer = new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv); pman->activate(); orb->run(); orb->destroy(); - delete myContainer; - MPI_Finalize(); } - catch(CORBA::SystemException&) { - INFOS("Caught CORBA::SystemException.") + catch(CORBA::SystemException&){ + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::WrongPolicy&){ + INFOS("Caught CORBA::WrongPolicyException."); } - catch(PortableServer::POA::WrongPolicy&) - { - INFOS("Caught CORBA::WrongPolicyException.") + catch(PortableServer::POA::ServantAlreadyActive&){ + INFOS("Caught CORBA::ServantAlreadyActiveException"); } - catch(PortableServer::POA::ServantAlreadyActive&) - { - INFOS("Caught CORBA::ServantAlreadyActiveException") + catch(CORBA::Exception&){ + INFOS("Caught CORBA::Exception."); } - catch(CORBA::Exception&) { - INFOS("Caught CORBA::Exception.") + catch(...){ + INFOS("Caught unknown exception."); } - catch(...) { - INFOS("Caught unknown exception.") - } + + if(myContainer) + delete myContainer; + MPI_Initialized(&flag); + if(flag) + MPI_Finalize(); + END_OF(argv[0]); - delete myThreadTrace; - return 0; } diff --git a/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx b/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx index cfa9f4c77..9d342ca32 100644 --- a/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx +++ b/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx @@ -41,15 +41,15 @@ SALOME_MPILifeCycleCORBA::~SALOME_MPILifeCycleCORBA() } Engines::MPIContainer_var SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer( - const string theComputer , - const string theMPIContainerRoot, + const std::string theComputer , + const std::string theMPIContainerRoot, const int nbproc) { char nbp[1024]; sprintf(nbp,"_%d",nbproc); - string theMPIContainer = theMPIContainerRoot + nbp; - string aComputerContainer = theComputer + "/" + theMPIContainer; + std::string theMPIContainer = theMPIContainerRoot + nbp; + std::string aComputerContainer = theComputer + "/" + theMPIContainer; SCRUTE( aComputerContainer ) ; SCRUTE( theComputer ) ; @@ -72,7 +72,7 @@ Engines::MPIContainer_var SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer( if ( !strcmp( &theMPIContainerRoot.c_str()[len-2] , "Py" ) ) { pyCont = true ; } - string MPIFactoryServer = theComputer ; + std::string MPIFactoryServer = theComputer ; if ( pyCont ) { MPIFactoryServer += "/MPIFactoryServerPy" ; } @@ -85,13 +85,13 @@ Engines::MPIContainer_var SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer( // On n'a pas trouve le container generique: on lance le container demande if ( CORBA::is_nil( aMPIFactoryServer ) ) { // rsh -n ikkyo /export/home/rahuel/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515 & - string rsh( "" ) ; + std::string rsh( "" ) ; if ( theComputer!= GetHostname() ) { rsh += "rsh -n " ; rsh += theComputer ; rsh += " " ; } - string path = ComputerPath( theComputer.c_str() ) ; + std::string path = ComputerPath( theComputer.c_str() ) ; SCRUTE( path ) ; // rsh += "runSession " ; if ( pyCont ) { @@ -105,7 +105,7 @@ Engines::MPIContainer_var SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer( rsh += nbp; rsh += theMPIContainer +" -" ; } - string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ; + std::string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ; ifstream omniORBfile( omniORBcfg.c_str() ) ; char ORBInitRef[12] ; char nameservice[132] ; diff --git a/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.hxx b/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.hxx index dfac11034..e560a072e 100644 --- a/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.hxx +++ b/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.hxx @@ -36,8 +36,8 @@ protected: Engines::MPIContainer_var _MPIFactoryServer ; private: - Engines::MPIContainer_var FindOrStartMPIContainer(const string theComputer , - const string theMPIContainerRoot, + Engines::MPIContainer_var FindOrStartMPIContainer(const std::string theComputer , + const std::string theMPIContainerRoot, const int nbproc) ; } ; diff --git a/src/Makefile.in b/src/Makefile.in index 684d62305..d40b8e22b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -45,7 +45,7 @@ SUBDIRS = MSG2QM SALOMELocalTrace Logger Utils CASCatch PatchQt \ RegistryDisplay ModuleGenerator SALOME_PYQT Loader Communication ifeq (@mpi_ok@,yes) - SUBDIRS+= MPIContainer + SUBDIRS+= MPIContainer MPILifeCycleCORBA TestMPIContainer endif ifeq (@WITHOPENPBS@,yes) diff --git a/src/PatchQt/qsplitterP.cxx b/src/PatchQt/qsplitterP.cxx index fd2a7fc5c..cbe25a691 100644 --- a/src/PatchQt/qsplitterP.cxx +++ b/src/PatchQt/qsplitterP.cxx @@ -41,7 +41,6 @@ ** **********************************************************************/ -using namespace std; #include "qsplitterP.h" #ifndef QT_NO_COMPLEXWIDGETS @@ -61,6 +60,7 @@ using namespace std; #include #include //sendPostedEvents +using namespace std; #define SPLITTER_ICON_WIDTH 10 #define SPLITTER_ICON_HEIGHT 12 diff --git a/src/PatchQt/qworkspaceP.cxx b/src/PatchQt/qworkspaceP.cxx index f73e73927..1a959ae47 100644 --- a/src/PatchQt/qworkspaceP.cxx +++ b/src/PatchQt/qworkspaceP.cxx @@ -41,7 +41,6 @@ ** **********************************************************************/ -using namespace std; #include "qworkspaceP.h" #include @@ -73,6 +72,7 @@ using namespace std; #include #include +using namespace std; #define BUTTON_WIDTH 16 #define BUTTON_HEIGHT 14 diff --git a/src/Utils/Utils_CorbaException.hxx b/src/Utils/Utils_CorbaException.hxx index d785f16d1..44d642b86 100644 --- a/src/Utils/Utils_CorbaException.hxx +++ b/src/Utils/Utils_CorbaException.hxx @@ -45,9 +45,9 @@ throw SALOME::SALOME_Exception(ExDescription); \ } -#include +#include //Dump the CORBA exception type. -static ostream& operator<<(ostream& os, const CORBA::Exception& e) +static std::ostream& operator<<(std::ostream& os, const CORBA::Exception& e) { CORBA::Any tmp; tmp<<= e; diff --git a/src/Utils/Utils_SignalsHandler.cxx b/src/Utils/Utils_SignalsHandler.cxx index d8af06d92..a76eb3eaf 100644 --- a/src/Utils/Utils_SignalsHandler.cxx +++ b/src/Utils/Utils_SignalsHandler.cxx @@ -88,7 +88,8 @@ Utils_SignalsHandler::Utils_SignalsHandler() StoreSignalHandler(mySigHandlerCont,SIGTERM); // termination StoreSignalHandler(mySigHandlerCont,SIGSEGV); // segmentation //StoreSignalHandler(mySigHandlerCont,SIGABRT); // abort (ANSI). - StoreSignalHandler(mySigHandlerCont,SIGSTKFLT); // stack fault. + // portage CCRT + // StoreSignalHandler(mySigHandlerCont,SIGSTKFLT); // stack fault. } diff --git a/src/Utils/Utils_Timer.cxx b/src/Utils/Utils_Timer.cxx index 74a64bac7..67153429e 100644 --- a/src/Utils/Utils_Timer.cxx +++ b/src/Utils/Utils_Timer.cxx @@ -25,7 +25,7 @@ // Module : SALOME # include "Utils_Timer.hxx" -# include +# include #include "utilities.h" using namespace std;