I have a VTS Writer using vtkXMLPStructuredGridWriter
. The program crash and reports Segmentation fault in Update()
.
Most of my code comes from https://stackoverflow.com/questions/24123432/composing-vtk-file-from-multiple-mpi-outputs, and his code run well. I don’t know what is the difference to make thing crashs.
Here is part of my code where the error happens.
// Create the parallel writer and call some functions
auto parallel_writer = vtkSmartPointer<vtkXMLPStructuredGridWriter>::New();
parallel_writer->SetInputConnection(programmable_filter->GetOutputPort());
parallel_writer->SetController(contr);
parallel_writer->SetFileName((filename + ".pvts").c_str());
parallel_writer->SetNumberOfPieces(mpi_size);
parallel_writer->SetStartPiece(mpi_rank);
parallel_writer->SetEndPiece(mpi_rank);
parallel_writer->SetDataModeToAppended();
parallel_writer->SetCompressorTypeToNone();
parallel_writer->EncodeAppendedDataOff();
parallel_writer->Update();
parallel_writer->Write();
Minimal reproduction is published to github.
https://github.com/CheapMeow/VTSWriter
Here is all of gdb report. I don’t know the exact meaning of VTK source code.
[0,1] Program received signal SIGSEGV, Segmentation fault.
[0] 0x00007f2d656a00af in vtkAlgorithm::GetOutputInformation (this=0x959020, port=0) at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkAlgorithm.cxx:1321
[1] 0x00007f46e3ebc0af in vtkAlgorithm::GetOutputInformation (this=0x2387020, port=0) at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkAlgorithm.cxx:1321
[0,1] 1321 return this->GetExecutive()->GetOutputInformation(port);
[0,1] (mpigdb)
[0] #0 0x00007f2d656a00af in vtkAlgorithm::GetOutputInformation (this=0x959020,
[1] #0 0x00007f46e3ebc0af in vtkAlgorithm::GetOutputInformation (this=0x2387020,
[0,1] port=0)
[0,1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkAlgorithm.cxx:1321
[0] #1 0x0000000000402d59 in VTSWriterMPI::VTSWriterMPI(int, int, int, double, int, char**)::{lambda(void*)#1}::operator()(void*) const (arg=0x7ffd02746170,
[1] #1 0x0000000000402d59 in VTSWriterMPI::VTSWriterMPI(int, int, int, double, int, char**)::{lambda(void*)#1}::operator()(void*) const (arg=0x7ffde52c3920,
[0,1] __closure=0x0)
[0,1] at <my_home>/ljc/VTSWriter/src/solver/io/vts_writer_mpi.h:56
[0,1] #2 VTSWriterMPI::VTSWriterMPI(int, int, int, double, int, char**)::{lambda(void*)#1}::_FUN(void*) ()
[0,1] at <my_home>/ljc/VTSWriter/src/solver/io/vts_writer_mpi.h:63
[0] #3 0x00007f2d65a30733 in vtkProgrammableFilter::RequestData (this=0x92bee0,
[1] #3 0x00007f46e424c733 in vtkProgrammableFilter::RequestData (this=0x2359ee0,
[0] inputVector=0x957a00, outputVector=0x956bc0)
[1] inputVector=0x2385a00, outputVector=0x2384bc0)
[0,1] at <my_home>/VTK-9.1.0/Filters/Programmable/vtkProgrammableFilter.cxx:254
[0] #4 0x00007f2d656dc46c in vtkPassInputTypeAlgorithm::ProcessRequest (
[1] #4 0x00007f46e3ef846c in vtkPassInputTypeAlgorithm::ProcessRequest (
[0] this=0x92bee0, request=0x958890, inputVector=0x957a00,
[1] this=0x2359ee0, request=0x2386890, inputVector=0x2385a00,
[0] outputVector=0x956bc0)
[1] outputVector=0x2384bc0)
[0,1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkPassInputTypeAlgorithm.cxx:161
[0] #5 0x00007f2d656ba630 in vtkExecutive::CallAlgorithm (this=0x9567d0,
[1] #5 0x00007f46e3ed6630 in vtkExecutive::CallAlgorithm (this=0x23847d0,
[0] request=0x958890, direction=1, inInfo=0x957a00, outInfo=0x956bc0)
[1] request=0x2386890, direction=1, inInfo=0x2385a00, outInfo=0x2384bc0)
[0,1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkExecutive.cxx:746
[0] #6 0x00007f2d656b2d5b in vtkDemandDrivenPipeline::ExecuteData (this=0x9567d0,
[1] #6 0x00007f46e3eced5b in vtkDemandDrivenPipeline::ExecuteData (
[0] request=0x958890, inInfo=0x957a00, outInfo=0x956bc0)
[1] this=0x23847d0, request=0x2386890, inInfo=0x2385a00, outInfo=0x2384bc0)
[0,1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:462
[0] #7 0x00007f2d656a87f9 in vtkCompositeDataPipeline::ExecuteData (
[1] #7 0x00007f46e3ec47f9 in vtkCompositeDataPipeline::ExecuteData (
[0] this=0x9567d0, request=0x958890, inInfoVec=0x957a00, outInfoVec=0x956bc0)
[1] this=0x23847d0, request=0x2386890, inInfoVec=0x2385a00,
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkCompositeDataPipeline.cxx:162
[1] outInfoVec=0x2384bc0)
[0] #8 0x00007f2d656b248f in vtkDemandDrivenPipeline::ProcessRequest (
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkCompositeDataPipeline.cxx:162
[0] this=0x9567d0, request=0x958890, inInfoVec=0x957a00, outInfoVec=0x956bc0)
[1] #8 0x00007f46e3ece48f in vtkDemandDrivenPipeline::ProcessRequest (
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:261
[1] this=0x23847d0, request=0x2386890, inInfoVec=0x2385a00,
[0] #9 0x00007f2d65765142 in vtkStreamingDemandDrivenPipeline::ProcessRequest (
[1] outInfoVec=0x2384bc0)
[0] this=0x9567d0, request=0x958890, inInfoVec=0x957a00, outInfoVec=0x956bc0)
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:261
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:343
[1] #9 0x00007f46e3f81142 in vtkStreamingDemandDrivenPipeline::ProcessRequest (
[0] #10 0x00007f2d656aaefe in vtkCompositeDataPipeline::ForwardUpstream (
[1] this=0x23847d0, request=0x2386890, inInfoVec=0x2385a00,
[0] this=0x957fe0, request=0x958890)
[1] outInfoVec=0x2384bc0)
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkCompositeDataPipeline.cxx:727
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:343
[0] #11 0x00007f2d656b236b in vtkDemandDrivenPipeline::ProcessRequest (
[1] #10 0x00007f46e3ec6efe in vtkCompositeDataPipeline::ForwardUpstream (
[0] this=0x957fe0, request=0x958890, inInfoVec=0x957680, outInfoVec=0x957950)
[1] this=0x2385fe0, request=0x2386890)
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:247
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkCompositeDataPipeline.cxx:727
[0] #12 0x00007f2d65765142 in vtkStreamingDemandDrivenPipeline::ProcessRequest (
[1] #11 0x00007f46e3ece36b in vtkDemandDrivenPipeline::ProcessRequest (
[0] this=0x957fe0, request=0x958890, inInfoVec=0x957680, outInfoVec=0x957950)
[1] this=0x2385fe0, request=0x2386890, inInfoVec=0x2385680,
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:343
[1] outInfoVec=0x2385950)
[0] #13 0x00007f2d656b2bb7 in vtkDemandDrivenPipeline::UpdateData (this=0x957fe0,
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:247
[0] outputPort=-1)
[1] #12 0x00007f46e3f81142 in vtkStreamingDemandDrivenPipeline::ProcessRequest (
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:420
[1] this=0x2385fe0, request=0x2386890, inInfoVec=0x2385680,
[0] #14 0x00007f2d657654c6 in vtkStreamingDemandDrivenPipeline::Update (
[1] outInfoVec=0x2385950)
[0] this=0x957fe0, port=-1, requests=0x0)
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:343
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:417
[1] #13 0x00007f46e3ecebb7 in vtkDemandDrivenPipeline::UpdateData (this=0x2385fe0,
[0] #15 0x00007f2d65765352 in vtkStreamingDemandDrivenPipeline::Update (
[1] outputPort=-1)
[0] this=0x957fe0, port=-1)
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:420
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:380
[1] #14 0x00007f46e3f814c6 in vtkStreamingDemandDrivenPipeline::Update (
[0] #16 0x00007f2d656a086e in vtkAlgorithm::Update (this=0x957bf0, port=-1)
[1] this=0x2385fe0, port=-1, requests=0x0)
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkAlgorithm.cxx:1421
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:417
[0] #17 0x00007f2d656a0839 in vtkAlgorithm::Update (this=0x957bf0)
[1] #15 0x00007f46e3f81352 in vtkStreamingDemandDrivenPipeline::Update (
[0] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkAlgorithm.cxx:1415
[1] this=0x2385fe0, port=-1)
[0] #18 0x0000000000403b7e in VTSWriterMPI::write_to_file (this=<optimized out>,
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:380
[0] filename=...)
[1] #16 0x00007f46e3ebc86e in vtkAlgorithm::Update (this=0x2385bf0, port=-1)
[0] at <my_home>/ljc/VTSWriter/src/solver/io/vts_writer_mpi.cpp:26
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkAlgorithm.cxx:1421
[0] #19 0x000000000040295f in main (argc=<optimized out>, argv=<optimized out>)
[1] #17 0x00007f46e3ebc839 in vtkAlgorithm::Update (this=0x2385bf0)
[0] at <my_home>/ljc/VTSWriter/src/manual_test/test.cpp:20
[1] at <my_home>/VTK-9.1.0/Common/ExecutionModel/vtkAlgorithm.cxx:1415
[1] #18 0x0000000000403b7e in VTSWriterMPI::write_to_file (this=<optimized out>,
[1] filename=...)
[1] at <my_home>/ljc/VTSWriter/src/solver/io/vts_writer_mpi.cpp:26
[1] #19 0x000000000040295f in main (argc=<optimized out>, argv=<optimized out>)
[1] at <my_home>/ljc/VTSWriter/src/manual_test/test.cpp:20
Thanks you for your reply!