<div dir="ltr"><div><div>Hi,<br><br></div>Glad to hear that this is working for you and thanks for sharing how you did it! This is definitely a corner case that few Catalyst users/developers will ever care about so I'm glad that the Catalyst API is flexible enough to handle this. <br><br></div><div>Best,<br></div><div>Andy<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 19, 2016 at 4:07 AM,  <span dir="ltr"><<a href="mailto:u.utku.turuncoglu@be.itu.edu.tr" target="_blank">u.utku.turuncoglu@be.itu.edu.tr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Andy,<br>
<br>
I used first approach and fix the issue using following customised<br>
coprocessorinitializewithpython function. In this case, i converted type<br>
of communicator coming from Fortran to C using MPI_Comm_f2c call. Now, the<br>
code works without any problem. Thanks for your kindly help.<br>
<br>
extern "C" void my_coprocessorinitializewithpython_(int *fcomm, const<br>
<span class="">char* pythonScriptName, const char strarr[][255], int *size) {<br>
  if (pythonScriptName != NULL) {<br>
    if (!g_coprocessor) {<br>
      g_coprocessor = vtkCPProcessor::New();<br>
</span>      MPI_Comm handle = MPI_Comm_f2c(*fcomm);<br>
      vtkMPICommunicatorOpaqueComm *Comm = new<br>
vtkMPICommunicatorOpaqueComm(&handle);<br>
      g_coprocessor->Initialize(*Comm);<br>
<span class="">      vtkSmartPointer<vtkCPPythonScriptPipeline> pipeline =<br>
vtkSmartPointer<vtkCPPythonScriptPipeline>::New();<br>
      pipeline->Initialize(pythonScriptName);<br>
      g_coprocessor->AddPipeline(pipeline);<br>
      //pipeline->FastDelete();<br>
    }<br>
<br>
    if (!g_coprocessorData) {<br>
      g_coprocessorData = vtkCPDataDescription::New();<br>
      // must be input port for all model components and for all dimensions<br>
      for (int i = 0; i < *size; i++) {<br>
        g_coprocessorData->AddInput(strarr[i]);<br>
        std::cout << "adding input port [" << i << "] = " << strarr[i] <<<br>
std::endl;<br>
      }<br>
    }<br>
  }<br>
}<br>
<br>
</span>Regards,<br>
<br>
--ufuk<br>
<span class=""><br>
> Hi Ufuk,<br>
><br>
> I can think of two potential fixes:<br>
><br>
</span>>    - Use the vtkCPProcessor:: Initialize(vtkMPICommunicatorOpaqueComm&<br>
<span class="">>    comm) method to initialize each process with the proper MPI<br>
> communicator.<br>
>    Note that vtkMPICommunicatorOpaqueComm is defined in<br>
>    vtkMPICommunicator.cxx. A similar example to this is available in the<br>
>    Examples/Catalyst/MPISubCommunicatorExample directory.<br>
</span>>    - Call vtkCPProcessor::Initialize() on all processes with your global<br>
<div class="HOEnZb"><div class="h5">>    communicator and then create a vtkMPIController partitioned the way you<br>
>    want and set that to be the "global" communicator through<br>
>    vtkMPIController::SetGlobalController().<br>
><br>
> Please let us know if either of these methods work for you.<br>
><br>
> Also, what code are you working on and is it a publicly available code? If<br>
> you show your implementation I may have some in-depth suggestions for<br>
> improvements.<br>
><br>
> Best,<br>
><br>
> Andy<br>
><br>
><br>
><br>
> On Fri, Jun 17, 2016 at 4:17 AM, <<a href="mailto:u.utku.turuncoglu@be.itu.edu.tr">u.utku.turuncoglu@be.itu.edu.tr</a>> wrote:<br>
><br>
>> Hi All,<br>
>><br>
>> I was working on the issue recently and i am very close to having<br>
>> prototype code but i had some difficulties in initialization of the<br>
>> co-processing component with coprocessorinitializewithpython call. In my<br>
>> case, two model components and adaptor have its own processing source<br>
>> (or<br>
>> MPI_COMM_WORLD). For example, MPI processor 0, 1, 2, 3 are used by 1st<br>
>> model, 4, 5, 6, 7 are used by 2nd model code and 8, 9, 10, 11 is used by<br>
>> adaptor. The code basically handles transferring the grid information<br>
>> and<br>
>> data to adaptor. So, the problem is that if i try to call my custom<br>
>> coprocessorinitializewithpython call in adaptor (only in 8, 9, 10, 11)<br>
>> then it hangs in g_coprocessor->Initialize(); (see code at the end of<br>
>> the<br>
>> mail) step but if i call coprocessorinitializewithpython in the main<br>
>> code<br>
>> that uses all the available processor (between 0 and 11) and it runs<br>
>> without any problem. It seems that there is a restriction in the<br>
>> ParaView<br>
>> side (expecially vtkCPProcessor::Initialize() that can be found in<br>
>> CoProcessing/Catalyst/vtkCPProcessor.cxx) but i am not sure. Do you have<br>
>> any suggestion about that? Do you think that is it possible to fix it<br>
>> easily. Of corse the adaptor code could use all the processor but it is<br>
>> better to have its own dedicated resource that might have GPU support in<br>
>> those specific servers or processors. I am relatively new to VTK and it<br>
>> might be difficult for me to fix it and i need your guidance to start.<br>
>><br>
>> Best Regards,<br>
>><br>
>> --ufuk<br>
>><br>
>> vtkCPProcessor* g_coprocessor;<br>
>><br>
>> extern "C" void my_coprocessorinitializewithpython_(const char*<br>
>> pythonScriptName, const char strarr[][255], int *size) {<br>
>>   if (pythonScriptName != NULL) {<br>
>>     if (!g_coprocessor) {<br>
>>       g_coprocessor = vtkCPProcessor::New();<br>
>>       g_coprocessor->Initialize();<br>
>>       vtkSmartPointer<vtkCPPythonScriptPipeline> pipeline =<br>
>> vtkSmartPointer<vtkCPPythonScriptPipeline>::New();<br>
>>       pipeline->Initialize(pythonScriptName);<br>
>>       g_coprocessor->AddPipeline(pipeline);<br>
>>       //pipeline->FastDelete();<br>
>>     }<br>
>><br>
>>     if (!g_coprocessorData) {<br>
>>       g_coprocessorData = vtkCPDataDescription::New();<br>
>>       // must be input port for all model components and for all<br>
>> dimensions<br>
>>       for (int i = 0; i < *size; i++) {<br>
>>         g_coprocessorData->AddInput(strarr[i]);<br>
>>         std::cout << "adding input port [" << i << "] = " << strarr[i]<br>
>> <<<br>
>> std::endl;<br>
>>       }<br>
>>     }<br>
>>   }<br>
>> }<br>
>><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Please keep messages on-topic and check the ParaView Wiki at:<br>
>> <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
>><br>
>> Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
>><br>
><br>
<br>
</div></div></blockquote></div><br></div>