Commit 656673bd authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: fix bugs in widgets and add tests for render server

parent acb20bc5
......@@ -30,10 +30,41 @@
void ReportCommand(const char* const* command, const char* name);
int ReportStatus(kwsysProcess* process, const char* name);
inline void PauseForServerStart()
{
#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
}
//----------------------------------------------------------------------------
int main(int argc, char* argv[])
{
int argStart = 1;
int testRenderServer = 0;
if(argc > 1)
{
if(strcmp(argv[1], "--test-render-server") == 0)
{
argStart = 2;
testRenderServer = 1;
fprintf(stderr, "Test Render Server\n");
}
}
// Allocate process managers.
kwsysProcess* renderServer = 0;
if(testRenderServer)
{
renderServer = kwsysProcess_New();
if(!renderServer)
{
cerr << "Cannot allocate kwsysProcess to run the render server.\n";
return 1;
}
}
kwsysProcess* server = kwsysProcess_New();
if(!server)
{
......@@ -55,6 +86,18 @@ int main(int argc, char* argv[])
#endif
paraview += "/paraview";
// Construct the render server process command line
if(renderServer)
{
// Construct the server process command line.
kwsys_stl::vector<const char*> renderServerCommand;
renderServerCommand.push_back(paraview.c_str());
renderServerCommand.push_back("--render-server");
renderServerCommand.push_back(0);
ReportCommand(&renderServerCommand[0], "renderserver");
kwsysProcess_SetCommand(renderServer, &renderServerCommand[0]);
}
// Construct the server process command line.
kwsys_stl::vector<const char*> serverCommand;
serverCommand.push_back(paraview.c_str());
......@@ -66,8 +109,16 @@ int main(int argc, char* argv[])
// Construct the client process command line.
kwsys_stl::vector<const char*> clientCommand;
clientCommand.push_back(paraview.c_str());
clientCommand.push_back("--client");
for(int i=1; i < argc; ++i)
if(renderServer)
{
clientCommand.push_back("--client-render-server");
}
else
{
clientCommand.push_back("--client");
}
for(int i=argStart; i < argc; ++i)
{
clientCommand.push_back(argv[i]);
}
......@@ -78,20 +129,28 @@ int main(int argc, char* argv[])
// Kill the processes if they are taking too long.
kwsysProcess_SetTimeout(server, 1400);
kwsysProcess_SetTimeout(client, 1400);
if(renderServer)
{
fprintf(stderr, "start render server\n");
kwsysProcess_SetTimeout(renderServer, 1400);
kwsysProcess_Execute(renderServer);
PauseForServerStart();
}
// Execute the server and then the client.
kwsysProcess_Execute(server);
#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
PauseForServerStart();
kwsysProcess_Execute(client);
// Report the output of the processes.
int clientPipe = 1;
int serverPipe = 1;
while(clientPipe || serverPipe)
int renderServerPipe = 0;
if(renderServer)
{
renderServerPipe = 1;
}
while(clientPipe || serverPipe || renderServerPipe)
{
char* data;
int length;
......@@ -124,19 +183,46 @@ int main(int argc, char* argv[])
cerr.write(data, length);
cout.flush();
}
if(renderServer)
{
renderServerPipe = kwsysProcess_WaitForData(server, &data, &length, &timeout);
if(renderServerPipe == kwsysProcess_Pipe_STDOUT)
{
cout.write(data, length);
cout.flush();
}
else if(renderServerPipe == kwsysProcess_Pipe_STDERR)
{
cerr.write(data, length);
cout.flush();
}
}
}
// Wait for the client and server to exit.
kwsysProcess_WaitForExit(client, 0);
kwsysProcess_WaitForExit(server, 0);
if(renderServer)
{
kwsysProcess_WaitForExit(renderServer, 0);
}
// Get the results.
int serverResult = ReportStatus(server, "server");
int clientResult = ReportStatus(client, "client");
int renderServerResult = 0;
if(renderServer)
{
renderServerResult = ReportStatus(renderServer, "renderserver");
}
// Free process managers.
kwsysProcess_Delete(client);
kwsysProcess_Delete(server);
if(renderServer)
{
kwsysProcess_Delete(renderServer);
}
// Report the server return code if it is nonzero. Otherwise report
// the client return code.
......@@ -144,10 +230,13 @@ int main(int argc, char* argv[])
{
return serverResult;
}
else
// if renderServer return code is nonzero then return it
if(renderServerResult)
{
return clientResult;
return renderServerResult;
}
// if both servers are fine return the client result
return clientResult;
}
//----------------------------------------------------------------------------
......
......@@ -12,8 +12,19 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkMPIMToNSocketConnection
// .SECTION Description
// .NAME vtkMPIMToNSocketConnection - class to create socket connections
// between to servers .SECTION Description vtkMPIMToNSocketConnection is a
// class used to create socket connections between the render and data
// servers. This used for example when data is on a super computer (SGI,
// IBM, etc) and Rendering on a Linux cluster with hardware graphics support.
// This problem is known as the "M" to "N" geometry load redistribution
// problem. It addresses the common case where there is a signinficante
// mismatch in the size of large parallel computing resources and the often
// smaller parallel hardward-accelerated rendering resources. The larger
// number of processors on the compute servers are called M, and the smaller
// number of rendering processors are call N. This class is used to create N
// vtkSocketCommunicator's that connect the first N of the M processes on the
// data server to the N processes on the render server.
#ifndef __vtkMPIMToNSocketConnection_h
#define __vtkMPIMToNSocketConnection_h
......@@ -52,7 +63,6 @@ public:
// Description:
// Set up information about the remote connection.
//
void SetPortInformation(unsigned int processNumber, int portNumber, const char* hostName);
// Description:
......@@ -62,6 +72,9 @@ public:
// Description:
// Fill the port information values into the port information object.
void GetPortInformation(vtkMPIMToNSocketConnectionPortInformation*);
// Description:
// Set the name of the configure file containing the names of the render hosts.
vtkSetStringMacro(MachinesFileName);
// Description:
......
......@@ -34,7 +34,7 @@ public:
vtkStandardNewMacro(vtkMPIMToNSocketConnectionPortInformation);
vtkCxxRevisionMacro(vtkMPIMToNSocketConnectionPortInformation, "1.2");
vtkCxxRevisionMacro(vtkMPIMToNSocketConnectionPortInformation, "1.3");
//----------------------------------------------------------------------------
vtkMPIMToNSocketConnectionPortInformation::vtkMPIMToNSocketConnectionPortInformation()
......@@ -194,5 +194,9 @@ const char* vtkMPIMToNSocketConnectionPortInformation::GetProcessHostName(unsign
vtkErrorMacro("Process number greater than number of processes");
return 0;
}
if(this->Internals->ServerInformation[processNumber].HostName.size() == 0)
{
return this->GetHostName();
}
return this->Internals->ServerInformation[processNumber].HostName.c_str();
}
......@@ -12,11 +12,11 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkMPIMToNSocketConnectionPortInformation - Holds class name
// .SECTION Description
// This information object gets the class name of the input VTK object. This
// is separate from vtkPVDataInformation because it can be determined before
// Update is called and because it operates on any VTK object.
// .NAME vtkMPIMToNSocketConnectionPortInformation - holds port and host name
// information.
// .SECTION Description This information object gets the port
// and host information from a render server. This information is used by
// the data server to make the connections to the render server processes.
#ifndef __vtkMPIMToNSocketConnectionPortInformation_h
#define __vtkMPIMToNSocketConnectionPortInformation_h
......@@ -41,7 +41,7 @@ public:
// Set/Get the ProcessNumber
vtkSetMacro(ProcessNumber, int);
vtkGetMacro(ProcessNumber, int);
// Description:
// description:
// Set/Get the ProcessNumber
vtkSetMacro(PortNumber, int);
vtkGetMacro(PortNumber, int);
......
......@@ -40,9 +40,11 @@
#include "vtkTransform.h"
#include "vtkCommand.h"
#include "vtkPVProcessModule.h"
#include "vtkPlanes.h"
#include "vtkPlane.h"
vtkStandardNewMacro(vtkPVBoxWidget);
vtkCxxRevisionMacro(vtkPVBoxWidget, "1.23");
vtkCxxRevisionMacro(vtkPVBoxWidget, "1.24");
int vtkPVBoxWidgetCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -56,6 +58,7 @@ vtkPVBoxWidget::vtkPVBoxWidget()
this->BoxTransformID.ID = 0;
this->BoxTransform = 0;
this->Box = 0;
this->ControlFrame = vtkKWFrame::New();
this->TranslateLabel = vtkKWLabel::New();
......@@ -108,7 +111,7 @@ vtkPVBoxWidget::~vtkPVBoxWidget()
if (pm && this->BoxTransformID.ID )
{
pm->DeleteStreamObject(this->BoxTransformID);
this->BoxTransformID.ID = 0;
this->BoxTransformID.ID = 0;
}
if (pm && this->BoxMatrixID.ID)
{
......@@ -117,7 +120,7 @@ vtkPVBoxWidget::~vtkPVBoxWidget()
}
if(pm)
{
pm->SendStreamToClientAndRenderServer();
pm->SendStreamToRenderServerClientAndServer();
}
}
......@@ -158,32 +161,43 @@ void vtkPVBoxWidget::ActualPlaceWidget()
this->Superclass::ActualPlaceWidget();
vtkPVApplication *pvApp = static_cast<vtkPVApplication*>(
this->Application);
vtkPVProcessModule* pm = pvApp->GetProcessModule();
vtkPVProcessModule* pm = pvApp->GetProcessModule();
// now make sure the widget is placed on the server
// since this is the only 3d widget on the server....
double bds[6];
this->PVSource->GetPVInput(0)->GetDataInformation()->GetBounds(bds);
pvApp->GetProcessModule()->GetStream() << vtkClientServerStream::Invoke << this->Widget3DID
<< "PlaceWidget"
<< bds[0] << bds[1] << bds[2] << bds[3]
<< bds[4] << bds[5] << vtkClientServerStream::End;
pvApp->GetProcessModule()->SendStreamToServer();
pm->GetStream() << vtkClientServerStream::Invoke
<< this->Widget3DID << "GetPlanes" << this->BoxID
<< vtkClientServerStream::End;
pm->SendStreamToClientAndRenderServer();
pm->SendStreamToRenderServerClientAndServer();
}
//----------------------------------------------------------------------------
void vtkPVBoxWidget::AcceptInternal(vtkClientServerID sourceID)
{
this->PlaceWidget();
vtkPVApplication *pvApp = static_cast<vtkPVApplication*>(this->Application);
vtkPVProcessModule* pm = pvApp->GetProcessModule();
this->PlaceWidget();
if ( ! this->ModifiedFlag)
{
return;
}
if ( this->BoxID.ID )
{
vtkPVApplication *pvApp = static_cast<vtkPVApplication*>(
this->Application);
vtkPVProcessModule* pm = pvApp->GetProcessModule();
pm->GetStream() << vtkClientServerStream::Invoke
<< this->Widget3DID << "GetPlanes" << this->BoxID
<< vtkClientServerStream::End;
this->SetStoredPosition(this->PositionGUI);
this->SetStoredRotation(this->RotationGUI);
this->SetStoredScale(this->ScaleGUI);
pm->SendStreamToRenderServerClientAndServer();
}
this->Superclass::AcceptInternal(sourceID);
this->Initialized = 1;
......@@ -306,6 +320,8 @@ void vtkPVBoxWidget::PrintSelf(ostream& os, vtkIndent indent)
this->Superclass::PrintSelf(os,indent);
os << indent << "BoxID: " << this->BoxID.ID
<< endl;
os << indent << "Box: "
<< this->Box << endl;
os << indent << "BoxTransform: "
<< this->BoxTransform << endl;
os << indent << "BoxTransformID" << this->BoxTransformID << endl;
......@@ -370,11 +386,13 @@ void vtkPVBoxWidget::ChildCreate(vtkPVApplication* pvApp)
pm->GetStream() << vtkClientServerStream::Invoke << this->Widget3DID << "PlaceWidget"
<< 0 << 1 << 0 << 1 << 0 << 1
<< vtkClientServerStream::End;
pm->SendStreamToRenderServerClientAndServer();
this->BoxID = pm->NewStreamObject("vtkPlanes");
this->BoxTransformID = pm->NewStreamObject("vtkTransform");
this->BoxMatrixID = pm->NewStreamObject("vtkMatrix4x4");
this->BoxTransformID = pm->NewStreamObject("vtkTransform");
pm->SendStreamToRenderServerClientAndServer();
pm->SendStreamToClientAndRenderServer();
this->Box = vtkPlanes::SafeDownCast(pm->GetObjectFromID(this->BoxID));
this->BoxTransform = vtkTransform::SafeDownCast(pm->GetObjectFromID(this->BoxTransformID));
this->SetFrameLabel("Box Widget");
......@@ -725,10 +743,11 @@ void vtkPVBoxWidget::UpdateBox(int update)
<< vtkClientServerStream::InsertArray(&mat->Element[0][0], 16)
<< vtkClientServerStream::End;
pm->GetStream() << vtkClientServerStream::Invoke << this->BoxTransformID
<< "SetMatrix" << this->BoxMatrixID << vtkClientServerStream::End
<< vtkClientServerStream::Invoke << this->Widget3DID
<< "SetMatrix" << this->BoxMatrixID << vtkClientServerStream::End;
pm->SendStreamToRenderServerClientAndServer();
pm->GetStream() << vtkClientServerStream::Invoke << this->Widget3DID
<< "SetTransform" << this->BoxTransformID << vtkClientServerStream::End;
pm->SendStreamToClientAndRenderServer();
pm->SendStreamToRenderServerClientAndServer();
this->SetValueChanged();
}
......
......@@ -33,6 +33,7 @@ class vtkKWThumbWheel;
class vtkKWScale;
class vtkTransform;
class vtkBoxWidget;
class vtkPlanes;
class VTK_EXPORT vtkPVBoxWidget : public vtkPV3DWidget
{
......@@ -173,6 +174,7 @@ protected:
vtkKWScale* OrientationScale[3];
vtkTransform* BoxTransform;
vtkPlanes* Box;
int ReadXMLAttributes(vtkPVXMLElement* element,
vtkPVXMLPackageParser* parser);
......
......@@ -145,7 +145,7 @@ void vtkPVSendStreamToClientServerNodeRMI(void *localArg, void *remoteArg,
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVClientServerModule);
vtkCxxRevisionMacro(vtkPVClientServerModule, "1.71");
vtkCxxRevisionMacro(vtkPVClientServerModule, "1.72");
int vtkPVClientServerModuleCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -265,7 +265,9 @@ void vtkPVClientServerModule::Initialize()
{
this->RenderServerSocket->Receive(&numServerProcs, 1, 1, 8843);
this->NumberOfRenderServerProcesses = numServerProcs;
// this->Interpreter->SetLogFile("./client.log");
}
// attempt to initialize render server connection to data server
this->InitializeRenderServer();
......@@ -293,7 +295,16 @@ void vtkPVClientServerModule::Initialize()
}
else if (myId == 0)
{ // process 0 of Server
// send the number of server processes as a handshake.
// send the number of server processes as a handshake.
if(this->RenderServerMode)
{
// this->Interpreter->SetLogFile("./renderserver.log");
}
else
{
// this->Interpreter->SetLogFile("./dataserver.log");
}
this->SocketController->Send(&numProcs, 1, 1, 8843);
//
......
......@@ -41,7 +41,7 @@
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVImplicitPlaneWidget);
vtkCxxRevisionMacro(vtkPVImplicitPlaneWidget, "1.28");
vtkCxxRevisionMacro(vtkPVImplicitPlaneWidget, "1.29");
vtkCxxSetObjectMacro(vtkPVImplicitPlaneWidget, InputMenu, vtkPVInputMenu);
......@@ -810,6 +810,7 @@ void vtkPVImplicitPlaneWidget::Update()
pm->GetStream() << vtkClientServerStream::Invoke << this->Widget3DID << "PlaceWidget"
<< bds[0] << bds[1] << bds[2] << bds[3] << bds[4] << bds[5]
<< vtkClientServerStream::End;
pm->SendStreamToClientAndRenderServer();
// Should I also move the center of the plane? Keep the old plane?
// Keep the old normal?
......
......@@ -35,7 +35,7 @@
#include "vtkPVProcessModule.h"
vtkStandardNewMacro(vtkPVSphereWidget);
vtkCxxRevisionMacro(vtkPVSphereWidget, "1.34");
vtkCxxRevisionMacro(vtkPVSphereWidget, "1.35");
int vtkPVSphereWidgetCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -167,7 +167,7 @@ void vtkPVSphereWidget::AcceptInternal(vtkClientServerID sourceID)
pm->GetStream() << vtkClientServerStream::Invoke << this->SphereID
<< "SetRadius" << rad
<< vtkClientServerStream::End;
pm->SendStreamToClientAndRenderServer();
pm->SendStreamToRenderServerClientAndServer();
this->SetLastAcceptedCenter(val);
this->SetLastAcceptedRadius(rad);
}
......
......@@ -102,6 +102,15 @@ FOREACH (tfile ${PROJECT_TESTS})
-C ${PVCompareImages}
-T ${ParaView_BINARY_DIR}/Testing/Temporary
-V ${PVClientTestData}/Baseline/${tfile}.png)
# repeat the test with the client server driver in render server mode
ADD_TEST("${tfile}RenderServer-ParaView" ${PARAVIEW_CS_EXECUTABLE}
--test-render-server
--disable-registry
${PVClientTests_SOURCE_DIR}/Tcl/${tfile}.pvs
-D ${PVClientTestData}
-C ${PVCompareImages}
-T ${ParaView_BINARY_DIR}/Testing/Temporary
-V ${PVClientTestData}/Baseline/${tfile}.png)
ENDFOREACH (tfile)
IF(VTK_PRINT_SELF_CHECK_TCL)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment