[vtkusers] MPI Volume Rendering

John Biddiscombe biddisco at cscs.ch
Fri May 5 02:43:15 EDT 2006


Kevin,

I'm not going to answer your question, but a quick glance at your code 
tells me that

you are loading the data on one process, then using distributed data 
filter to send it to others, then render.

Much better is to load the data in pieces on each processor, then render 
and composite afterwards. (I may have misread things because each 
processor could be receiving a different file name as argument)

on each processor, load a piece, render it, the composite on the client 
or master node. If volume pieces are contiguous blocks then transparency 
will be handled by sorting the composition order...

anyway, I expect you know all this. sorry

JB


> I'm trying to do volume rendering on our cluster. Eventually I want to
> make animations but for now I'll settle for one frame.
> 
> I must have made some mistake. The error and particularly the big
> negative number make me think there's something uninitialized, but I
> can't see it.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information v
> ector from input port index -1073759367 for algorithm vtkXMLUnstructuredGridRead
> er(0x84ced80), which has 0 input ports.
> 
> 
> ------------------------------------------------------------------------
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e7180): Attempt to get input information vector from input port index -1073747104 for algorithm vtkXMLUnstructuredGridReader(0x84cf0e0), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073747080 for algorithm vtkXMLUnstructuredGridReader(0x84ced90), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073759367 for algorithm vtkXMLUnstructuredGridReader(0x84ced80), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073759367 for algorithm vtkXMLUnstructuredGridReader(0x84ced80), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073755271 for algorithm vtkXMLUnstructuredGridReader(0x84ced90), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073751176 for algorithm vtkXMLUnstructuredGridReader(0x84ced90), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e58): Attempt to get input information vector from input port index -1073747079 for algorithm vtkXMLUnstructuredGridReader(0x84ceda0), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073759367 for algorithm vtkXMLUnstructuredGridReader(0x84ced90), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073747080 for algorithm vtkXMLUnstructuredGridReader(0x84ced90), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073751175 for algorithm vtkXMLUnstructuredGridReader(0x84ced90), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e58): Attempt to get input information vector from input port index -1073751176 for algorithm vtkXMLUnstructuredGridReader(0x84ceda0), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e58): Attempt to get input information vector from input port index -1073759367 for algorithm vtkXMLUnstructuredGridReader(0x84ceda0), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e50): Attempt to get input information vector from input port index -1073759367 for algorithm vtkXMLUnstructuredGridReader(0x84ced90), which has 0 input ports.
> 
> ERROR: In /home/khobbs/kitware/VTK/Filtering/vtkExecutive.cxx, line 373
> vtkStreamingDemandDrivenPipeline (0x84e6e58): Attempt to get input information vector from input port index -1073751175 for algorithm vtkXMLUnstructuredGridReader(0x84ceda0), which has 0 input ports.
> 
> mpiexec: Warning: tasks 0-13 died with signal 11 (Segmentation fault).
> 
> 
> ------------------------------------------------------------------------
> 
> #include "vtkXMLUnstructuredGridReader.h"
> #include "vtkParallelFactory.h"
> #include "vtkCamera.h"
> #include "vtkMPIController.h"
> #include "vtkMPICommunicator.h"
> #include "vtkObjectFactory.h"
> #include "vtkCompositeRenderManager.h"
> #include "vtkDistributedDataFilter.h"
> 
> #include "vtkUnstructuredGrid.h"
> #include "vtkDataSetTriangleFilter.h"
> #include "vtkPiecewiseFunction.h"
> #include "vtkColorTransferFunction.h"
> #include "vtkVolumeProperty.h"
> #include "vtkUnstructuredGridVolumeRayCastMapper.h"
> #include "vtkVolume.h"
> 
> #include "vtkRenderer.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> 
> struct args_struct
> {
> 	int argc;
>       	char** argv;
> };
> 
> #define WSIZE 864
> 
> static void Run(vtkMultiProcessController * controller, void *arg)
> {
> 	args_struct * args = reinterpret_cast<args_struct *>(arg);
> 	char* in_file_name = args->argv[1];
> 	
> 	int myid = controller->GetLocalProcessId();
>   	int num_procs = controller->GetNumberOfProcesses();
> 	
> 	
> 	// Reader
> 	vtkXMLUnstructuredGridReader * reader 
> 		= vtkXMLUnstructuredGridReader::New();
> 	reader->SetFileName( in_file_name );
> 
> 	/*
> 	// Distributed Data Filter
> 	vtkDistributedDataFilter * dist_dat_filter 
> 		= vtkDistributedDataFilter::New();
> 	dist_dat_filter->SetController( controller );
> 	//dist_dat_filter->SetBoundaryModeToSplitBoundaryCells();
> 	
> 	dist_dat_filter->UseMinimalMemoryOff();
> 	dist_dat_filter->SetInputConnection
> 		( reader->GetOutputPort() );
> 	*/
> 	
> 	// Triangle Filter
> 	vtkDataSetTriangleFilter * triangle_filter 
> 		= vtkDataSetTriangleFilter::New();
> 	triangle_filter->SetInputConnection
> 		( reader->GetOutputPort() );
> 
> 	// Opacity
> 	vtkPiecewiseFunction * opacity 
> 		= vtkPiecewiseFunction::New();
> 	opacity->AddPoint(  5500, 0.0 );
> 	opacity->AddPoint( 26158, 1.0 );
> 
> 	// Color
> 	vtkColorTransferFunction * color 
> 		= vtkColorTransferFunction::New();
> 	color->AddRGBPoint(  5500, 0.0, 0.0, 0.0 );
> 	color->AddRGBPoint( 10665, 0.0, 0.0, 1.0 );
> 	color->AddRGBPoint( 15829, 1.0, 0.0, 0.0 );
> 	color->AddRGBPoint( 20994, 0.0, 1.0, 0.0 );
> 	color->AddRGBPoint( 26158, 0.0, 1.0, 1.0 );
> 	
> 	// Volume Property
> 	vtkVolumeProperty * vol_prop = vtkVolumeProperty::New();
> 	vol_prop->SetColor( color );
> 	vol_prop->SetScalarOpacity( opacity );
> 	vol_prop->ShadeOff();
> 	vol_prop->SetInterpolationTypeToLinear();
> 	
> 	// Mapper
> 	vtkUnstructuredGridVolumeRayCastMapper * mapper 
> 		= vtkUnstructuredGridVolumeRayCastMapper::New();
> 	mapper->SetInputConnection( triangle_filter->GetOutputPort() );
>       	mapper->SetScalarModeToUsePointData();
>       	mapper->SelectScalarArray( "Scalars_" );
> 
> 	// Volume
> 	vtkVolume * volume = vtkVolume::New();
> 	volume->SetMapper( mapper );
> 	volume->SetProperty( vol_prop );
> 	
> 	// Render Manager
> 	vtkCompositeRenderManager * manager 
> 		= vtkCompositeRenderManager::New();
> 
> 	// Renderer
> 	vtkRenderer * renderer = manager->MakeRenderer();
>       	renderer->AddVolume( volume );
> 
> 	vtkRenderWindow * render_window 
> 		= manager->MakeRenderWindow();
> 	render_window->SetOffScreenRendering(1);
>       	render_window->AddRenderer( renderer );
> 
> 	renderer->SetBackground( 0, 0, 0 );
>       	render_window->SetSize( WSIZE, WSIZE );
> 	int wp = WSIZE - WSIZE * (double) myid / num_procs;
>       	render_window->SetPosition( wp, wp);
> 
> 	manager->SetRenderWindow( render_window );
> 	manager->SetController( controller );
> 
> 	manager->InitializeOffScreen();
> 
> 	//mapper->SetPiece( myid );
>       	//mapper->SetNumberOfPieces( num_procs );
>       	mapper->Update();
> 
> 	// Interactor
> 	vtkRenderWindowInteractor * interactor 
> 		= vtkRenderWindowInteractor::New();
> 	interactor->SetRenderWindow( render_window );
> 
> 	if ( myid == 0 )
> 	{
> 		renderer->ResetCamera();
> 		vtkCamera * camera 
> 			= renderer->GetActiveCamera();
> 		camera->UpdateViewport(renderer);
> 	    	camera->ParallelProjectionOn();
> 	    	camera->SetParallelScale( 14 );
> 
> 		render_window->Render();
> 		render_window->Render();
> 
> 		manager->StartInteractor();
> 		
> 		manager->StopServices();
> 	}
> 	else
> 	{
> 		
> 		manager->StartServices();
> 	}
> 
> 	// Clean Up
> 	mapper->Delete();
> 	triangle_filter->Delete();
> 	opacity->Delete();
> 	color->Delete();
> 	vol_prop->Delete();
> 	volume->Delete();
> 	renderer->Delete();
> 	render_window->Delete();
> 
> 	//dist_dat_filter->Delete();
> 	
> 	manager->Delete();
> }
> 
> int main(int argc, char **argv)
> {
> 	//char* in_file_name = argv[1];
> 	//int pieces = atoi( argv[2] );
> 	
> 	// Controller
> 	vtkMPIController * controller 
> 		= vtkMPIController::New();
>       	controller->Initialize(&argc, &argv);
> 
> 	vtkMultiProcessController::SetGlobalController
> 		(controller);
> 
> 	args_struct args;
> 	args.argc = argc;
> 	args.argv = argv;
> 	
> 	controller->SetSingleMethod(Run, &args);
> 	controller->SingleMethodExecute();
> 	
> 	controller->Finalize();
>       	controller->Delete();
>       	return 0;
> }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers


-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82




More information about the vtkusers mailing list