include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+if WITH_PACO_PARALLEL
+MAKEFLAGS = -j1
+endif
+
AM_CXXFLAGS = -fPIC
BASEIDL_FILES = \
const Engines::MachineList& possibleComputers)
{
CORBA::Object_var obj;
+ PaCO::InterfaceManager_var proxy;
Engines::Container_ptr ret = Engines::Container::_nil();
Engines::MachineParameters params(params_const);
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");
PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
MESSAGE("[FindOrStartParallelContainer] Deploying node : " << name);
- node->deploy(i);
+ node->deploy();
}
+ proxy->start();
}
catch(CORBA::SystemException& e)
{
#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)
{
}
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;
}
{
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;
{
CORBA::Boolean rtn_bool = false;
PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(ref);
- node->deploy(getMyRank());
+ node->deploy();
rtn_bool = true;
return rtn_bool;
}
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,
#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);
// 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
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);
#endif
#include <paco_dummy.h>
+#include <paco_omni.h>
using namespace std;
*/
//=============================================================================
-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...");
*/
//=============================================================================
-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),
// 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
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());
// 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.
// 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
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
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,
#include <signal.h>
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
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)
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_<ORB_INIT>::Instance();
- ASSERT(SINGLETON_<ORB_INIT>::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 - "<<exc.what());
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
- return 0 ;
+ SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
+ // Get the proxy
+ string proxyNameInNS = ns->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 - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+ return 0 ;
}
#include <signal.h>
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
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)
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_<ORB_INIT>::Instance();
- ASSERT(SINGLETON_<ORB_INIT>::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;
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 - "<<exc.what());
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
-
- MPI_Finalize();
-
- return 0 ;
+ SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
+ // On récupère le proxy
+ string proxyNameInNS = ns->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 - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+
+ MPI_Finalize();
+
+ return 0 ;
}
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_<ORB_INIT>::Instance();
- ASSERT(SINGLETON_<ORB_INIT>::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_ParallelContainerProxy", 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 - "<<exc.what());
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
- return 0 ;
+ SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
+ Engines::Container_proxy_impl * proxy =
+ new Engines::Container_proxy_impl(orb,
+ new paco_omni_fabrique());
+
+ // PaCO++ code
+ paco_fabrique_manager* pfm = paco_getFabriqueManager();
+ pfm->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 - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+ return 0 ;
}
#include <signal.h>
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_<ORB_INIT>::Instance();
- ASSERT(SINGLETON_<ORB_INIT>::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 - "<<exc.what());
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
-
- MPI_Finalize();
-
- return 0 ;
+ SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
+ Engines::Container_proxy_impl * proxy =
+ new Engines::Container_proxy_impl(orb,
+ new paco_omni_fabrique());
+
+ // PaCO++ code
+ paco_fabrique_manager* pfm = paco_getFabriqueManager();
+ pfm->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 - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+
+ MPI_Finalize();
+
+ return 0 ;
}
int SIGUSR1 = 1000;
#endif
+#include <paco_omni.h>
#include "utilities.h"
using namespace std;
*/
//=============================================================================
-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)
{
}
*/
//=============================================================================
-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();
}
// 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;
}
typedef PortableServer::ObjectId * (*FACTORY_FUNCTION)
(CORBA::ORB_ptr,
+ paco_fabrique_thread *,
PortableServer::POA_ptr,
PortableServer::ObjectId *,
const char *,
// --- 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);
// 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;
//////////////////////////////////////////////////////////////////////////
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 *,
// --- 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
//////////////////////////////////////////////////////////////////////////
// 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();
}
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();
{
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));
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[],