Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/yacs.git] / src / MPIContainer / SALOME_MPIContainer.cxx
index d6fb4474fc110c4eb32072064f234926bab00d6f..bf2322190a7e30cf16008458e622172568d32045 100644 (file)
@@ -4,29 +4,26 @@
 #include "Utils_SINGLETON.hxx"
 #include "utilities.h"
 #include <mpi.h>
+#include "SALOMETraceCollector.hxx"
 using namespace std;
 
 int main(int argc, char* argv[])
 {
   int nbproc, numproc;
-  int flag;
   Engines_MPIContainer_i * myContainer=NULL;
 
-  BEGIN_OF(argv[0])
+  MPI_Init(&argc,&argv);
+  MPI_Comm_size(MPI_COMM_WORLD,&nbproc);
+  MPI_Comm_rank(MPI_COMM_WORLD,&numproc);
+
+  // Initialise the ORB.
+  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+  CORBA::ORB_var &orb = init( argc , argv ) ;
+  //  SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+  BEGIN_OF("[" << numproc << "] " << argv[0])
   try {
     
-    MESSAGE("Connection MPI");
-    MPI_Init(&argc,&argv);
-    MPI_Comm_size(MPI_COMM_WORLD,&nbproc);
-    MPI_Comm_rank(MPI_COMM_WORLD,&numproc);
-
-    MESSAGE("[" << numproc << "] Initialisation CORBA");
-    // Initialise the ORB.
-    //    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
-    ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
-    ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
-    CORBA::ORB_var &orb = init( argc , argv ) ;
     // Obtain a reference to the root POA.
     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
     PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
@@ -65,13 +62,12 @@ int main(int argc, char* argv[])
        containerName = argv[1] ;
     }
 
-    MESSAGE("[" << numproc << "] Chargement container");
+    MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant");
     myContainer = new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv);
 
     pman->activate();
 
     orb->run();
-    orb->destroy();
 
   }
   catch(CORBA::SystemException&){
@@ -92,10 +88,11 @@ int main(int argc, char* argv[])
 
   if(myContainer)
     delete myContainer;
-  MPI_Initialized(&flag);
-  if(flag)
-    MPI_Finalize();
 
-  END_OF(argv[0]);
+  END_OF("[" << numproc << "] " << argv[0]);
+  //  delete myThreadTrace;
+
+  MPI_Finalize();
+
 }