[vtkusers] Help with vtkMPIController

595693085 595693085 at qq.com
Wed Apr 19 21:00:12 EDT 2017


Dear VTK users:
   I'm a new learner of vtk and mpi, and I'm trying to do volume rendering on a cluster(ubuntu).I heared "vtkCompositeRenderManager" or "vtkIceTCompositePass" might realize it. But I have met some problems at the beginning when using vtkMPIController->Initialize() in a simple code. When I run it on a single computer, it's fine, but when I run it with "mpiexec -np 4 -f machine_config ./HelloWorld" command, some errors have occurred as follows:


Generic Warning: In /home/root/Development/DevelopmentTools/VTK_Source/VTK-7.1.1/Parallel/MPI/vtkMPICommunicator.cxx, line 72
MPI had an error
------------------------------------------------
Unknown error class, error stack:
PMPI_Comm_dup(177)....................: MPI_Comm_dup(MPI_COMM_WORLD, new_comm=0x6ddc40) failed
PMPI_Comm_dup(162)....................:
MPIR_Comm_dup_impl(57)................:
MPIR_Comm_copy(739)...................:
MPIR_Get_contextid_sparse_group(500)..:
MPIR_Allreduce_impl(764)..............:
MPIR_Allreduce_intra(257).............:
allreduce_intra_or_coll_fn(163).......:
MPIR_Allreduce_intra(417).............:
MPIDU_Complete_posted_with_error(1137): Process failed
------------------------------------------------


  I have googled it for a long time, but  there are fewer similar problems.And what I have tried are as follows:
  (1)When build VTK with cmake, I turn on the flag for Module_vtkParallelMPI,VTK_Group_MPI and other options including "parallel" and "mpi". And I also set the MPIEXE_MAX_NUMPROS and VTK_MPI_MAX_NUMPROS to 256.
  (2)when using comand such as "mpiexec -np 8 ./HelloWorld", it's Ok, but when I use "mpiexec -np 8 -f machine_config ./HelloWorld" on multiple nodes, MPI errors occurred. In addition, when using "mpiexec -np 8 -f machine_config ./OtherMPICodes" on other MPI codes, it's also fine. So I just want to know what else is needed to run the vtk-mpi program.
  (3)I have added some "printf" messages in the vtk-mpi code, and I found the error ocurred when "vtkMPIController->Initialize()", So I think the error might be associated with the execute command.
  (4)I am new at programming expecially in mpi and I also know little about cmakelists. So the error also might be associated with my code and cmake files. I will paste them in the end.


  I am not from an English spenking conutry, and I struggled with vtk learnning. But my teacher told me vtk is a very good tool and thus I will not give up. Howerer, this issure has annoyed me for nearly a week. Could you give me some suggestions...Any help is appreciated!


====================================code===========================================
  Code:
  #include <vtkMPIController.h>
  #include <vtkSphere.h>
  #include <stdio.h>


  void process(vtkMultiProcessController* controller, void* vtkNotUsed(arg))
  {
    int myId = controller->GetLocalProcessId();
    int processes_number= controller->GetNumberOfProcesses();
    printf("Hello from %d of %d!\n",myId,processes_number);
  }


  int main( int argc, char* argv[] )
  {
    printf("test0\n");
    vtkMPIController* controller = vtkMPIController::New();
    printf("test1\n");
    controller->Initialize(&argc, &argv);
    if (controller->IsA("vtkThreadedController"))
    {
      // Set the number of processes to 8 for this example.
      controller->SetNumberOfProcesses(8);
    }
 
    int numProcs = controller->GetNumberOfProcesses();
    controller->SetSingleMethod(process, 0);
    controller->SingleMethodExecute();
    controller->Finalize();
    controller->Delete();


    return 0;
  }


====================================cmakelists===========================================
  cmakelists:
  cmake_minimum_required(VERSION 2.8)
  #find_package(MPI REQUIRED)
  find_package(VTK COMPONENTS
    vtkParallelMPI
    vtkRenderingParallel
    )
  include(${VTK_USE_FILE})
  #ADD_DEFINITIONS("-DMPICH_IGNORE_CXX_SEEK")
  ADD_EXECUTABLE(mpi_composite mpi_composite.cpp)
  TARGET_LINK_LIBRARIES (mpi_composite ${VTK_LIBRARIES})


====================================machine_config===========================================
  machine_config(all install vtk, mpi and can run other MPI codes except vtk-mpi codes):
  host1-machine:2
  host2-machine:2
  host3-machine:2
  host4-machine:2
 
  PS.:Could you tell me whether vtk can realize parallel volume rendering with dicom files in multiple nodes?I have realized it with   volume render in a single computer, but I'm not sure whether it can be realized with mpi in multiple nodes..Thanks.


                                                                                                                                  a struggling college student.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170420/6d63cc07/attachment.html>


More information about the vtkusers mailing list