Commit 3aefbd43 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot

Merge topic '19121-view-reduction-fixes'

50a864e2 vtkPVView: support min/sum reduction operations
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David E. DeMarle's avatarDavid E. DeMarle <dave.demarle@kitware.com>
Merge-request: !3354
parents b64bc583 50a864e2
Pipeline #139939 failed with stage
in 0 seconds
...@@ -903,6 +903,14 @@ if (PARAVIEW_USE_MPI) ...@@ -903,6 +903,14 @@ if (PARAVIEW_USE_MPI)
#UseDataPartitions.xml #UseDataPartitions.xml
) )
list(APPEND TESTS_WITH_INLINE_COMPARES
# needs parallel server for the columns to match those in the test.
SpreadSheetParallelData.xml)
# test only checks for spreadsheet columns correctly in
# parallel client-server mode.
set (SpreadSheetParallelData_DISABLE_C TRUE)
# DistributePoints is only tested in non-built-in mode. # DistributePoints is only tested in non-built-in mode.
paraview_add_client_server_tests( paraview_add_client_server_tests(
BASELINE_DIR ${PARAVIEW_TEST_BASELINE_DIR} BASELINE_DIR ${PARAVIEW_TEST_BASELINE_DIR}
......
<?xml version="1.0" ?>
<pqevents>
<!-- tests paraview/paraview#19121 -->
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources/Alphabetical" command="activate" arguments="SphereSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ThetaResolution/LineEdit0" command="key" arguments="16777219" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ThetaResolution/LineEdit0" command="set_string" arguments="3" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/PhiResolution/LineEdit0" command="key" arguments="16777219" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/PhiResolution/LineEdit0" command="set_string" arguments="3" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/Close" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/EmptyView/scrollArea/qt_scrollarea_viewport/widgetFoo/ConvertActionsFrame/SpreadSheetView" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport/pqSpreadSheetViewDecorator/Attribute" command="activated" arguments="Cell Data" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" command="setCurrent" arguments="1.1" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" command="setCurrent" arguments="2.1" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" command="setCurrent" arguments="3.1" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" command="setCurrent" arguments="4.1" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" command="setCurrent" arguments="5.1" />
<!-- this index only works for client-server hence we run this test only in client-server -->
<pqcheck object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0" property="modelItemData" arguments="5.2,Triangle" />
</pqevents>
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "vtkCamera.h" #include "vtkCamera.h"
#include "vtkCollection.h" #include "vtkCollection.h"
#include "vtkCommand.h" #include "vtkCommand.h"
#include "vtkCommunicator.h"
#include "vtkCuller.h" #include "vtkCuller.h"
#include "vtkDataRepresentation.h" #include "vtkDataRepresentation.h"
#include "vtkFXAAOptions.h" #include "vtkFXAAOptions.h"
...@@ -1258,7 +1259,7 @@ void vtkPVRenderView::Update() ...@@ -1258,7 +1259,7 @@ void vtkPVRenderView::Update()
// Gather information about geometry sizes from all representations. // Gather information about geometry sizes from all representations.
const vtkTypeUInt64 lsize = this->GetDeliveryManager()->GetVisibleDataSize(/*low_res*/ false); const vtkTypeUInt64 lsize = this->GetDeliveryManager()->GetVisibleDataSize(/*low_res*/ false);
vtkTypeUInt64 gsize; vtkTypeUInt64 gsize;
this->AllReduceMAX(lsize, gsize); this->AllReduce(lsize, gsize, vtkCommunicator::SUM_OP);
const double geometry_size = gsize / 1024; const double geometry_size = gsize / 1024;
// cout << "Full Geometry size: " << geometry_size << endl; // cout << "Full Geometry size: " << geometry_size << endl;
...@@ -1327,7 +1328,7 @@ void vtkPVRenderView::UpdateLOD() ...@@ -1327,7 +1328,7 @@ void vtkPVRenderView::UpdateLOD()
const vtkTypeUInt64 lsize = this->GetDeliveryManager()->GetVisibleDataSize(/*low_res*/ true); const vtkTypeUInt64 lsize = this->GetDeliveryManager()->GetVisibleDataSize(/*low_res*/ true);
vtkTypeUInt64 gsize; vtkTypeUInt64 gsize;
this->AllReduceMAX(lsize, gsize); this->AllReduce(lsize, gsize, vtkCommunicator::SUM_OP);
const double geometry_size = gsize / 1024; const double geometry_size = gsize / 1024;
// cout << "LOD Geometry size: " << geometry_size << endl; // cout << "LOD Geometry size: " << geometry_size << endl;
...@@ -3401,8 +3402,8 @@ void vtkPVRenderView::SynchronizeMaximumIds(vtkIdType* maxPointId, vtkIdType* ma ...@@ -3401,8 +3402,8 @@ void vtkPVRenderView::SynchronizeMaximumIds(vtkIdType* maxPointId, vtkIdType* ma
// skip data server since this method is only called on processes involved // skip data server since this method is only called on processes involved
// in rendering. // in rendering.
this->AllReduceMAX(ptid, ptid, /*skip_data_server=*/true); this->AllReduce(ptid, ptid, vtkCommunicator::MAX_OP, /*skip_data_server=*/true);
this->AllReduceMAX(cellid, cellid, /*skip_data_server=*/true); this->AllReduce(cellid, cellid, vtkCommunicator::MAX_OP, /*skip_data_server=*/true);
*maxPointId = static_cast<vtkIdType>(ptid); *maxPointId = static_cast<vtkIdType>(ptid);
*maxCellId = static_cast<vtkIdType>(cellid); *maxCellId = static_cast<vtkIdType>(cellid);
......
...@@ -434,7 +434,7 @@ void vtkPVView::Update() ...@@ -434,7 +434,7 @@ void vtkPVView::Update()
{ {
cache_full = 1; cache_full = 1;
} }
this->AllReduceMAX(cache_full, cache_full); this->AllReduce(cache_full, cache_full, vtkCommunicator::MAX_OP);
cacheSizeKeeper->SetCacheFull(cache_full > 0); cacheSizeKeeper->SetCacheFull(cache_full > 0);
} }
...@@ -641,17 +641,31 @@ void vtkPVView::AllReduce(const vtkBoundingBox& arg_source, vtkBoundingBox& dest ...@@ -641,17 +641,31 @@ void vtkPVView::AllReduce(const vtkBoundingBox& arg_source, vtkBoundingBox& dest
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void vtkPVView::AllReduceMAX( void vtkPVView::AllReduce(
const vtkTypeUInt64 arg_source, vtkTypeUInt64& dest, bool skip_data_server) const vtkTypeUInt64 arg_source, vtkTypeUInt64& dest, int operation, bool skip_data_server)
{ {
assert(this->Session); assert(this->Session);
vtkVLogScopeF(PARAVIEW_LOG_RENDERING_VERBOSITY(), "all-reduce-max"); vtkVLogScopeF(PARAVIEW_LOG_RENDERING_VERBOSITY(), "all-reduce (op=%d)", operation);
auto evaluator = [operation](vtkTypeUInt64 a, vtkTypeUInt64 b) {
switch (operation)
{
case vtkCommunicator::MAX_OP:
return std::max(a, b);
case vtkCommunicator::MIN_OP:
return std::min(a, b);
case vtkCommunicator::SUM_OP:
return a + b;
default:
abort();
}
};
vtkTypeUInt64 source = arg_source; vtkTypeUInt64 source = arg_source;
auto pController = vtkMultiProcessController::GetGlobalController(); auto pController = vtkMultiProcessController::GetGlobalController();
if (pController) if (pController)
{ {
pController->Reduce(&source, &dest, 1, vtkCommunicator::MAX_OP, 0); pController->Reduce(&source, &dest, 1, operation, 0);
source = dest; source = dest;
} }
...@@ -674,14 +688,14 @@ void vtkPVView::AllReduceMAX( ...@@ -674,14 +688,14 @@ void vtkPVView::AllReduceMAX(
{ {
vtkTypeUInt64 val; vtkTypeUInt64 val;
crController->Receive(&val, 1, 1, 41234); crController->Receive(&val, 1, 1, 41234);
source = std::max(source, val); source = evaluator(source, val);
} }
if (cdController) if (cdController)
{ {
vtkTypeUInt64 val; vtkTypeUInt64 val;
cdController->Receive(&val, 1, 1, 41234); cdController->Receive(&val, 1, 1, 41234);
source = std::max(source, val); source = evaluator(source, val);
} }
if (crController) if (crController)
......
...@@ -266,9 +266,13 @@ protected: ...@@ -266,9 +266,13 @@ protected:
void AllReduce(const vtkBoundingBox& source, vtkBoundingBox& dest); void AllReduce(const vtkBoundingBox& source, vtkBoundingBox& dest);
/** /**
* Reduce the max value between all participating processes. * Reduce between all participating processes using the operation
* (vtkCommunicator::StandardOperations) specified. Currently only
* vtkCommunicator::MIN_OP, vtkCommunicator::MAX_OP, and
* vtkCommunicator::SUM_OP are supported.
*/ */
void AllReduceMAX(const vtkTypeUInt64 source, vtkTypeUInt64& dest, bool skip_data_server = false); void AllReduce(
const vtkTypeUInt64 source, vtkTypeUInt64& dest, int operation, bool skip_data_server = false);
/** /**
* Overridden to check that the representation has View setup properly. Older * Overridden to check that the representation has View setup properly. Older
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "vtkCSVExporter.h" #include "vtkCSVExporter.h"
#include "vtkCharArray.h" #include "vtkCharArray.h"
#include "vtkClientServerMoveData.h" #include "vtkClientServerMoveData.h"
#include "vtkCommunicator.h"
#include "vtkCompositeDataIterator.h" #include "vtkCompositeDataIterator.h"
#include "vtkCompositeDataSet.h" #include "vtkCompositeDataSet.h"
#include "vtkDataSetAttributes.h" #include "vtkDataSetAttributes.h"
...@@ -644,7 +645,7 @@ int vtkSpreadSheetView::StreamToClient() ...@@ -644,7 +645,7 @@ int vtkSpreadSheetView::StreamToClient()
this->DeliveryFilter->RemoveAllInputs(); this->DeliveryFilter->RemoveAllInputs();
} }
this->AllReduceMAX(num_rows, num_rows); this->AllReduce(num_rows, num_rows, vtkCommunicator::SUM_OP);
if (this->NumberOfRows != static_cast<vtkIdType>(num_rows)) if (this->NumberOfRows != static_cast<vtkIdType>(num_rows))
{ {
......
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