Salome HOME
[EDF26936] : End of the 2GB limit.
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 10 Feb 2023 16:08:37 +0000 (17:08 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Feb 2023 14:08:57 +0000 (15:08 +0100)
src/runtime/CMakeLists.txt
src/runtime/PythonNode.cxx

index abf7c05a6e9c2ea19ab38ba7a48b28be2045c3a4..1ef9ffcea9248dc8c4228d5c9c81c2ccd822fa42 100644 (file)
@@ -39,6 +39,7 @@ IF(SALOME_YACS_USE_KERNEL)
     ResourcesManager 
     SalomeHDFPersist 
     SalomeGenericObj
+    SalomeCommunication
     )
   SET(SALOME_INCL_PATH ${KERNEL_INCLUDE_DIRS})
 
index 9cc71d542e14fbe4fe170b8ac98512caa0369c3d..33cfc9f68612d4f86d52fcdbd640f13fd51b29e1 100644 (file)
@@ -27,6 +27,8 @@
 #include "SalomeHPContainer.hxx"
 #include "SalomeContainerTmpForHP.hxx"
 #include "ConversionException.hxx"
+#include "ReceiverFactory.hxx"
+#include "SenderByteImpl.hxx"
 
 #include "PyStdout.hxx"
 #include <iostream>
@@ -417,8 +419,8 @@ void PythonNode::executeRemote()
       loadPythonAdapter(this,dummy);
       _pynode->assignNewCompiledCode(getScript().c_str());
     }
-  //
-  std::unique_ptr<Engines::pickledArgs> serializationInputCorba(new Engines::pickledArgs);
+  // not managed by unique_ptr here because destructed by the order of client.
+  SenderByteImpl *serializationInputCorba = nullptr;
   AutoPyRef serializationInput;
   {
 #if PY_VERSION_HEX < 0x03070000
@@ -446,12 +448,12 @@ void PythonNode::executeRemote()
       serializationInput.set(PyObject_CallFunctionObjArgs(_pyfuncSer,args,nullptr));
       Py_DECREF(args);
       //The pickled string may contain NULL characters so use PyString_AsStringAndSize
-      char *serializationInputC(0);
+      char *serializationInputC(nullptr);
       Py_ssize_t len;
       if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
         throw Exception("DistributedPythonNode problem in python pickle");
       // no copy here. The C byte array of Python is taken  as this into CORBA sequence to avoid copy
-      serializationInputCorba.reset(new Engines::pickledArgs(len,len,reinterpret_cast<CORBA::Octet *>(serializationInputC),0));
+      serializationInputCorba = new SenderByteImpl(serializationInputC,len);
   }
 
   //get the list of output argument names
@@ -472,14 +474,15 @@ void PythonNode::executeRemote()
   // Execute in remote Python node
   //===========================================================================
   DEBTRACE( "-----------------starting remote python invocation-----------------" );
-  std::unique_ptr<Engines::pickledArgs> resultCorba;
+  SALOME::SenderByte_var resultCorba;
   try
     {
       //pass outargsname and dict serialized
-      _pynode->executeFirst(*(serializationInputCorba.get()));
+      SALOME::SenderByte_var serializationInputRef = serializationInputCorba->_this();
+      _pynode->executeFirst(serializationInputRef);
       //serializationInput and serializationInputCorba are no more needed for server. Release it.
-      serializationInputCorba.reset(nullptr); serializationInput.set(nullptr);
-      resultCorba.reset(_pynode->executeSecond(myseq));
+      serializationInput.set(nullptr);
+      resultCorba = _pynode->executeSecond(myseq);
     }
   catch( const SALOME::SALOME_Exception& ex )
     {
@@ -564,20 +567,23 @@ void PythonNode::executeRemote()
   //===========================================================================
   // Get results, unpickle and put them in output ports
   //===========================================================================
-  auto length(resultCorba->length());
-  char *resultCorbaC(reinterpret_cast<char *>(resultCorba->get_buffer()));
   {
 #if PY_VERSION_HEX < 0x03070000
       std::unique_lock<std::mutex> lock(data_mutex);
 #endif
       AutoGIL agil;
-      PyObject *args(0),*ob(0);
-      PyObject* resultPython=PyMemoryView_FromMemory(resultCorbaC,length,PyBUF_READ);
-      args = PyTuple_New(1);
-      PyTuple_SetItem(args,0,resultPython);
-      PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args);
-      resultCorba.reset(nullptr);
-      Py_DECREF(args);
+      PyObject *finalResult( nullptr), *ob( nullptr );
+      {
+        SeqByteReceiver recv(resultCorba);
+        PyObject *args(0);
+        unsigned long length = 0;
+        char *resultCorbaC = recv.data(length);
+        PyObject* resultPython=PyMemoryView_FromMemory(resultCorbaC,length,PyBUF_READ);
+        args = PyTuple_New(1);
+        PyTuple_SetItem(args,0,resultPython);
+        finalResult = PyObject_CallObject(_pyfuncUnser,args);
+        Py_DECREF(args);
+      }
 
       if (finalResult == NULL)
         {