From 5e0224ce76dad929130fa04e84e74a782229a2dd Mon Sep 17 00:00:00 2001 From: prascle Date: Mon, 28 Jan 2008 22:03:05 +0000 Subject: [PATCH] merge from BR_For40_DSC 28 jan 08 --- bin/appli_gen.py | 10 + bin/orbmodule.py | 2 +- bin/server.py | 4 +- idl/Makefile.am | 19 +- idl/SALOME_Component.idl | 2 +- idl/SALOME_ModuleCatalog.idl | 34 ++- resources/CatalogResources.xml.in | 41 +-- resources/KERNELCatalog.xml.in | 1 + salome_adm/unix/Makefile.am | 1 - salome_adm/unix/pythonbe.py | 39 --- src/Batch/Batch_BatchManagerCatalog.cxx | 3 +- src/Batch/Batch_BatchManagerCatalog.hxx | 1 + src/Batch/Batch_Date.cxx | 2 +- src/Batch/Batch_PyVersatile.cxx | 6 +- src/Batch/Makefile.am | 38 +-- src/Container/Component_i.cxx | 5 +- src/Container/Container_i.cxx | 17 +- src/Container/SALOME_ComponentPy.py | 8 +- src/Container/SALOME_Component_i.hxx | 4 +- src/Container/SALOME_Container.cxx | 11 +- src/Container/SALOME_Container.py | 7 +- src/Container/SALOME_ContainerManager.cxx | 100 ++++--- src/Container/SALOME_Container_i.hxx | 2 +- src/Container/Salome_file_i.cxx | 1 + src/Container/Salome_file_i.hxx | 2 +- src/DF/DF_definitions.hxx | 2 +- src/DSC/ParallelDSC/ParallelDSC_i.cxx | 28 +- src/DSC/ParallelDSC/ParallelDSC_i.hxx | 4 +- src/KERNEL_PY/salome_study.py | 69 ++--- .../BatchLight_BatchManager.cxx | 0 .../BatchLight_BatchManager.hxx | 0 .../BatchLight_BatchManager_PBS.cxx | 0 .../BatchLight_BatchManager_PBS.hxx | 0 .../BatchLight_BatchManager_SLURM.cxx | 0 .../BatchLight_BatchManager_SLURM.hxx | 0 src/{Batch => Launcher}/BatchLight_Job.cxx | 0 src/{Batch => Launcher}/BatchLight_Job.hxx | 0 src/Launcher/Makefile.am | 12 +- src/{Batch => Launcher}/MpiImpl.cxx | 0 src/{Batch => Launcher}/MpiImpl.hxx | 0 .../SALOME_FileTransferCORBA.cxx | 1 + .../SALOME_ModuleCatalog_Acomponent_impl.cxx | 13 +- .../SALOME_ModuleCatalog_Acomponent_impl.hxx | 12 +- .../SALOME_ModuleCatalog_Handler.cxx | 7 +- .../SALOME_ModuleCatalog_Handler.hxx | 1 + .../SALOME_ModuleCatalog_Parser.hxx | 3 +- .../SALOME_ModuleCatalog_impl.cxx | 47 +--- .../SALOME_ModuleCatalog_impl.hxx | 3 - .../NamingService_WaitForServerReadiness.cxx | 3 +- src/NamingService/SALOME_NamingService.cxx | 2 +- src/NamingService/Test/NamingServiceTest.cxx | 9 +- src/NamingService/Test/TestNamingService.py | 2 + src/ParallelContainer/Makefile.am | 2 + .../Parallel_Salome_file_i.cxx | 17 +- .../Parallel_Salome_file_i.hxx | 4 +- .../SALOME_ParallelComponent_i.cxx | 117 ++++---- .../SALOME_ParallelComponent_i.hxx | 4 +- .../SALOME_ParallelContainerNodeDummy.cxx | 215 +++++++------- .../SALOME_ParallelContainerNodeMpi.cxx | 264 +++++++++--------- .../SALOME_ParallelContainerProxyDummy.cxx | 166 +++++------ .../SALOME_ParallelContainerProxyMpi.cxx | 187 ++++++------- .../SALOME_ParallelContainerProxy_i.cxx | 43 +++ .../SALOME_ParallelContainerProxy_i.hxx | 44 +++ .../SALOME_ParallelContainer_i.cxx | 102 ++++--- .../SALOME_ParallelContainer_i.hxx | 4 +- .../SALOME_ResourcesCatalog_Handler.cxx | 66 +++-- .../SALOME_ResourcesManager.cxx | 11 +- src/SALOMEDS/SALOMEDS.cxx | 2 + src/SALOMEDS/SALOMEDS_Driver_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_Server.cxx | 1 + src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 1 + src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 2 +- src/SALOMELocalTrace/FileTraceCollector.cxx | 1 + .../SALOMETraceCollector.cxx | 1 + src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx | 5 +- src/Utils/Utils_ORB_INIT.cxx | 3 + 76 files changed, 966 insertions(+), 876 deletions(-) delete mode 100644 salome_adm/unix/pythonbe.py rename src/{Batch => Launcher}/BatchLight_BatchManager.cxx (100%) rename src/{Batch => Launcher}/BatchLight_BatchManager.hxx (100%) rename src/{Batch => Launcher}/BatchLight_BatchManager_PBS.cxx (100%) rename src/{Batch => Launcher}/BatchLight_BatchManager_PBS.hxx (100%) rename src/{Batch => Launcher}/BatchLight_BatchManager_SLURM.cxx (100%) rename src/{Batch => Launcher}/BatchLight_BatchManager_SLURM.hxx (100%) rename src/{Batch => Launcher}/BatchLight_Job.cxx (100%) rename src/{Batch => Launcher}/BatchLight_Job.hxx (100%) rename src/{Batch => Launcher}/MpiImpl.cxx (100%) rename src/{Batch => Launcher}/MpiImpl.hxx (100%) create mode 100644 src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx diff --git a/bin/appli_gen.py b/bin/appli_gen.py index 89e30a94e..c24614cc1 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -224,6 +224,16 @@ def install(prefix,config_file): +""" + f.write(command) + f.close() + + #Add default CatalogResources.xml file + f =open(os.path.join(home_dir,'CatalogResources.xml'),'w') + command=""" + + + """ f.write(command) f.close() diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 7de5715c1..9f3c66324 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -35,7 +35,7 @@ class client: # Initialise the ORB self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID) # Initialise the Naming Service - self.initNS(args) + self.initNS(args or {}) # -------------------------------------------------------------------------- diff --git a/bin/server.py b/bin/server.py index 5bd61799d..98b2ef95b 100755 --- a/bin/server.py +++ b/bin/server.py @@ -15,7 +15,7 @@ class Server: self.PID=None self.CMD=[] self.ARGS=[] - if self.args['xterm']: + if self.args.get('xterm'): self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold'] def __init__(self,args): @@ -26,7 +26,7 @@ class Server: def run(self): global process_id myargs=self.ARGS - if self.args['xterm']: + if self.args.get('xterm'): # (Debian) send LD_LIBRARY_PATH to children shells (xterm) env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")] diff --git a/idl/Makefile.am b/idl/Makefile.am index b6a3f3d0b..b046999d7 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -26,6 +26,10 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am +if WITH_PACO_PARALLEL +MAKEFLAGS = -j1 +endif + AM_CXXFLAGS = -fPIC BASEIDL_FILES = \ @@ -91,7 +95,7 @@ BASEIDL_SOURCES =\ Calcium_PortsSK.cc \ Palm_PortsSK.cc -DYNIDL_SOURCES = \ +DYNIDL_SRCS = \ SALOME_PortsDynSK.cc Calcium_PortsDynSK.cc SALOME_ContainerManagerDynSK.cc \ SALOME_CommDynSK.cc SALOME_RegistryDynSK.cc SALOME_ModuleCatalogDynSK.cc \ SALOMEDSDynSK.cc SALOME_SessionDynSK.cc SALOME_RessourcesCatalogDynSK.cc \ @@ -115,9 +119,7 @@ if MPI_IS_OK STATIDL_SOURCES += $(MPIIDL_SOURCES) endif -IDL_SOURCES += $(DYNIDL_SOURCES) - -$(DYNIDL_SOURCES) : $(IDL_SOURCES) +$(DYNIDL_SRCS) : $(IDL_SOURCES) # also install all generated headers to use result library from another modules salomeinclude_DATA= $(STATIDL_SOURCES:%SK.cc=%.hh) @@ -198,7 +200,7 @@ DSC_EnginesPaCO.h DSC_EnginesPaCO.cc : DSC_Engines.idl DSC_Engines.xml lib_LTLIBRARIES = libSalomeIDLKernel.la $(PAR_LIB) -nodist_libSalomeIDLKernel_la_SOURCES = $(IDL_SOURCES) +nodist_libSalomeIDLKernel_la_SOURCES = $(IDL_SOURCES) $(DYNIDL_SRCS) libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @@ -223,8 +225,11 @@ IDLPYFLAGS = @IDLPYFLAGS@ SUFFIXES = .idl .hh SK.cc .idlSK.cc: $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< -.idl.hh: - $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< +SK.cc.hh: + +#Dummy rule to replace the following one (for parallel make) +#.idl.hh: +# $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< %PaCO.h %PaCO.cc : %.idl %.xml @PACO_IDL@ -I $(srcdir):@PACOPATH@/idl $^ omniORB4 0 diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 08aea29fc..f3139b6ec 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -135,7 +135,7 @@ module Engines /*! Shutdown the Container process. */ - oneway void Shutdown(); + void Shutdown(); /*! Returns the hostname of the container diff --git a/idl/SALOME_ModuleCatalog.idl b/idl/SALOME_ModuleCatalog.idl index 9fc9dac5b..dfc8764f6 100644 --- a/idl/SALOME_ModuleCatalog.idl +++ b/idl/SALOME_ModuleCatalog.idl @@ -64,19 +64,10 @@ This struct contains fields defining the parameter of the service. DATASTREAM_ITERATIVE } ; - enum DataStreamType { - DATASTREAM_UNKNOWN, - DATASTREAM_INTEGER, - DATASTREAM_FLOAT, - DATASTREAM_DOUBLE, - DATASTREAM_STRING, - DATASTREAM_BOOLEAN - } ; - struct ServicesDataStreamParameter { - DataStreamType Parametertype; /*! PathPrefixes; +/*! +Implementation type +*/ + enum ImplType { + SO, /* component implemented as a dynamic library loadable with dlopen */ + PY, /* component implemented as a python module loadable with import */ + EXE /* component implemented as an executable */ + } ; + /*! Description of a component */ @@ -183,7 +183,8 @@ Description of a component string name; string username; boolean multistudy; - boolean implementationType; + ImplType implementationType; + string implname; string icon; string constraint; ListOfDefInterface interfaces; @@ -324,9 +325,14 @@ Gets the icone of the component (for IAPP) readonly attribute string component_icone; /*! -Gets the implementation type of the component : C++ or Python (for IAPP) +Gets the implementation type of the component : C++ (dyn lib), Python (module) or executable +*/ + readonly attribute ImplType implementation_type; +/*! +Gets the implementation name of the component : name of the dyn lib or the python module or the executable +if the default naming scheme is not convenient. */ - readonly attribute boolean implementation_type; + readonly attribute string implementation_name; } ; /*! \brief %Module catalog interface diff --git a/resources/CatalogResources.xml.in b/resources/CatalogResources.xml.in index 874d32492..11e6b6e26 100644 --- a/resources/CatalogResources.xml.in +++ b/resources/CatalogResources.xml.in @@ -1,43 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/resources/KERNELCatalog.xml.in b/resources/KERNELCatalog.xml.in index 347458ed4..8986273ce 100644 --- a/resources/KERNELCatalog.xml.in +++ b/resources/KERNELCatalog.xml.in @@ -28,6 +28,7 @@ + diff --git a/salome_adm/unix/Makefile.am b/salome_adm/unix/Makefile.am index 72b1f2dd7..b2d2a9a5f 100644 --- a/salome_adm/unix/Makefile.am +++ b/salome_adm/unix/Makefile.am @@ -54,5 +54,4 @@ SALOMEconfig.h: $(top_builddir)/salome_adm/unix/SALOMEconfig.ref # The deprecated files are deprecated for the KERNEL but not for the # related modules (GUI, MED, ...), for now. Some files have to be installed. dist_salomeadmux_DATA=\ - pythonbe.py \ $(DEPRECATED_FILES) diff --git a/salome_adm/unix/pythonbe.py b/salome_adm/unix/pythonbe.py deleted file mode 100644 index 403e5cf09..000000000 --- a/salome_adm/unix/pythonbe.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT -# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -pymodule_template = """\ -# DO NOT EDIT THIS FILE! -# -# Python module @module@ generated by omniidl - -import omnipatch -omnipatch.updateModule("@module@") - -# ** 1. Stub files contributing to this module - -# ** 2. Sub-modules - -# ** 3. End""" - -import omniidl_be.python -omniidl_be.python.pymodule_template=pymodule_template - -def run(tree, args): - omniidl_be.python.run(tree, args) - diff --git a/src/Batch/Batch_BatchManagerCatalog.cxx b/src/Batch/Batch_BatchManagerCatalog.cxx index 82c63ff12..07bcd0048 100644 --- a/src/Batch/Batch_BatchManagerCatalog.cxx +++ b/src/Batch/Batch_BatchManagerCatalog.cxx @@ -37,6 +37,7 @@ namespace Batch { pthread_mutex_t BatchManagerCatalog::_mutex = PTHREAD_MUTEX_INITIALIZER; std::map * BatchManagerCatalog::_p_catalog = 0; + BatchManagerCatalog BatchManagerCatalog::theCatalog; // Constructeur BatchManagerCatalog::BatchManagerCatalog() @@ -47,7 +48,7 @@ namespace Batch { // Destructeur BatchManagerCatalog::~BatchManagerCatalog() { - // Nothing to do + delete BatchManagerCatalog::_p_catalog; } // Functor diff --git a/src/Batch/Batch_BatchManagerCatalog.hxx b/src/Batch/Batch_BatchManagerCatalog.hxx index 62917faa4..81ab713ec 100644 --- a/src/Batch/Batch_BatchManagerCatalog.hxx +++ b/src/Batch/Batch_BatchManagerCatalog.hxx @@ -53,6 +53,7 @@ namespace Batch { virtual std::string __repr__() const; protected: + static BatchManagerCatalog theCatalog; static std::map * _p_catalog; static pthread_mutex_t _mutex; diff --git a/src/Batch/Batch_Date.cxx b/src/Batch/Batch_Date.cxx index 0ec1166ef..a657696ac 100644 --- a/src/Batch/Batch_Date.cxx +++ b/src/Batch/Batch_Date.cxx @@ -60,7 +60,7 @@ namespace Batch { _sec = p_tm->tm_sec; } else { - char c; +// char c; // istringstream ist(s); // ist >> _day >> c // >> _month >> c diff --git a/src/Batch/Batch_PyVersatile.cxx b/src/Batch/Batch_PyVersatile.cxx index 395634bbf..f38132ca2 100644 --- a/src/Batch/Batch_PyVersatile.cxx +++ b/src/Batch/Batch_PyVersatile.cxx @@ -27,12 +27,12 @@ * */ -#include #include #include "Batch_TypeMismatchException.hxx" #include "Batch_ListIsFullException.hxx" #include "Batch_InvalidArgumentException.hxx" #include "Batch_PyVersatile.hxx" +#include namespace Batch { @@ -93,7 +93,7 @@ namespace Batch { if (_maxsize != 1) { // une liste obj = PyList_New(0); for(Versatile::const_iterator it=begin(); it!=end(); it++) { - char ch[2] = {0, 0}; +// char ch[2] = {0, 0}; string st; Couple cp; // PyObject * tuple; @@ -137,7 +137,7 @@ namespace Batch { } } else { // un scalaire - char ch[2] = {0, 0}; +// char ch[2] = {0, 0}; string st; Couple cp; // PyObject * tuple; diff --git a/src/Batch/Makefile.am b/src/Batch/Makefile.am index 425e39f5c..0ec62e54c 100644 --- a/src/Batch/Makefile.am +++ b/src/Batch/Makefile.am @@ -59,12 +59,7 @@ LIB_INCLUDES = \ Batch_PyVersatile.hxx \ Batch_RunTimeException.hxx \ Batch_StringType.hxx \ - Batch_TypeMismatchException.hxx \ - BatchLight_BatchManager.hxx \ - BatchLight_BatchManager_PBS.hxx \ - BatchLight_BatchManager_SLURM.hxx \ - BatchLight_Job.hxx \ - MpiImpl.hxx + Batch_TypeMismatchException.hxx LIB_SRC = \ @@ -96,18 +91,14 @@ LIB_SRC = \ Batch_PyVersatile.cxx \ Batch_RunTimeException.cxx \ Batch_StringType.cxx \ - Batch_TypeMismatchException.cxx \ - BatchLight_BatchManager.cxx \ - BatchLight_BatchManager_SLURM.cxx \ - BatchLight_BatchManager_PBS.cxx \ - BatchLight_Job.cxx \ - MpiImpl.cxx + Batch_TypeMismatchException.cxx LIB_CPPFLAGS = \ - @PYTHON_INCLUDES@ \ + ${PYTHON_INCLUDES} \ -I$(srcdir)/../Basics \ - -I$(srcdir)/../SALOMELocalTrace + -I$(srcdir)/../SALOMELocalTrace \ + -I$(top_builddir)/salome_adm/unix LIB_LIBADD = \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ @@ -193,8 +184,8 @@ LIB_SRC += \ Batch_JobInfo_LSF.cxx \ Batch_Job_LSF.cxx -LIB_CPPFLAGS += @LSF_INCLUDES@ -LIB_LIBADD += @LSF_LIBDIR@ @LSF_LIBS@ +LIB_CPPFLAGS += ${LSF_INCLUDES} +LIB_LIBADD += ${LSF_LIBDIR} ${LSF_LIBS} endif @@ -209,17 +200,6 @@ salomeinclude_HEADERS = $(LIB_INCLUDES) # lib_LTLIBRARIES = libSalomeBatch.la libSalomeBatch_la_SOURCES = $(LIB_SRC) -libSalomeBatch_la_CPPFLAGS = \ - @PYTHON_INCLUDES@ \ - -I$(srcdir)/../Basics \ - -I$(srcdir)/../SALOMELocalTrace \ - -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ - -I$(top_builddir)/idl \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ $(LIB_CPPFLAGS) - +libSalomeBatch_la_CPPFLAGS = ${LIB_CPPFLAGS} libSalomeBatch_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeBatch_la_LIBADD = \ - ../SALOMELocalTrace/libSALOMELocalTrace.la \ - ../Basics/libSALOMEBasics.la \ - $(LIB_LIBADD) +libSalomeBatch_la_LIBADD = $(LIB_LIBADD) diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index af8380f8c..cdbef093f 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -241,7 +241,6 @@ void Engines_Component_i::destroy() delete _myConnexionToRegistry; _myConnexionToRegistry = 0 ; _poa->deactivate_object(*_id) ; - CORBA::release(_poa) ; delete(_id) ; //SCRUTE(pd_refCount); _thisObj->_remove_ref(); @@ -259,7 +258,7 @@ void Engines_Component_i::destroy() Engines::Container_ptr Engines_Component_i::GetContainerRef() { // MESSAGE("Engines_Component_i::GetContainerRef"); - CORBA::Object_ptr o = _poa->id_to_reference(*_contId) ; + CORBA::Object_var o = _poa->id_to_reference(*_contId) ; return Engines::Container::_narrow(o); } @@ -851,7 +850,7 @@ void Engines_Component_i::CancelThread() void Engines_Component_i::sendMessage(const char *event_type, const char *message) { - _notifSupplier->Send(graphName(), nodeName(), event_type, message); + _notifSupplier->Send(_graphName.c_str(), _nodeName.c_str(), event_type, message); } //============================================================================= diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 61d3e2a61..2f5692fdc 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -103,7 +103,7 @@ Engines_Container_i::Engines_Container_i () : //============================================================================= Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, - PortableServer::POA_var poa, + PortableServer::POA_ptr poa, char *containerName , int argc , char* argv[], bool activAndRegist, @@ -161,10 +161,11 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, { _id = _poa->activate_object(this); _NS = new SALOME_NamingService(); - _NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ; + _NS->init_orb( _orb ) ; CORBA::Object_var obj=_poa->id_to_reference(*_id); Engines::Container_var pCont = Engines::Container::_narrow(obj); + _remove_ref(); _containerName = _NS->BuildContainerNameForNS(containerName, hostname.c_str()); @@ -209,7 +210,9 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, } fileTransfer_i* aFileTransfer = new fileTransfer_i(); - _fileTransfer = Engines::fileTransfer::_narrow(aFileTransfer->_this()); + CORBA::Object_var obref=aFileTransfer->_this(); + _fileTransfer = Engines::fileTransfer::_narrow(obref); + aFileTransfer->_remove_ref(); } } @@ -223,6 +226,8 @@ Engines_Container_i::~Engines_Container_i() { MESSAGE("Container_i::~Container_i()"); delete _id; + if(_NS) + delete _NS; } //============================================================================= @@ -298,8 +303,6 @@ void Engines_Container_i::Shutdown() if(_isServantAloneInProcess) { MESSAGE("Effective Shutdown of container Begins..."); - LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); - bp1->deleteInstance(bp1); if(!CORBA::is_nil(_orb)) _orb->shutdown(0); } @@ -455,6 +458,7 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName, instanceName.c_str(), studyId); string iors = PyString_AsString(result); + Py_DECREF(result); SCRUTE(iors); Py_RELEASE_NEW_THREAD; @@ -462,6 +466,7 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName, { CORBA::Object_var obj = _orb->string_to_object(iors.c_str()); iobject = Engines::Component::_narrow( obj ) ; + _listInstances_map[instanceName] = iobject; } return iobject._retn(); } @@ -904,6 +909,8 @@ Engines_Container_i::createInstance(string genericRegisterName, void Engines_Container_i::decInstanceCnt(string genericRegisterName) { + if(_cntInstances_map.count(genericRegisterName)==0) + return; string aGenRegisterName =genericRegisterName; MESSAGE("Engines_Container_i::decInstanceCnt " << aGenRegisterName); ASSERT(_cntInstances_map[aGenRegisterName] > 0); diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 8a3d80d41..5d071b8e4 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -83,7 +83,9 @@ class SALOME_ComponentPy_i (Engines__POA.Component): myMachine=getShortHostName() Component_path = self._containerName + "/" + self._instanceName MESSAGE( 'SALOME_ComponentPy_i Register' + str( Component_path ) ) - naming_service.Register(self._this(), Component_path) + id_o = poa.activate_object(self) + compo_o = poa.id_to_reference(id_o) + naming_service.Register(compo_o, Component_path) # Add componentinstance to registry obj = naming_service.Resolve('/Registry') @@ -145,8 +147,8 @@ class SALOME_ComponentPy_i (Engines__POA.Component): def destroy(self): MESSAGE( "SALOME_ComponentPy_i::destroy" ) - self._poa.deactivate_object(self) - CORBA.release(self._poa) + id = self._poa.servant_to_id(self) + self._poa.deactivate_object(id) #------------------------------------------------------------------------- diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index de8a42e0e..9e3ee1383 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -142,8 +142,8 @@ protected: std::string _instanceName ; std::string _interfaceName ; - CORBA::ORB_ptr _orb; - PortableServer::POA_ptr _poa; + CORBA::ORB_var _orb; + PortableServer::POA_var _poa; PortableServer::ObjectId * _id; PortableServer::ObjectId * _contId; Engines_Component_i * _thisObj ; diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index 9a8cf992b..00345f670 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -130,7 +130,7 @@ int main(int argc, char* argv[]) ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); CORBA::ORB_ptr orb = init(argc , argv ) ; - + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); INFOS_COMPILATION; BEGIN_OF(argv[0]); @@ -168,9 +168,9 @@ int main(int argc, char* argv[]) // add new container to the kill list #ifndef WNT - ostrstream aCommand ; + stringstream aCommand ; aCommand << "addToKillList.py " << getpid() << " SALOME_Container" << ends ; - system(aCommand.str()); + system(aCommand.str().c_str()); #endif Engines_Container_i * myContainer @@ -186,7 +186,10 @@ int main(int argc, char* argv[]) #endif HandleServerSideSignals(orb); - + + PyGILState_STATE gstate = PyGILState_Ensure(); + //Delete python container that destroy orb from python (pyCont._orb.destroy()) + Py_Finalize(); } catch(CORBA::SystemException&) { diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index 362f077e4..179150954 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -32,12 +32,8 @@ import os import sys import string from omniORB import CORBA, PortableServer -# import SALOMEDS before other SALOME modules -# (if not, incomplete import done by SALOME module: no load of SALOMEDS_attributes) import SALOMEDS import Engines, Engines__POA -reload(Engines) -reload(Engines__POA) from SALOME_NamingServicePy import * from SALOME_ComponentPy import * @@ -68,6 +64,9 @@ class SALOME_Container_i: #------------------------------------------------------------------------- + def __del__(self ): + self._orb.destroy() + def import_component(self, componentName): MESSAGE( "SALOME_Container_i::import_component" ) ret=0 diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 043ed927d..b74dda375 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -102,6 +102,7 @@ void SALOME_ContainerManager::Shutdown() _NS->Destroy_Name(_ContainerManagerNameInNS); PortableServer::ObjectId_var oid = _poa->servant_to_id(this); _poa->deactivate_object(oid); + //_remove_ref() has already been done at creation //_remove_ref(); } @@ -135,11 +136,28 @@ void SALOME_ContainerManager::ShutdownContainers() SCRUTE((*iter)); CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); Engines::Container_var cont=Engines::Container::_narrow(obj); - if(!CORBA::is_nil(cont)){ - MESSAGE("ShutdownContainers: " << (*iter)); - cont->Shutdown(); - } - else MESSAGE("ShutdownContainers: no container ref for " << (*iter)); + if(!CORBA::is_nil(cont)) + { + MESSAGE("ShutdownContainers: " << (*iter)); + try + { + cont->Shutdown(); + } + catch(CORBA::SystemException& e) + { + INFOS("CORBA::SystemException ignored : " << e); + } + catch(CORBA::Exception&) + { + INFOS("CORBA::Exception ignored."); + } + catch(...) + { + INFOS("Unknown exception ignored."); + } + } + else + MESSAGE("ShutdownContainers: no container ref for " << (*iter)); } } } @@ -212,6 +230,10 @@ StartContainer(const Engines::MachineParameters& params, return Engines::Container::_nil(); } + //If the machine name is localhost use the real name + if(theMachine == "localhost") + theMachine=GetHostname(); + MESSAGE("try to launch it on " << theMachine); // Get Id for container: a parallel container registers in Naming Service @@ -326,6 +348,7 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const, const Engines::MachineList& possibleComputers) { CORBA::Object_var obj; + PaCO::InterfaceManager_var proxy; Engines::Container_ptr ret = Engines::Container::_nil(); Engines::MachineParameters params(params_const); @@ -338,7 +361,7 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const, if(CORBA::is_nil(ret)) { // Step 2 : Starting a new parallel container INFOS("[FindOrStartParallelContainer] Starting a parallel container"); - + // Step 2.1 : Choose a computer string theMachine = _ResManager->FindFirst(possibleComputers); if(theMachine == "") { @@ -353,48 +376,55 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const, // Step 3 : starting parallel container proxy params.hostname = CORBA::string_dup(theMachine.c_str()); Engines::MachineParameters params_proxy(params); - command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerProxy", params_proxy, "xterm"); + try { + command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerProxy", params_proxy, "xterm"); + } + catch(const SALOME_Exception & ex){ + MESSAGE(ex.what()); + return Engines::Container::_nil(); + } // LaunchParallelContainer uses this value to know if it launches the proxy or the nodes params_proxy.nb_component_nodes = 0; obj = LaunchParallelContainer(command, params_proxy, _NS->ContainerName(params)); ret = Engines::Container::_narrow(obj); + proxy = PaCO::InterfaceManager::_narrow(obj); // Step 4 : starting parallel container nodes command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerNode", params, "xterm"); string name = _NS->ContainerName(params) + "Node"; LaunchParallelContainer(command, params, name); - // Step 5 : connecting nodes and the proxy to actually create a parallel container try { - for (int i = 0; i < params.nb_component_nodes; i++) { + for (int i = 0; i < params.nb_component_nodes; i++) { - char buffer [5]; + char buffer [5]; #ifndef WNT - snprintf(buffer,5,"%d",i); + snprintf(buffer,5,"%d",i); #else - _snprintf(buffer,5,"%d",i); + _snprintf(buffer,5,"%d",i); #endif - string name_cont = name + string(buffer); - - string theNodeMachine(CORBA::string_dup(params.hostname)); - string containerNameInNS = _NS->BuildContainerNameForNS(name_cont.c_str(),theNodeMachine.c_str()); - int count = TIME_OUT_TO_LAUNCH_CONT; - obj = _NS->Resolve(containerNameInNS.c_str()); - while (CORBA::is_nil(obj) && count) { - INFOS("[FindOrStartParallelContainer] CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!!!"); + string name_cont = name + string(buffer); + + string theNodeMachine(CORBA::string_dup(params.hostname)); + string containerNameInNS = _NS->BuildContainerNameForNS(name_cont.c_str(),theNodeMachine.c_str()); + int count = TIME_OUT_TO_LAUNCH_CONT; + obj = _NS->Resolve(containerNameInNS.c_str()); + while (CORBA::is_nil(obj) && count) { + INFOS("[FindOrStartParallelContainer] CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!!!"); #ifndef WNT - sleep(1) ; + sleep(1) ; #else - Sleep(1000); + Sleep(1000); #endif - count-- ; - obj = _NS->Resolve(containerNameInNS.c_str()); - } - - PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj); - MESSAGE("[FindOrStartParallelContainer] Deploying node : " << name); - node->deploy(i); - } + count-- ; + obj = _NS->Resolve(containerNameInNS.c_str()); + } + + PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj); + MESSAGE("[FindOrStartParallelContainer] Deploying node : " << name); + node->deploy(); + } + proxy->start(); } catch(CORBA::SystemException& e) { @@ -418,13 +448,12 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const, } INFOS("[FindOrStartParallelContainer] node " << name << " deployed"); } - else { INFOS("[FindOrStartParallelContainer] Currently parallel containers are launched only on the local host"); } } - } - return ret; +} +return ret; } #else //============================================================================= @@ -533,7 +562,8 @@ SALOME_ContainerManager::LaunchParallelContainer(const std::string& command, { CORBA::Object_ptr obj = CORBA::Object::_nil(); string containerNameInNS; - + MESSAGE("[LaunchParallelContainer] : command to launch..."); + MESSAGE(command); if (params.nb_component_nodes == 0) { INFOS("[LaunchParallelContainer] launching the proxy of the parallel container"); int status = system(command.c_str()); @@ -548,7 +578,7 @@ SALOME_ContainerManager::LaunchParallelContainer(const std::string& command, string theMachine(CORBA::string_dup(params.hostname)); containerNameInNS = _NS->BuildContainerNameForNS((char*) name.c_str(),theMachine.c_str()); - INFOS("[LaunchContainer] Waiting for Parallel Container proxy on " << theMachine); + INFOS("[LaunchParallelContainer] Waiting for Parallel Container proxy on " << theMachine); while (CORBA::is_nil(obj) && count) { #ifndef WNT sleep(1) ; diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index 03c27e0d5..f39a54c4b 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -54,7 +54,7 @@ class CONTAINER_EXPORT Engines_Container_i: public: Engines_Container_i(); Engines_Container_i(CORBA::ORB_ptr orb, - PortableServer::POA_var poa, + PortableServer::POA_ptr poa, char * containerName , int argc, char* argv[], bool activAndRegist = true, diff --git a/src/Container/Salome_file_i.cxx b/src/Container/Salome_file_i.cxx index 8f10ad2cf..a098c06f9 100644 --- a/src/Container/Salome_file_i.cxx +++ b/src/Container/Salome_file_i.cxx @@ -842,6 +842,7 @@ Salome_file_i::getDistributedFile(std::string file_name) CORBA::Octet *buf = aBlock->get_buffer(); int nbWri = fwrite(buf, sizeof(CORBA::Octet), toFollow, fp); ASSERT(nbWri == toFollow); + delete aBlock; } fclose(fp); MESSAGE("end of transfer of " << comp_file_name); diff --git a/src/Container/Salome_file_i.hxx b/src/Container/Salome_file_i.hxx index 16b09034e..b1337871f 100644 --- a/src/Container/Salome_file_i.hxx +++ b/src/Container/Salome_file_i.hxx @@ -100,7 +100,7 @@ class CONTAINER_EXPORT Salome_file_i: _t_fileDistributedSource _fileDistributedSource; Engines::SfState _state; Engines::Container_ptr _container; - Engines::Salome_file_ptr _default_source_Salome_file; + Engines::Salome_file_var _default_source_Salome_file; }; #endif diff --git a/src/DF/DF_definitions.hxx b/src/DF/DF_definitions.hxx index 816839cfa..3cfe5585d 100644 --- a/src/DF/DF_definitions.hxx +++ b/src/DF/DF_definitions.hxx @@ -30,7 +30,7 @@ # define DF_EXPORT #endif -#include +#include #include #include diff --git a/src/DSC/ParallelDSC/ParallelDSC_i.cxx b/src/DSC/ParallelDSC/ParallelDSC_i.cxx index c4f15adb5..291e3138c 100644 --- a/src/DSC/ParallelDSC/ParallelDSC_i.cxx +++ b/src/DSC/ParallelDSC/ParallelDSC_i.cxx @@ -25,19 +25,21 @@ #include "ParallelDSC_i.hxx" -Engines_ParallelDSC_i::Engines_ParallelDSC_i(CORBA::ORB_ptr orb, char * ior, +Engines_ParallelDSC_i::Engines_ParallelDSC_i(CORBA::ORB_ptr orb, + char * ior, + int rank, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, const char *interfaceName, bool notif) : - Engines_Parallel_Component_i(orb, ior, poa, contId, instanceName, interfaceName, notif), - Engines::Parallel_DSC_serv(orb, ior), - Engines::DSC_serv(orb, ior), - Engines::Superv_Component_serv(orb, ior), - Engines::Component_serv(orb, ior), - Engines::Parallel_Component_serv(orb, ior), - InterfaceParallel_impl(orb,ior) + Engines_Parallel_Component_i(orb, ior, rank, poa, contId, instanceName, interfaceName, notif), + Engines::Parallel_DSC_serv(orb, ior, rank), + Engines::DSC_serv(orb, ior, rank), + Engines::Superv_Component_serv(orb, ior, rank), + Engines::Component_serv(orb, ior, rank), + Engines::Parallel_Component_serv(orb, ior, rank), + InterfaceParallel_impl(orb, ior, rank) { } @@ -56,10 +58,8 @@ Engines_ParallelDSC_i::set_paco_proxy(const CORBA::Object_ptr ref, Engines_DSC_interface::add_provides_port(Ports::Port::_narrow(ref), provides_port_name, port_prop); - PaCO_operation * global_ptr = getContext("global_paco_context"); - cerr << " my_comm : " << global_ptr->my_com << endl; // Waiting that all the nodes have the proxy - global_ptr->my_com->paco_barrier(); + _my_com->paco_barrier(); cerr << "set_paco_proxy node fin" << endl; } @@ -80,8 +80,8 @@ Engines_ParallelDSC_i::add_parallel_provides_proxy_port(const CORBA::Object_ptr { assert(provides_port_name); CORBA::Boolean rtn_bool = false; - CORBA::Object_ptr _comp_proxy = _orb->string_to_object(_ior.c_str()); - Engines::Parallel_DSC_var real_comp_proxy = Engines::Parallel_DSC::_narrow(_comp_proxy); + Engines::Parallel_DSC_var real_comp_proxy = + Engines::Parallel_DSC::_narrow(InterfaceParallel_impl::_proxy); real_comp_proxy->set_paco_proxy(ref, provides_port_name, port_prop); rtn_bool = true; return rtn_bool; @@ -114,7 +114,7 @@ Engines_ParallelDSC_i::add_parallel_provides_node_port(Ports::Port_PaCO_ptr ref, { CORBA::Boolean rtn_bool = false; PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(ref); - node->deploy(getMyRank()); + node->deploy(); rtn_bool = true; return rtn_bool; } diff --git a/src/DSC/ParallelDSC/ParallelDSC_i.hxx b/src/DSC/ParallelDSC/ParallelDSC_i.hxx index ed900566f..05859c002 100644 --- a/src/DSC/ParallelDSC/ParallelDSC_i.hxx +++ b/src/DSC/ParallelDSC/ParallelDSC_i.hxx @@ -39,7 +39,9 @@ class Engines_ParallelDSC_i: public virtual Engines_DSC_interface { public: - Engines_ParallelDSC_i(CORBA::ORB_ptr orb, char * ior, + Engines_ParallelDSC_i(CORBA::ORB_ptr orb, + char * ior, + int rank, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index 22b460dd6..3c86ed63a 100644 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -31,49 +31,50 @@ from launchConfigureParser import verbose #-------------------------------------------------------------------------- -def DumpComponent(Study, SO, offset): - it = Study.NewChildIterator(SO) - Builder = Study.NewBuilder() - while it.More(): - CSO = it.Value() - it.Next() - anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName") - AtName = anAttr._narrow(SALOMEDS.AttributeName) - t_name = AtName.Value() - if t_name[0] == 1: - ofs = 1 - a = "" - while ofs <= offset: - a = a + "--" - ofs = ofs +1 - MESSAGE( a + ">" + str(CSO.GetID()) + " " + str(t_name[1]) ) - t_RefSO = CSO.ReferencedObject() - if t_RefSO[0] == 1: - RefSO = t_RefSO[1] - ofs = 1 - a = "" - while ofs <= offset: - a = a + " " - ofs = ofs +1 - MESSAGE( a + ">" + str(RefSO.GetID()) ) - DumpComponent(Study, CSO, offset+2) +def DumpComponent(Study, SO, Builder,offset): + it = Study.NewChildIterator(SO) + while it.More(): + CSO = it.Value() + a=offset*"--" + ">" + CSO.GetID() + find,AtName = Builder.FindAttribute(CSO, "AttributeName") + if find: + a=a+":"+AtName.Value() + find,AtIOR = Builder.FindAttribute(CSO, "AttributeIOR") + if find: + a=a+":"+AtIOR.Value() + find,RefSO = CSO.ReferencedObject() + if find: + a=a+":"+RefSO.GetID() + print a + DumpComponent(Study, CSO, Builder,offset+2) + it.Next() - #-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- def DumpStudy(Study): """ Dump a study, given the ior """ itcomp = Study.NewComponentIterator() + Builder = Study.NewBuilder() while itcomp.More(): - SC = itcomp.Value() - itcomp.Next() - name = SC.ComponentDataType() - MESSAGE( "-> ComponentDataType is " + name ) - DumpComponent(Study, SC, 1) - + SC = itcomp.Value() + name = SC.ComponentDataType() + print "-> ComponentDataType is " + name + DumpComponent(Study, SC,Builder, 1) + itcomp.Next() + +def DumpStudies(): + """ + Dump all studies in a StudyManager + """ + for name in myStudyManager.GetOpenStudies(): + s=myStudyManager.GetStudyByName(name) + print "study:",name, s._get_StudyId() + DumpStudy(s) - #-------------------------------------------------------------------------- + +#-------------------------------------------------------------------------- def IDToObject(id): myObj = None diff --git a/src/Batch/BatchLight_BatchManager.cxx b/src/Launcher/BatchLight_BatchManager.cxx similarity index 100% rename from src/Batch/BatchLight_BatchManager.cxx rename to src/Launcher/BatchLight_BatchManager.cxx diff --git a/src/Batch/BatchLight_BatchManager.hxx b/src/Launcher/BatchLight_BatchManager.hxx similarity index 100% rename from src/Batch/BatchLight_BatchManager.hxx rename to src/Launcher/BatchLight_BatchManager.hxx diff --git a/src/Batch/BatchLight_BatchManager_PBS.cxx b/src/Launcher/BatchLight_BatchManager_PBS.cxx similarity index 100% rename from src/Batch/BatchLight_BatchManager_PBS.cxx rename to src/Launcher/BatchLight_BatchManager_PBS.cxx diff --git a/src/Batch/BatchLight_BatchManager_PBS.hxx b/src/Launcher/BatchLight_BatchManager_PBS.hxx similarity index 100% rename from src/Batch/BatchLight_BatchManager_PBS.hxx rename to src/Launcher/BatchLight_BatchManager_PBS.hxx diff --git a/src/Batch/BatchLight_BatchManager_SLURM.cxx b/src/Launcher/BatchLight_BatchManager_SLURM.cxx similarity index 100% rename from src/Batch/BatchLight_BatchManager_SLURM.cxx rename to src/Launcher/BatchLight_BatchManager_SLURM.cxx diff --git a/src/Batch/BatchLight_BatchManager_SLURM.hxx b/src/Launcher/BatchLight_BatchManager_SLURM.hxx similarity index 100% rename from src/Batch/BatchLight_BatchManager_SLURM.hxx rename to src/Launcher/BatchLight_BatchManager_SLURM.hxx diff --git a/src/Batch/BatchLight_Job.cxx b/src/Launcher/BatchLight_Job.cxx similarity index 100% rename from src/Batch/BatchLight_Job.cxx rename to src/Launcher/BatchLight_Job.cxx diff --git a/src/Batch/BatchLight_Job.hxx b/src/Launcher/BatchLight_Job.hxx similarity index 100% rename from src/Batch/BatchLight_Job.hxx rename to src/Launcher/BatchLight_Job.hxx diff --git a/src/Launcher/Makefile.am b/src/Launcher/Makefile.am index 9c441ebc1..b0323d754 100644 --- a/src/Launcher/Makefile.am +++ b/src/Launcher/Makefile.am @@ -36,6 +36,11 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # # header files salomeinclude_HEADERS = \ + BatchLight_BatchManager.hxx \ + BatchLight_BatchManager_PBS.hxx \ + BatchLight_BatchManager_SLURM.hxx \ + BatchLight_Job.hxx \ + MpiImpl.hxx \ SALOME_Launcher.hxx # Scripts to be installed @@ -93,7 +98,12 @@ COMMON_LIBS =\ # lib_LTLIBRARIES = libSalomeLauncher.la libSalomeLauncher_la_SOURCES=\ - SALOME_Launcher.cxx + SALOME_Launcher.cxx \ + BatchLight_BatchManager.cxx \ + BatchLight_BatchManager_SLURM.cxx \ + BatchLight_BatchManager_PBS.cxx \ + BatchLight_Job.cxx \ + MpiImpl.cxx libSalomeLauncher_la_CPPFLAGS =\ $(COMMON_CPPFLAGS) diff --git a/src/Batch/MpiImpl.cxx b/src/Launcher/MpiImpl.cxx similarity index 100% rename from src/Batch/MpiImpl.cxx rename to src/Launcher/MpiImpl.cxx diff --git a/src/Batch/MpiImpl.hxx b/src/Launcher/MpiImpl.hxx similarity index 100% rename from src/Batch/MpiImpl.hxx rename to src/Launcher/MpiImpl.hxx diff --git a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx index bb72d3f20..895c53581 100644 --- a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx @@ -184,6 +184,7 @@ string SALOME_FileTransferCORBA::getLocalFile(string localFile) SCRUTE(toFollow); CORBA::Octet *buf = aBlock->get_buffer(); int nbWri = fwrite(buf, sizeof(CORBA::Octet), toFollow, fp); + delete aBlock; ASSERT(nbWri == toFollow); } fclose(fp); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 2e9b3160d..3208d6e89 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@ -413,13 +413,22 @@ CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::multistudy() //---------------------------------------------------------------------- // Function : implementation type -// Purpose : define if a component is implemented in C++ or Python +// Purpose : return the implementation type : C++ (dyn lib), Python (module) or executable //---------------------------------------------------------------------- -CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::implementation_type() +SALOME_ModuleCatalog::ImplType SALOME_ModuleCatalog_AcomponentImpl::implementation_type() { return _Component.implementationType ; } +//---------------------------------------------------------------------- +// Function : implementation name +// Purpose : return the implementation name to exec if the default one is not convenient +//---------------------------------------------------------------------- +char* SALOME_ModuleCatalog_AcomponentImpl::implementation_name() +{ + return _Component.implname ; +} + //---------------------------------------------------------------------- // Function : component_type // Purpose : define the type of the component diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx index 943d5d02e..e693d70f4 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx @@ -135,11 +135,17 @@ public: */ virtual char* component_icone(); - //! method to define if a component is implemented in C++ or Python + //! method to define if a component is implemented in a dyn lib a python module or an executable /*! - \return true if it's a C++ component + \return an enum SO or PY or EXE */ - virtual CORBA::Boolean implementation_type(); + virtual SALOME_ModuleCatalog::ImplType implementation_type(); + + //! method to obtain the implementation name of the component if the default one is not convenient + /*! + \return the implementation name to exec + */ + virtual char* implementation_name(); private : diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index 97c257ded..bf3e99952 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -68,6 +68,7 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler(ParserPathPrefixes& p test_component_multistudy = "component-multistudy"; test_component_icon = "component-icone" ; test_component_impltype = "component-impltype"; + test_component_implname = "component-implname"; test_component_version = "component-version"; test_component_comment = "component-comment"; @@ -481,7 +482,11 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) // Tag test_component_impltype if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_impltype) ) - _aModule.implementationType = atoi(aContent.c_str()); + _aModule.implementationType = aContent; + + // Tag test_component_implname + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_implname) ) + _aModule.implementationName = aContent; // Tag test_component_icon if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_icon) ) diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx index 22f7c416a..50758d6a6 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx @@ -64,6 +64,7 @@ private: const char *test_component_multistudy ; const char *test_component_icon ; const char *test_component_impltype; + const char *test_component_implname; const char *test_component_version; const char *test_component_comment; diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx index 8369f9917..4a330bf9d 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx @@ -96,7 +96,8 @@ struct ParserComponent std::string constraint; ParserInterfaces interfaces; ParserPathPrefixes prefixes; - bool implementationType; + std::string implementationType; + std::string implementationName; std::string version; std::string comment; }; diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index e794b05a5..5e3760e22 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -96,20 +96,7 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: ComponentTypeConvert[OTHER] = SALOME_ModuleCatalog::OTHER; - // Conversion rules for datastream parameters type and dependency - DataStreamTypeConvert["UNKNOWN"] - = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - DataStreamTypeConvert["INTEGER"] - = SALOME_ModuleCatalog::DATASTREAM_INTEGER; - DataStreamTypeConvert["FLOAT"] - = SALOME_ModuleCatalog::DATASTREAM_FLOAT; - DataStreamTypeConvert["DOUBLE"] - = SALOME_ModuleCatalog::DATASTREAM_DOUBLE; - DataStreamTypeConvert["STRING"] - = SALOME_ModuleCatalog::DATASTREAM_STRING; - DataStreamTypeConvert["BOOLEAN"] - = SALOME_ModuleCatalog::DATASTREAM_BOOLEAN; - + // Conversion rules for datastream parameters dependency DataStreamDepConvert["UNDEFINED"] = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED; DataStreamDepConvert["T"] @@ -759,7 +746,13 @@ void SALOME_ModuleCatalogImpl::duplicate C_corba.multistudy = C_parser.multistudy; C_corba.icon = CORBA::string_dup(C_parser.icon.c_str()); C_corba.type = ComponentTypeConvert[C_parser.type]; - C_corba.implementationType = C_parser.implementationType; + if(C_parser.implementationType == "EXE") + C_corba.implementationType=SALOME_ModuleCatalog::EXE; + else if(C_parser.implementationType == "PY") + C_corba.implementationType=SALOME_ModuleCatalog::PY; + else + C_corba.implementationType=SALOME_ModuleCatalog::SO; + C_corba.implname = CORBA::string_dup(C_parser.implementationName.c_str()); unsigned int _length = C_parser.interfaces.size(); C_corba.interfaces.length(_length); @@ -880,32 +873,12 @@ void SALOME_ModuleCatalogImpl::duplicate (SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba, const ParserDataStreamParameter & P_parser) { - std::map < std::string, - SALOME_ModuleCatalog::DataStreamType >::const_iterator it_type; - std::map < std::string, SALOME_ModuleCatalog::DataStreamDependency >::const_iterator it_dep; // duplicate parameter name P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str()); - // doesn't work ??? - // it_type = DataStreamTypeConvert.find(P_parser.type); - // P_corba.Parametertype - // = (it_type == DataStreamTypeConvert.end()) - // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - - if(MYDEBUG) SCRUTE(P_parser.type); - P_corba.Parametertype = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - for (it_type = DataStreamTypeConvert.begin(); - it_type != DataStreamTypeConvert.end(); - it_type++) - if (P_parser.type.compare(it_type->first) == 0) { - P_corba.Parametertype = it_type->second; - break; - } - if(MYDEBUG) SCRUTE(P_corba.Parametertype); - // duplicate parameter type // doesn't work ??? @@ -913,6 +886,10 @@ void SALOME_ModuleCatalogImpl::duplicate // P_corba.Parametertype // = (it_type == DataStreamTypeConvert.end()) // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; + + P_corba.Parametertype = CORBA::string_dup(P_parser.type.c_str()); + + // duplicate parameter dependency if(MYDEBUG) SCRUTE(P_parser.dependency); P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED; diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx index fc4d269fe..40650ac9f 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx @@ -217,9 +217,6 @@ private: ParserComponents _personal_module_list ; ParserPathPrefixes _personal_path_list ; - std::map - DataStreamTypeConvert; - std::map DataStreamDepConvert; diff --git a/src/NamingService/NamingService_WaitForServerReadiness.cxx b/src/NamingService/NamingService_WaitForServerReadiness.cxx index 6d9d1f962..3021b6c85 100644 --- a/src/NamingService/NamingService_WaitForServerReadiness.cxx +++ b/src/NamingService/NamingService_WaitForServerReadiness.cxx @@ -66,8 +66,9 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, { if (serverName.length() == 0) { - string dummyadr = NS->getIORaddr(); // to wait for naming service + char* dummyadr = NS->getIORaddr(); // to wait for naming service found = 1; + delete [] dummyadr; break; // naming service found } else diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index eec18908d..965982293 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -1065,7 +1065,7 @@ throw(ServiceUnreachable) if (binding->binding_type == CosNaming::ncontext) { - dirList.push_back(CORBA::string_dup(bindingName[0].id)); + dirList.push_back(bindingName[0].id.in()); } } diff --git a/src/NamingService/Test/NamingServiceTest.cxx b/src/NamingService/Test/NamingServiceTest.cxx index 441f4fff0..bfb70a8df 100644 --- a/src/NamingService/Test/NamingServiceTest.cxx +++ b/src/NamingService/Test/NamingServiceTest.cxx @@ -89,6 +89,7 @@ NSTEST::echo_ptr NSTEST_aFactory_i::createInstance() NSTEST_echo_i * anEcho = new NSTEST_echo_i(_num); _num++; NSTEST::echo_var anEchoRef = anEcho->_this(); + anEcho->_remove_ref(); return anEchoRef._retn(); } @@ -149,6 +150,7 @@ NamingServiceTest::setUp() _myFactoryId = _root_poa->activate_object(_myFactory); _factoryRef = _myFactory->_this(); _pman->activate(); + _myFactory->_remove_ref(); } @@ -182,6 +184,7 @@ NamingServiceTest::testConstructorDefault() char *root = NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); + delete [] root; CPPUNIT_ASSERT(!CORBA::is_nil(obj)); CosNaming::NamingContext_var rootContext = @@ -202,6 +205,7 @@ NamingServiceTest::testConstructorOrb() char *root = NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); + delete [] root; CosNaming::NamingContext_var rootContext = CosNaming::NamingContext::_narrow(obj); @@ -1027,7 +1031,9 @@ NamingServiceTest::testCurrentDirectory() CPPUNIT_ASSERT(ret); _NS.Change_Directory(path.c_str()); - string curdir = _NS.Current_Directory(); + char* acurdir = _NS.Current_Directory(); + string curdir = acurdir; + free(acurdir); CPPUNIT_ASSERT(curdir == path); } @@ -1204,6 +1210,7 @@ NamingServiceTest::testGetIorAddr() { char *root = _NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); + delete [] root; CPPUNIT_ASSERT(!CORBA::is_nil(obj)); } diff --git a/src/NamingService/Test/TestNamingService.py b/src/NamingService/Test/TestNamingService.py index f41e7689d..5c3a8e712 100644 --- a/src/NamingService/Test/TestNamingService.py +++ b/src/NamingService/Test/TestNamingService.py @@ -47,6 +47,8 @@ clt.waitLogger("Logger") # execute Unit Test command = ['TestNamingService'] +valgrind = ['valgrind','--leak-check=full'] +#command=valgrind+command #to check memory leaks ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process diff --git a/src/ParallelContainer/Makefile.am b/src/ParallelContainer/Makefile.am index 1734d4f10..18ff73d7f 100644 --- a/src/ParallelContainer/Makefile.am +++ b/src/ParallelContainer/Makefile.am @@ -34,6 +34,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # header files salomeinclude_HEADERS = SALOME_ParallelComponent_i.hxx \ SALOME_ParallelContainer_i.hxx \ + SALOME_ParallelContainerProxy_i.hxx \ Parallel_Salome_file_i.hxx # @@ -75,6 +76,7 @@ lib_LTLIBRARIES = libSalomeParallelContainer.la libSalomeParallelContainer_la_SOURCES = SALOME_ParallelComponent_i.cxx \ SALOME_ParallelContainer_i.cxx \ + SALOME_ParallelContainerProxy_i.cxx \ $(top_srcdir)/src/Container/Salome_file_i.cxx \ Parallel_Salome_file_i.cxx diff --git a/src/ParallelContainer/Parallel_Salome_file_i.cxx b/src/ParallelContainer/Parallel_Salome_file_i.cxx index ac06b5005..7c9394863 100644 --- a/src/ParallelContainer/Parallel_Salome_file_i.cxx +++ b/src/ParallelContainer/Parallel_Salome_file_i.cxx @@ -26,11 +26,13 @@ #include "Parallel_Salome_file_i.hxx" #include "utilities.h" -Parallel_Salome_file_i::Parallel_Salome_file_i(CORBA::ORB_ptr orb, const char * ior) : - InterfaceParallel_impl(orb,ior), - Engines::Salome_file_serv(orb,ior), - Engines::fileTransfer_serv(orb,ior), - Engines::Parallel_Salome_file_serv(orb,ior) +Parallel_Salome_file_i::Parallel_Salome_file_i(CORBA::ORB_ptr orb, + const char * ior, + int rank) : + InterfaceParallel_impl(orb,ior,rank), + Engines::Salome_file_serv(orb,ior,rank), + Engines::fileTransfer_serv(orb,ior,rank), + Engines::Parallel_Salome_file_serv(orb,ior,rank) { CORBA::Object_ptr obj = _orb->string_to_object(ior); proxy = Engines::Parallel_Salome_file::_narrow(obj); @@ -168,8 +170,8 @@ Parallel_Salome_file_i::recvFiles_node() { // 2 cases : // Source file is a Salome_file // Source file is a Parallel_Salome_file - PaCO::ParallelKernel_var interface_manager = - PaCO::ParallelKernel::_narrow(_fileDistributedSource[file_infos.file_name.in()]); + PaCO::InterfaceManager_var interface_manager = + PaCO::InterfaceManager::_narrow(_fileDistributedSource[file_infos.file_name.in()]); if (CORBA::is_nil(interface_manager)) result = getDistributedFile(file_infos.file_name.in()); else @@ -245,6 +247,7 @@ Parallel_Salome_file_i::getParallelDistributedFile(std::string file_name) { toFollow = aBlock->length(); CORBA::Octet *buf = aBlock->get_buffer(); int nbWri = fwrite(buf, sizeof(CORBA::Octet), toFollow, fp); + delete aBlock; ASSERT(nbWri == toFollow); } fclose(fp); diff --git a/src/ParallelContainer/Parallel_Salome_file_i.hxx b/src/ParallelContainer/Parallel_Salome_file_i.hxx index c3814a5c4..21384fef9 100644 --- a/src/ParallelContainer/Parallel_Salome_file_i.hxx +++ b/src/ParallelContainer/Parallel_Salome_file_i.hxx @@ -39,7 +39,9 @@ class CONTAINER_EXPORT Parallel_Salome_file_i: public virtual Engines::Parallel_Salome_file_serv { public: - Parallel_Salome_file_i(CORBA::ORB_ptr orb, const char * ior); + Parallel_Salome_file_i(CORBA::ORB_ptr orb, + const char * ior, + int rank); virtual ~Parallel_Salome_file_i(); virtual void setFileNode(const char* file_name, CORBA::Long node); diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx index db60ae5e4..fab45e703 100644 --- a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx @@ -44,6 +44,7 @@ int SIGUSR11 = 1000; #endif #include +#include using namespace std; @@ -59,8 +60,10 @@ bool Engines_Parallel_Component_i::_isMultiInstance = false; */ //============================================================================= -Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior) : - InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior), Engines::Parallel_Component_serv(orb,ior) +Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank) : + InterfaceParallel_impl(orb,ior,rank), + Engines::Component_serv(orb,ior,rank), + Engines::Parallel_Component_serv(orb,ior,rank) { //ASSERT(0); INFOS("Default Constructor..."); @@ -79,15 +82,15 @@ Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, c */ //============================================================================= -Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, +Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, const char *interfaceName, bool notif) : - InterfaceParallel_impl(orb,ior), - Engines::Component_serv(orb,ior), - Engines::Parallel_Component_serv(orb,ior), + InterfaceParallel_impl(orb,ior,rank), + Engines::Component_serv(orb,ior,rank), + Engines::Parallel_Component_serv(orb,ior,rank), _instanceName(instanceName), _interfaceName(interfaceName), _myConnexionToRegistry(0), @@ -818,34 +821,21 @@ Engines_Parallel_Component_i::setInputFileToService(const char* service_name, // Firstly, we have to create the proxy object // of the Salome_file and transmit his // reference to the other nodes. + Engines::Parallel_Salome_file_proxy_impl * proxy = NULL; if (getMyRank() == 0) { - Engines::Parallel_Salome_file_proxy_impl * proxy = - new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb)); - PaCO_operation * proxy_global_ptr = proxy->getContext("global_paco_context"); - // We initialize the object with the context of the Parallel component - PaCO_operation * compo_global_ptr = getContext("global_paco_context"); - //compo_global_ptr->init_context(proxy_global_ptr); - proxy_global_ptr->init_context(compo_global_ptr); - - paco_fabrique_manager* pfm = paco_getFabriqueManager(); - pfm->register_com("dummy", new paco_dummy_fabrique()); - proxy_global_ptr->setComFab(NULL); - proxy_global_ptr->setLibCom("dummy",NULL); - - proxy_global_ptr->setTypeClient(true); - PaCO::PacoTopology_t client_topo; - client_topo.total = 1; - proxy_global_ptr->setClientTopo(client_topo); + proxy = new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb), + new paco_omni_fabrique()); + proxy->copyGlobalContext(this); PaCO::PacoTopology_t serveur_topo; serveur_topo.total = getTotalNode(); - proxy->setTopo(serveur_topo); + proxy->setTopology(serveur_topo); // We register the CORBA objet into the POA CORBA::Object_ptr proxy_ref = proxy->_this(); // We send the reference to all the nodes... - CORBA::Object_ptr comp_proxy = _orb->string_to_object(_ior.c_str()); - Engines::Parallel_Component_var component_proxy = Engines::Parallel_Component::_narrow(comp_proxy); + Engines::Parallel_Component_var component_proxy = + Engines::Parallel_Component::_narrow(InterfaceParallel_impl::_proxy); component_proxy->send_parallel_proxy_object(proxy_ref); // Adding proxy into the map @@ -863,32 +853,35 @@ Engines_Parallel_Component_i::setInputFileToService(const char* service_name, for (int i = 0; i < getTotalNode(); i++) { if (i == getMyRank()) { Parallel_Salome_file_i * servant = - new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb), proxy_ior.c_str()); - PaCO_operation * servant_global_ptr = servant->getContext("global_paco_context"); - - // We initialize the object with the context of the Parallel component - PaCO_operation * compo_global_ptr = this->getContext("global_paco_context"); -// compo_global_ptr->init_context(servant_global_ptr); - servant_global_ptr->init_context(compo_global_ptr); + new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb), + proxy_ior.c_str(), + i); + servant->copyGlobalContext(this); // We register the CORBA objet into the POA servant->POA_PaCO::InterfaceParallel::_this(); // Register the servant - servant->deploy(getMyRank()); + servant->deploy(); // Adding servant to the map (*_map)[Salome_file_name] = servant; } - PaCO_operation * compo_global_ptr = this->getContext("global_paco_context"); - compo_global_ptr->my_com->paco_barrier(); + _my_com->paco_barrier(); + // start parallel object + if (getMyRank() == 0) { + proxy->start(); + _my_com->paco_barrier(); + } + else + _my_com->paco_barrier(); } - // Parallel_Salome_file is created and deployed delete _proxy; _proxy = NULL; } + pthread_mutex_unlock(deploy_mutex); proxy_ior = (*_IOR_proxy_map)[Salome_file_name]; CORBA::Object_ptr proxy_ref = _orb->string_to_object(proxy_ior.c_str()); @@ -918,6 +911,7 @@ Engines_Parallel_Component_i::setOutputFileToService(const char* service_name, // Try to find the Salome_file ... _Salome_file_map_it = _map->find(Salome_file_name); + Engines::Parallel_Salome_file_proxy_impl * proxy; if (_Salome_file_map_it == _map->end()) { // We create a new PaCO++ object. @@ -928,33 +922,19 @@ Engines_Parallel_Component_i::setOutputFileToService(const char* service_name, // of the Salome_file and transmit his // reference to the other nodes. if (getMyRank() == 0) { - Engines::Parallel_Salome_file_proxy_impl * proxy = - new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb)); - PaCO_operation * proxy_global_ptr = proxy->getContext("global_paco_context"); - // We initialize the object with the context of the Parallel component - PaCO_operation * compo_global_ptr = getContext("global_paco_context"); - //compo_global_ptr->init_context(proxy_global_ptr); - proxy_global_ptr->init_context(compo_global_ptr); - - paco_fabrique_manager* pfm = paco_getFabriqueManager(); - pfm->register_com("dummy", new paco_dummy_fabrique()); - proxy_global_ptr->setComFab(NULL); - proxy_global_ptr->setLibCom("dummy",NULL); - - proxy_global_ptr->setTypeClient(true); - PaCO::PacoTopology_t client_topo; - client_topo.total = 1; - proxy_global_ptr->setClientTopo(client_topo); + proxy = new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb), + new paco_omni_fabrique()); + proxy->copyGlobalContext(this); PaCO::PacoTopology_t serveur_topo; serveur_topo.total = getTotalNode(); - proxy->setTopo(serveur_topo); + proxy->setTopology(serveur_topo); // We register the CORBA objet into the POA CORBA::Object_ptr proxy_ref = proxy->_this(); // We send the reference to all the nodes... - CORBA::Object_ptr comp_proxy = _orb->string_to_object(_ior.c_str()); - Engines::Parallel_Component_var component_proxy = Engines::Parallel_Component::_narrow(comp_proxy); + Engines::Parallel_Component_var component_proxy = + Engines::Parallel_Component::_narrow(InterfaceParallel_impl::_proxy); component_proxy->send_parallel_proxy_object(proxy_ref); // Adding proxy into the map @@ -972,26 +952,29 @@ Engines_Parallel_Component_i::setOutputFileToService(const char* service_name, for (int i = 0; i < getTotalNode(); i++) { if (i == getMyRank()) { Parallel_Salome_file_i * servant = - new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb), proxy_ior.c_str()); - PaCO_operation * servant_global_ptr = servant->getContext("global_paco_context"); - - // We initialize the object with the context of the Parallel component - PaCO_operation * compo_global_ptr = this->getContext("global_paco_context"); -// compo_global_ptr->init_context(servant_global_ptr); - servant_global_ptr->init_context(compo_global_ptr); + new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb), + proxy_ior.c_str(), + i); + servant->copyGlobalContext(this); // We register the CORBA objet into the POA servant->POA_PaCO::InterfaceParallel::_this(); // Register the servant - servant->deploy(getMyRank()); + servant->deploy(); // Adding servant to the map (*_map)[Salome_file_name] = servant; } - PaCO_operation * compo_global_ptr = this->getContext("global_paco_context"); - compo_global_ptr->my_com->paco_barrier(); + _my_com->paco_barrier(); + // start parallel object + if (getMyRank() == 0) { + proxy->start(); + _my_com->paco_barrier(); + } + else + _my_com->paco_barrier(); } // Parallel_Salome_file is created and deployed diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.hxx b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx index edadf93ce..218864970 100644 --- a/src/ParallelContainer/SALOME_ParallelComponent_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx @@ -64,8 +64,8 @@ class CONTAINER_EXPORT Engines_Parallel_Component_i: public virtual PortableServer::RefCountServantBase { public: - Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior); - Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, + Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank); + Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, diff --git a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx index 4f5d0d274..d3470b9de 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx @@ -54,12 +54,12 @@ using namespace std; #include void handler(int t) { - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "SIGSEGV in :" << getpid() << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - while (1) {} + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} } #endif @@ -78,13 +78,13 @@ sighandler_t setsig(int sig, sighandler_t handler) void AttachDebugger() { if(getenv ("DEBUGGER")) - { - std::stringstream exec; - exec << "$DEBUGGER SALOME_ParallelContainerNodeDummy " << getpid() << "&"; - std::cerr << exec.str() << std::endl; - system(exec.str().c_str()); - while(1); - } + { + std::stringstream exec; + exec << "$DEBUGGER SALOME_ParallelContainerNodeDummy " << getpid() << "&"; + std::cerr << exec.str() << std::endl; + system(exec.str().c_str()); + while(1); + } } void Handler(int theSigId) @@ -109,107 +109,104 @@ void unexpectedHandler(void) int main(int argc, char* argv[]) { - INFOS("Launching a parallel container node"); + INFOS("Launching a parallel container node"); -#ifdef _DEBUG_ -// signal(SIGSEGV, handler); -#endif if(getenv ("DEBUGGER")) - { - setsig(SIGSEGV,&Handler); - set_terminate(&terminateHandler); - set_unexpected(&unexpectedHandler); - } - - // Initialise the ORB. - ORB_INIT &init = *SINGLETON_::Instance(); - ASSERT(SINGLETON_::IsAlreadyExisting()); - CORBA::ORB_var orb = init(0, 0); - //CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - char * containerName = ""; - if(argc > 1) { - containerName = argv[1]; - } - - char * hostname = ""; - if(argc > 3) { - hostname = argv[3]; - } - - try { - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); - PortableServer::POAManager_var pman = root_poa->the_POAManager(); + { + setsig(SIGSEGV,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } + + // Initialise the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + std::string containerName(""); + if(argc > 1) { + containerName = argv[1]; + } + std::string hostname(""); + if(argc > 3) { + hostname = argv[3]; + } + + try { + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); #ifndef WNT - // add this container to the kill list - char aCommand[100]; - sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNode", getpid()); - system(aCommand); + // add this container to the kill list + char aCommand[100]; + sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNode", getpid()); + system(aCommand); #endif - SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); - // Get the proxy - string proxyNameInNS = ns->BuildContainerNameForNS(containerName, hostname); - obj = ns->Resolve(proxyNameInNS.c_str()); - char * proxy_ior = orb->object_to_string(obj); - - // Creating a node - string name(containerName); - string node_name = name + "Node"; - Engines_Parallel_Container_i * servant = new Engines_Parallel_Container_i(CORBA::ORB::_duplicate(orb), proxy_ior, - root_poa, - (char*) node_name.c_str(), - argc, argv); - // PaCO++ init - paco_fabrique_manager * pfm = paco_getFabriqueManager(); - pfm->register_com("dummy", new paco_dummy_fabrique()); - pfm->register_thread("omni", new paco_omni_fabrique()); - - // Global context - PaCO_operation * global_ptr = servant->getContext("global_paco_context"); - global_ptr->setLibCom("dummy",NULL); - global_ptr->setLibThread("omni"); - - // Activation - PortableServer::ObjectId * _id = root_poa->activate_object(servant); - servant->set_id(_id); - obj = root_poa->id_to_reference(*_id); - - // In the NamingService - string hostname = GetHostname(); - int myid = 0; - char buffer [5]; - snprintf(buffer, 5, "%d", myid); - node_name = node_name + buffer; - string _containerName = ns->BuildContainerNameForNS((char*) node_name.c_str(), - hostname.c_str()); - cerr << "---------" << _containerName << "----------" << endl; - ns->Register(obj, _containerName.c_str()); - pman->activate(); - orb->run(); - } - catch(CORBA::SystemException&) - { - INFOS("Caught CORBA::SystemException."); - } - catch(PortableServer::POA::ServantAlreadyActive&) - { - INFOS("Caught CORBA::ServantAlreadyActiveException"); - } - catch(CORBA::Exception&) - { - INFOS("Caught CORBA::Exception."); - } - catch(std::exception& exc) - { - INFOS("Caught std::exception - "<BuildContainerNameForNS(containerName.c_str(), + hostname.c_str()); + obj = ns->Resolve(proxyNameInNS.c_str()); + char * proxy_ior = orb->object_to_string(obj); + + // Creating a node + string node_name = containerName + "Node"; + Engines_Parallel_Container_i * servant = new Engines_Parallel_Container_i(CORBA::ORB::_duplicate(orb), + proxy_ior, + 0, + root_poa, + (char*) node_name.c_str(), + argc, argv); + // PaCO++ init + paco_fabrique_manager * pfm = paco_getFabriqueManager(); + pfm->register_com("dummy", new paco_dummy_fabrique()); + pfm->register_thread("omni", new paco_omni_fabrique()); + servant->setLibCom("dummy", servant); + servant->setLibThread("omni"); + + // Activation + PortableServer::ObjectId * _id = root_poa->activate_object(servant); + servant->set_id(_id); + obj = root_poa->id_to_reference(*_id); + + // In the NamingService + string hostname = GetHostname(); + int myid = 0; + char buffer [5]; + snprintf(buffer, 5, "%d", myid); + node_name = node_name + buffer; + string _containerName = ns->BuildContainerNameForNS((char*) node_name.c_str(), + hostname.c_str()); + cerr << "---------" << _containerName << "----------" << endl; + ns->Register(obj, _containerName.c_str()); + pman->activate(); + orb->run(); + } + catch (PaCO::PACO_Exception& e) + { + INFOS("Caught PaCO::PACO_Exception"); + std::cerr << e << std::endl; + } + catch(CORBA::SystemException&) + { + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "< void test(int sigval) { - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "SIGSEGV in :" << getpid() << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - while (1) {} + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} } void handler(int t) { - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "SIGSEGV in :" << getpid() << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - while (1) {} + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} } #endif @@ -90,13 +90,13 @@ sighandler_t setsig(int sig, sighandler_t handler) void AttachDebugger() { if(getenv ("DEBUGGER")) - { - std::stringstream exec; - exec << "$DEBUGGER SALOME_ParallelContainerNodeMpi " << getpid() << "&"; - std::cerr << exec.str() << std::endl; - system(exec.str().c_str()); - while(1); - } + { + std::stringstream exec; + exec << "$DEBUGGER SALOME_ParallelContainerNodeMpi " << getpid() << "&"; + std::cerr << exec.str() << std::endl; + system(exec.str().c_str()); + while(1); + } } void Handler(int theSigId) @@ -121,40 +121,31 @@ void unexpectedHandler(void) int main(int argc, char* argv[]) { - INFOS("Launching a parallel Mpi container node"); + INFOS("Launching a parallel Mpi container node"); -#ifdef _DEBUG_ -// struct sigaction action; -// action.sa_handler = &test; -// sigaction(SIGSEGV, &action, NULL); -#endif - - // MPI Init - int provided; - MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE ,&provided); + // MPI Init + int provided; + int myid; + MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE ,&provided); + MPI_Comm_rank(MPI_COMM_WORLD,&myid); if(getenv ("DEBUGGER")) - { - std::cerr << "Unexpected: unexpected exception !" << std::endl; - setsig(SIGSEGV,&Handler); - set_terminate(&terminateHandler); - set_unexpected(&unexpectedHandler); - } -#ifdef _DEBUG_ - cerr << "Level MPI_THREAD_SINGLE : " << MPI_THREAD_SINGLE << endl; - cerr << "Level MPI_THREAD_SERIALIZED : " << MPI_THREAD_SERIALIZED << endl; - cerr << "Level MPI_THREAD_FUNNELED : " << MPI_THREAD_FUNNELED << endl; - cerr << "Level MPI_THREAD_MULTIPLE : " << MPI_THREAD_MULTIPLE << endl; - cerr << "Level provided : " << provided << endl; -#endif - // Initialise the ORB. - ORB_INIT &init = *SINGLETON_::Instance(); - ASSERT(SINGLETON_::IsAlreadyExisting()); - CORBA::ORB_var orb = init(0, 0); - //CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Code pour choisir le reseau infiniband ..... -/* string hostname_temp = GetHostname(); + { + std::cerr << "Unexpected: unexpected exception !" << std::endl; + setsig(SIGSEGV,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } + cerr << "Level MPI_THREAD_SINGLE : " << MPI_THREAD_SINGLE << endl; + cerr << "Level MPI_THREAD_SERIALIZED : " << MPI_THREAD_SERIALIZED << endl; + cerr << "Level MPI_THREAD_FUNNELED : " << MPI_THREAD_FUNNELED << endl; + cerr << "Level MPI_THREAD_MULTIPLE : " << MPI_THREAD_MULTIPLE << endl; + cerr << "Level provided : " << provided << endl; + // Initialise the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + // Code pour choisir le reseau infiniband ..... + /* string hostname_temp = GetHostname(); hostent * t = gethostbyname(hostname_temp.c_str()); cerr << " AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA " << t->h_addr << " " << hostname_temp << endl; cerr << t->h_addr << endl; @@ -165,96 +156,99 @@ int main(int argc, char* argv[]) string com = "giop:tcp:" + ip + ":"; const char* options[][2] = { { "endPoint", com.c_str() }, { 0, 0 } }; CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4", options); -*/ - char * containerName = ""; - if(argc > 1) { - containerName = argv[1]; - } + */ + std::string containerName(""); + containerName = argv[1]; - char * hostname = ""; - if(argc > 3) { - hostname = argv[3]; - } + std::string hostname(""); + if(argc > 3) { + hostname = argv[3]; + } - try { - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); - PortableServer::POAManager_var pman = root_poa->the_POAManager(); + try { + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); #ifndef WNT - // add this container to the kill list - char aCommand[100]; - sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNodeMpi", getpid()); - system(aCommand); + // add this container to the kill list + char aCommand[100]; + sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNodeMpi", getpid()); + system(aCommand); #endif - SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); - // On récupère le proxy - string proxyNameInNS = ns->BuildContainerNameForNS(containerName, hostname); - obj = ns->Resolve(proxyNameInNS.c_str()); - char * proxy_ior = orb->object_to_string(obj); - - // Node creation - string name(containerName); - string node_name = name + "Node"; - Engines_Parallel_Container_i * servant = new Engines_Parallel_Container_i(CORBA::ORB::_duplicate(orb), proxy_ior, - root_poa, - (char*) node_name.c_str(), - argc, argv); - // PaCO++ init - paco_fabrique_manager * pfm = paco_getFabriqueManager(); - pfm->register_com("mpi", new paco_mpi_fabrique()); - pfm->register_thread("omni", new paco_omni_fabrique()); - - // Global context - PaCO_operation * global_ptr = servant->getContext("global_paco_context"); - MPI_Comm group = MPI_COMM_WORLD; - global_ptr->setLibCom("mpi", &group); - global_ptr->setLibThread("omni"); - - // Activation - PortableServer::ObjectId * _id = root_poa->activate_object(servant); - servant->set_id(_id); - obj = root_poa->id_to_reference(*_id); - - // In the NamingService - string hostname = GetHostname(); - - int myid; - MPI_Comm_rank(MPI_COMM_WORLD, &myid); - char buffer [5]; - snprintf(buffer, 5, "%d", myid); - node_name = node_name + buffer; - string _containerName = ns->BuildContainerNameForNS((char*) node_name.c_str(), - hostname.c_str()); - cerr << "---------" << _containerName << "----------" << endl; - ns->Register(obj, _containerName.c_str()); - pman->activate(); - orb->run(); - } - catch(CORBA::SystemException&) - { - INFOS("Caught CORBA::SystemException."); - } - catch(PortableServer::POA::ServantAlreadyActive&) - { - INFOS("Caught CORBA::ServantAlreadyActiveException"); - } - catch(CORBA::Exception&) - { - INFOS("Caught CORBA::Exception."); - } - catch(std::exception& exc) - { - INFOS("Caught std::exception - "<BuildContainerNameForNS(containerName.c_str(), + hostname.c_str()); + obj = ns->Resolve(proxyNameInNS.c_str()); + char * proxy_ior = orb->object_to_string(obj); + + // Node creation + string node_name = containerName + "Node"; + Engines_Parallel_Container_i * servant = + new Engines_Parallel_Container_i(CORBA::ORB::_duplicate(orb), + proxy_ior, + myid, + root_poa, + (char*) node_name.c_str(), + argc, argv); + // PaCO++ init + paco_fabrique_manager * pfm = paco_getFabriqueManager(); + pfm->register_com("mpi", new paco_mpi_fabrique()); + pfm->register_thread("omni", new paco_omni_fabrique()); + MPI_Comm group = MPI_COMM_WORLD; + servant->setLibCom("mpi", &group); + servant->setLibThread("omni"); + + // Activation + PortableServer::ObjectId * _id = root_poa->activate_object(servant); + servant->set_id(_id); + obj = root_poa->id_to_reference(*_id); + + // In the NamingService + string hostname = GetHostname(); + + int myid; + MPI_Comm_rank(MPI_COMM_WORLD, &myid); + char buffer [5]; + snprintf(buffer, 5, "%d", myid); + node_name = node_name + buffer; + string _containerName = ns->BuildContainerNameForNS(node_name.c_str(), + hostname.c_str()); + cerr << "---------" << _containerName << "----------" << endl; + ns->Register(obj, _containerName.c_str()); + pman->activate(); + orb->run(); + } + catch (PaCO::PACO_Exception& e) + { + INFOS("Caught PaCO::PACO_Exception"); + std::cerr << e << std::endl; + } + catch(CORBA::SystemException&) + { + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "< #include @@ -53,101 +54,100 @@ using namespace std; void handler(int t) { - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "SIGSEGV in :" << getpid() << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - while (1) {} + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} } #endif int main(int argc, char* argv[]) { - INFOS("Launching a parallel proxy container"); + INFOS("Launching a parallel proxy container"); #ifdef DEBUG_PARALLEL - signal(SIGSEGV, handler); + signal(SIGSEGV, handler); #endif + // Initialise the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - // Initialise the ORB. - ORB_INIT &init = *SINGLETON_::Instance(); - ASSERT(SINGLETON_::IsAlreadyExisting()); - CORBA::ORB_var orb = init(0, 0); - //CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + std::string containerName(""); + if(argc > 1) { + containerName = argv[1]; + } - char *containerName = ""; - if(argc > 1) { - containerName = argv[1]; - } - - try { - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - ASSERT(!CORBA::is_nil(obj)); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); - PortableServer::POAManager_var pman = root_poa->the_POAManager(); + try { + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + ASSERT(!CORBA::is_nil(obj)); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); #ifndef WNT - // add this container to the kill list - char aCommand[100]; - sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxy", getpid()); - system(aCommand); + // add this container to the kill list + char aCommand[100]; + sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyDummy", getpid()); + system(aCommand); #endif - SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); - Engines::Container_proxy_impl * proxy = new Engines::Container_proxy_impl(CORBA::ORB::_duplicate(orb)); - - // PaCO++ code - paco_fabrique_manager* pfm = paco_getFabriqueManager(); - // Global context - PaCO_operation * global_ptr = proxy->getContext("global_paco_context"); - pfm->register_com("dummy", new paco_dummy_fabrique()); - global_ptr->setLibCom("dummy", NULL); - pfm->register_thread("omnithread", new paco_omni_fabrique()); - global_ptr->setLibThread("omnithread"); - global_ptr->setTypeClient(true); - // The proxy is a PaCO++ client - PaCO::PacoTopology_t client_topo; - client_topo.total = 1; - global_ptr->setClientTopo(client_topo); - // Topo of the parallel object - PaCO::PacoTopology_t serveur_topo; - serveur_topo.total = 1; - proxy->setTopo(serveur_topo); - - PortableServer::ObjectId_var _id = root_poa->activate_object(proxy); - obj = root_poa->id_to_reference(_id); - - // In the NamingService - string hostname = GetHostname(); - Engines::Container_var pCont = Engines::Container::_narrow(obj); - string _containerName = ns->BuildContainerNameForNS(containerName, - hostname.c_str()); - cerr << "---------" << _containerName << "----------" << endl; - ns->Register(pCont, _containerName.c_str()); - pman->activate(); - orb->run(); - } - catch(CORBA::SystemException&) - { - INFOS("Caught CORBA::SystemException."); - } - catch(PortableServer::POA::ServantAlreadyActive&) - { - INFOS("Caught CORBA::ServantAlreadyActiveException"); - } - catch(CORBA::Exception&) - { - INFOS("Caught CORBA::Exception."); - } - catch(std::exception& exc) - { - INFOS("Caught std::exception - "<register_com("dummy", new paco_dummy_fabrique()); + proxy->setLibCom("dummy", proxy); + pfm->register_thread("omnithread", new paco_omni_fabrique()); + proxy->setLibThread("omnithread"); + // Topo of the parallel object + PaCO::PacoTopology_t serveur_topo; + serveur_topo.total = 1; + proxy->setTopology(serveur_topo); + + PortableServer::ObjectId_var _id = root_poa->activate_object(proxy); + obj = root_poa->id_to_reference(_id); + + // In the NamingService + string hostname = GetHostname(); + Engines::Container_var pCont = Engines::Container::_narrow(obj); + string _containerName = ns->BuildContainerNameForNS(containerName.c_str(), + hostname.c_str()); + cerr << "---------" << _containerName << "----------" << endl; + ns->Register(pCont, _containerName.c_str()); + pman->activate(); + orb->run(); + } + catch (PaCO::PACO_Exception& e) + { + INFOS("Caught PaCO::PACO_Exception"); + std::cerr << e << std::endl; + } + catch(CORBA::SystemException&) + { + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "< #endif -#include "SALOME_ComponentPaCO_Engines_Container_server.h" +//#include "SALOME_ComponentPaCO_Engines_Container_server.h" +#include "SALOME_ParallelContainerProxy_i.hxx" #include #include @@ -54,113 +55,107 @@ using namespace std; #include void handler(int t) { - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "SIGSEGV in :" << getpid() << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - while (1) {} + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} } #endif int main(int argc, char* argv[]) { - INFOS("Launching a parallel Mpi proxy container"); + INFOS("Launching a parallel Mpi proxy container"); #ifdef DEBUG_PARALLEL - signal(SIGSEGV, handler); + signal(SIGSEGV, handler); #endif - // MPI Init - int provided; - MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED ,&provided); - - // Initialise the ORB. - ORB_INIT &init = *SINGLETON_::Instance(); - ASSERT(SINGLETON_::IsAlreadyExisting()); - CORBA::ORB_var orb = init(0, 0); - //CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - char *containerName = ""; - if(argc > 1) { - containerName = argv[1]; - } - - char * nb_nodes = ""; - if(argc > 2) { - nb_nodes = argv[2]; - } - - try { - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - ASSERT(!CORBA::is_nil(obj)); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); - PortableServer::POAManager_var pman = root_poa->the_POAManager(); + // MPI Init + int provided; + MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED ,&provided); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + std::string containerName(""); + containerName = argv[1]; + int nb_nodes; + sscanf(argv[2],"%d",&nb_nodes); + + try { + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + ASSERT(!CORBA::is_nil(obj)); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); #ifndef WNT - // add this container to the kill list - char aCommand[100]; - sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyMpi", getpid()); - system(aCommand); + // add this container to the kill list + char aCommand[100]; + sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyMpi", getpid()); + system(aCommand); #endif - SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); - Engines::Container_proxy_impl * proxy = new Engines::Container_proxy_impl(CORBA::ORB::_duplicate(orb)); - - // PaCO++ code - paco_fabrique_manager* pfm = paco_getFabriqueManager(); - // Global context - PaCO_operation * global_ptr = proxy->getContext("global_paco_context"); - pfm->register_com("mpi", new paco_mpi_fabrique()); - MPI_Comm group = MPI_COMM_WORLD; - global_ptr->setLibCom("mpi", &group); - pfm->register_thread("omnithread", new paco_omni_fabrique()); - global_ptr->setLibThread("omnithread"); - global_ptr->setTypeClient(true); - PaCO::PacoTopology_t client_topo; - client_topo.total = 1; - global_ptr->setClientTopo(client_topo); - PaCO::PacoTopology_t serveur_topo; - serveur_topo.total = atoi(nb_nodes); - proxy->setTopo(serveur_topo); - - // Activation - PortableServer::ObjectId_var _id = root_poa->activate_object(proxy); - obj = root_poa->id_to_reference(_id); - - // in the NamingService - string hostname = GetHostname(); - Engines::Container_var pCont = Engines::Container::_narrow(obj); - string _containerName = ns->BuildContainerNameForNS(containerName, - hostname.c_str()); - cerr << "---------" << _containerName << "----------" << endl; - ns->Register(pCont, _containerName.c_str()); - pman->activate(); - orb->run(); - } - catch(CORBA::SystemException&) - { - INFOS("Caught CORBA::SystemException."); - } - catch(PortableServer::POA::ServantAlreadyActive&) - { - INFOS("Caught CORBA::ServantAlreadyActiveException"); - } - catch(CORBA::Exception&) - { - INFOS("Caught CORBA::Exception."); - } - catch(std::exception& exc) - { - INFOS("Caught std::exception - "<register_com("mpi", new paco_mpi_fabrique()); + MPI_Comm group = MPI_COMM_WORLD; + proxy->setLibCom("mpi", &group); + pfm->register_thread("omnithread", new paco_omni_fabrique()); + proxy->setLibThread("omnithread"); + PaCO::PacoTopology_t serveur_topo; + serveur_topo.total = nb_nodes; + proxy->setTopology(serveur_topo); + + // Activation + PortableServer::ObjectId_var _id = root_poa->activate_object(proxy); + obj = root_poa->id_to_reference(_id); + + // in the NamingService + string hostname = GetHostname(); + Engines::Container_var pCont = Engines::Container::_narrow(obj); + string _containerName = ns->BuildContainerNameForNS(containerName.c_str(), + hostname.c_str()); + cerr << "---------" << _containerName << "----------" << endl; + ns->Register(pCont, _containerName.c_str()); + pman->activate(); + orb->run(); + } + catch (PaCO::PACO_Exception& e) + { + INFOS("Caught PaCO::PACO_Exception"); + std::cerr << e << std::endl; + } + catch(CORBA::SystemException&) + { + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "<shutdown(0); +} + diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx new file mode 100644 index 000000000..77d59144f --- /dev/null +++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx @@ -0,0 +1,44 @@ +// SALOME_ParallelContainerProxy : implementation of container and engine for Parallel Kernel +// +// Copyright (C) 2008 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_ParallelContainerProxy_i.hxx +// Author : André RIBES, EDF + +#ifndef _SALOME_PARALLEL_CONTAINER_PROXY_I_HXX_ +#define _SALOME_PARALLEL_CONTAINER_PROXY_I_HXX_ + +#include "utilities.h" +#include "SALOME_ComponentPaCO_Engines_Container_server.h" + +class Container_proxy_impl_final : + public Engines::Container_proxy_impl +{ + public: + Container_proxy_impl_final(CORBA::ORB_ptr orb, + paco_fabrique_thread * fab_thread, + bool is_a_return_proxy = false); + + virtual ~Container_proxy_impl_final(); + + virtual void Shutdown(); +}; + +#endif diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index 9fbf89e85..937a2274b 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -50,6 +50,7 @@ int SIGUSR1 = 1000; #endif +#include #include "utilities.h" using namespace std; @@ -77,8 +78,11 @@ omni_mutex Engines_Parallel_Container_i::_numInstanceMutex ; */ //============================================================================= -Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, char * ior) : - InterfaceParallel_impl(orb,ior), Engines::Container_serv(orb,ior), +Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, + char * ior, + int rank) : + InterfaceParallel_impl(orb,ior,rank), + Engines::Container_serv(orb,ior,rank), _numInstance(0) { } @@ -89,14 +93,17 @@ Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, */ //============================================================================= -Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, char * ior, +Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, + char * ior, + int rank, PortableServer::POA_ptr poa, char *containerName , int argc , char* argv[], bool activAndRegist, bool isServantAloneInProcess ) : - InterfaceParallel_impl(orb,ior), Engines::Container_serv(orb,ior), + InterfaceParallel_impl(orb,ior,rank), + Engines::Container_serv(orb,ior,rank), _numInstance(0),_isServantAloneInProcess(isServantAloneInProcess) { _pid = (long)getpid(); @@ -257,7 +264,7 @@ Engines_Parallel_Container_i::load_component_Library(const char* componentName) } // To be sure that all the nodes of the component as loaded the library - global_paco_context_ptr->my_com->paco_barrier(); + _my_com->paco_barrier(); return ret; } @@ -652,6 +659,7 @@ Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) (CORBA::ORB_ptr, + paco_fabrique_thread *, PortableServer::POA_ptr, PortableServer::ObjectId *, const char *, @@ -680,7 +688,7 @@ Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, // --- Instanciate required CORBA object PortableServer::ObjectId *id ; //not owner, do not delete (nore use var) - id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(), getTotalNode()) ; + id = (Component_factory) ( _orb, new paco_omni_fabrique(), _poa, _id, instanceName.c_str(), getTotalNode()) ; // --- get reference & servant from id CORBA::Object_var obj = _poa->id_to_reference(*id); @@ -704,11 +712,11 @@ Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, // in the nameing service. _numInstanceMutex.lock() ; // lock on the instance number _numInstance++ ; -// int numInstance = _numInstance ; + // int numInstance = _numInstance ; _numInstanceMutex.unlock() ; } cerr << "Node " << getMyRank() << " entering in paco_barrier()" << endl; - global_paco_context_ptr->my_com->paco_barrier(); + _my_com->paco_barrier(); cerr << "Node " << getMyRank() << " quitting paco_barrier()" << endl; ////////////////////////////////////////////////////////////////////////// @@ -732,7 +740,7 @@ Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, string factory_name = aGenRegisterName + string("Engine_factory"); typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) - (CORBA::ORB_ptr, char * ior, + (CORBA::ORB_ptr, char *, int, PortableServer::POA_ptr, PortableServer::ObjectId *, const char *, @@ -758,7 +766,7 @@ Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, // --- Instanciate required CORBA object PortableServer::ObjectId *id ; //not owner, do not delete (nore use var) - id = (Component_factory) ( _orb, proxy_ior, _poa, _id, instanceName.c_str(), + id = (Component_factory) ( _orb, proxy_ior, getMyRank(), _poa, _id, instanceName.c_str(), aGenRegisterName.c_str() ) ; // --- get reference & servant from id @@ -777,11 +785,17 @@ Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, ////////////////////////////////////////////////////////////////////////// // 3: Deployment Step - iobject2->deploy(getMyRank()); - global_paco_context_ptr->my_com->paco_barrier(); + iobject2->deploy(); + _my_com->paco_barrier(); cerr << "--------- createParallelInstance : End Deploy step ----------" << endl; + if (getMyRank() == 0) { + PaCO::InterfaceManager_var proxy = PaCO::InterfaceManager::_narrow(iobject); + proxy->start(); + _my_com->paco_barrier(); + } + else + _my_com->paco_barrier(); - // return obj_proxy._retn(); return iobject._retn(); } @@ -954,22 +968,22 @@ Engines_Parallel_Container_i::createFileRef(const char* origFileName) Engines::fileRef_var theFileRef = Engines::fileRef::_nil(); if (origName[0] != '/') - { - INFOS("path of file to copy must be an absolute path begining with '/'"); - return Engines::fileRef::_nil(); - } + { + INFOS("path of file to copy must be an absolute path begining with '/'"); + return Engines::fileRef::_nil(); + } if (CORBA::is_nil(_fileRef_map[origName])) - { - CORBA::Object_var obj=_poa->id_to_reference(*_id); - Engines::Container_var pCont = Engines::Container::_narrow(obj); - fileRef_i* aFileRef = new fileRef_i(pCont, origFileName); - theFileRef = Engines::fileRef::_narrow(aFileRef->_this()); - _numInstanceMutex.lock() ; // lock to be alone (stl container write) - _fileRef_map[origName] = theFileRef; - _numInstanceMutex.unlock() ; - } - + { + CORBA::Object_var obj=_poa->id_to_reference(*_id); + Engines::Container_var pCont = Engines::Container::_narrow(obj); + fileRef_i* aFileRef = new fileRef_i(pCont, origFileName); + theFileRef = Engines::fileRef::_narrow(aFileRef->_this()); + _numInstanceMutex.lock() ; // lock to be alone (stl container write) + _fileRef_map[origName] = theFileRef; + _numInstanceMutex.unlock() ; + } + theFileRef = Engines::fileRef::_duplicate(_fileRef_map[origName]); ASSERT(! CORBA::is_nil(theFileRef)); return theFileRef._retn(); @@ -996,25 +1010,25 @@ Engines_Parallel_Container_i::createSalome_file(const char* origFileName) { string origName(origFileName); if (CORBA::is_nil(_Salome_file_map[origName])) + { + Salome_file_i* aSalome_file = new Salome_file_i(); + try { - Salome_file_i* aSalome_file = new Salome_file_i(); - try - { - aSalome_file->setLocalFile(origFileName); - aSalome_file->recvFiles(); - } - catch (const SALOME::SALOME_Exception& e) - { - return Engines::Salome_file::_nil(); - } - - Engines::Salome_file_var theSalome_file = Engines::Salome_file::_nil(); - theSalome_file = Engines::Salome_file::_narrow(aSalome_file->_this()); - _numInstanceMutex.lock() ; // lock to be alone (stl container write) - _Salome_file_map[origName] = theSalome_file; - _numInstanceMutex.unlock() ; + aSalome_file->setLocalFile(origFileName); + aSalome_file->recvFiles(); } - + catch (const SALOME::SALOME_Exception& e) + { + return Engines::Salome_file::_nil(); + } + + Engines::Salome_file_var theSalome_file = Engines::Salome_file::_nil(); + theSalome_file = Engines::Salome_file::_narrow(aSalome_file->_this()); + _numInstanceMutex.lock() ; // lock to be alone (stl container write) + _Salome_file_map[origName] = theSalome_file; + _numInstanceMutex.unlock() ; + } + Engines::Salome_file_ptr theSalome_file = Engines::Salome_file::_duplicate(_Salome_file_map[origName]); ASSERT(!CORBA::is_nil(theSalome_file)); diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx index 962bc9a1d..7eaef5c7b 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx @@ -64,8 +64,8 @@ class CONTAINER_EXPORT Engines_Parallel_Container_i: public virtual PortableServer::RefCountServantBase { public: - Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior); - Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, + Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank); + Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank, PortableServer::POA_ptr poa, char * containerName , int argc, char* argv[], diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index 58eb63d01..0b85c6bfb 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -137,37 +137,47 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) else _resource.Alias = ""; - xmlChar* protocol= xmlGetProp(aCurNode, (const xmlChar*)test_protocol); - switch ( protocol[0]) - { - case 'r': - _resource.Protocol = rsh; - break; - case 's': - _resource.Protocol = ssh; - break; - default: - // If it'not in all theses cases, the protocol is affected to rsh - _resource.Protocol = rsh; - break; - } - xmlFree(protocol); + if (xmlHasProp(aCurNode, (const xmlChar*)test_protocol)) + { + xmlChar* protocol= xmlGetProp(aCurNode, (const xmlChar*)test_protocol); + switch ( protocol[0]) + { + case 'r': + _resource.Protocol = rsh; + break; + case 's': + _resource.Protocol = ssh; + break; + default: + // If it'not in all theses cases, the protocol is affected to rsh + _resource.Protocol = rsh; + break; + } + xmlFree(protocol); + } + else + _resource.Protocol = rsh; - xmlChar* mode=xmlGetProp(aCurNode, (const xmlChar*)test_mode); - switch ( mode[0] ) + if (xmlHasProp(aCurNode, (const xmlChar*)test_mode)) { - case 'i': - _resource.Mode = interactive; - break; - case 'b': - _resource.Mode = batch; - break; - default: - // If it'not in all theses cases, the mode is affected to interactive - _resource.Mode = interactive; - break; + xmlChar* mode=xmlGetProp(aCurNode, (const xmlChar*)test_mode); + switch ( mode[0] ) + { + case 'i': + _resource.Mode = interactive; + break; + case 'b': + _resource.Mode = batch; + break; + default: + // If it'not in all theses cases, the mode is affected to interactive + _resource.Mode = interactive; + break; + } + xmlFree(mode); } - xmlFree(mode); + else + _resource.Mode = interactive; if (xmlHasProp(aCurNode, (const xmlChar*)test_batch)) { diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index d693227a1..f282ac735 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -1040,9 +1040,9 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::s //command = "gdb --args "; //command = "valgrind --tool=memcheck --log-file=val_log "; //command += real_exe_name; - + command = real_exe_name; - + command += " " + _NS->ContainerName(rtn); command += " " + parallelLib; command += " " + hostname; @@ -1050,7 +1050,7 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::s AddOmninamesParams(command); } - if (parallelLib == "Mpi") + else if (parallelLib == "Mpi") { // Step 1 : check if MPI is started if (_MpiStarted == false) @@ -1084,6 +1084,11 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::s AddOmninamesParams(command); } } + else + { + std::string message("Unknown parallelLib" + parallelLib); + throw SALOME_Exception(message.c_str()); + } // log choice if (log == "default") diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx index e2646765c..57c00c16f 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -136,6 +136,8 @@ SALOMEDS_EXPORT SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, root_poa); // Activate the objects. This tells the POA that the objects are ready to accept requests. PortableServer::ObjectId_var aStudyManager_iid = root_poa->activate_object(aStudyManager_i); + //give ownership to the poa : the object will be deleted by the poa + aStudyManager_i->_remove_ref(); aStudyManager_i->register_name("/myStudyManager"); } return new SALOMEDS_StudyManager(); diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.hxx b/src/SALOMEDS/SALOMEDS_Driver_i.hxx index 321b188cf..da3a87e2e 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.hxx @@ -117,7 +117,7 @@ public: class SALOMEDS_DriverFactory_i : public virtual SALOMEDSImpl_DriverFactory { protected: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOME_NamingService* _name_service; public: diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index b2d2dd913..8ecce2d4b 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -161,6 +161,7 @@ int main(int argc, char** argv) // ready to accept requests. PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i); myStudyManager_i->register_name("/myStudyManager"); + myStudyManager_i->_remove_ref(); // Obtain a POAManager, and tell the POA to start accepting // requests on its objects. diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index f06c882ba..7c5abcb94 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -87,6 +87,7 @@ SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i() { // Destroy directory to register open studies _name_service->Destroy_Directory("/Study"); + delete _name_service; delete _factory; delete _impl; } diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index 41118c5db..a7ec9b17e 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -54,7 +54,7 @@ class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; PortableServer::POA_var _poa; SALOMEDSImpl_StudyManager* _impl; SALOME_NamingService* _name_service; diff --git a/src/SALOMELocalTrace/FileTraceCollector.cxx b/src/SALOMELocalTrace/FileTraceCollector.cxx index f76e18ef6..d64f5eafb 100644 --- a/src/SALOMELocalTrace/FileTraceCollector.cxx +++ b/src/SALOMELocalTrace/FileTraceCollector.cxx @@ -182,6 +182,7 @@ FileTraceCollector:: ~FileTraceCollector() int ret = pthread_join(*_threadId, NULL); if (ret) cerr << "error close FileTraceCollector : "<< ret << endl; else DEVTRACE("FileTraceCollector destruction OK"); + delete _threadId; _threadId = 0; _threadToClose = 0; } diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.cxx b/src/SALOMETraceCollector/SALOMETraceCollector.cxx index 408c56d87..73163eea4 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.cxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.cxx @@ -188,6 +188,7 @@ SALOMETraceCollector:: ~SALOMETraceCollector() int ret = pthread_join(*_threadId, NULL); if (ret) cerr << "error close SALOMETraceCollector : "<< ret << endl; else DEVTRACE("SALOMETraceCollector destruction OK"); + delete _threadId; _threadId = 0; _threadToClose = 0; } diff --git a/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx b/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx index a2544b6ce..c48e4afd9 100644 --- a/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx +++ b/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx @@ -34,6 +34,7 @@ #include #include #include +#include //# include "utilities.h" /*!\class DESTRUCTEUR_GENERIQUE_ @@ -111,11 +112,13 @@ public : typedef PortableServer::ServantBase TServant; if(_PtrObjet){ if(TServant* aServant = dynamic_cast(_PtrObjet)){ - //cerr << "DESTRUCTEUR_GENERIQUE_::operator() deleting ServantBase's _PtrObjet" << endl; + std::cerr << "WARNING: automatic destruction for servant is no more used. It's too late in exit. Use explicit call" << std::endl; + /* PortableServer::POA_var aPOA = aServant->_default_POA(); PortableServer::ObjectId_var anObjectId = aPOA->servant_to_id(aServant); aPOA->deactivate_object(anObjectId.in()); aServant->_remove_ref(); + */ }else{ //cerr << "DESTRUCTEUR_GENERIQUE_::operator() deleting _PtrObjet" << endl; TYPE* aPtr = static_cast(_PtrObjet); diff --git a/src/Utils/Utils_ORB_INIT.cxx b/src/Utils/Utils_ORB_INIT.cxx index 1cb869e11..e2649a580 100644 --- a/src/Utils/Utils_ORB_INIT.cxx +++ b/src/Utils/Utils_ORB_INIT.cxx @@ -40,13 +40,16 @@ ORB_INIT::~ORB_INIT() { if ( ! CORBA::is_nil( _orb ) ) { + std::cerr << "WARNING: orb destroy is no more called at exit. Use explicit call." << std::endl; //std::cerr << "appel _orb->destroy()" << std::endl; + /* try { _orb->destroy() ; } catch(...) { MESSAGE("Caught CORBA::Exception."); } + */ //std::cerr << "retour _orb->destroy()" << std::endl; } } -- 2.39.2