Commit 5db02f8f authored by Philippe Pebay's avatar Philippe Pebay Committed by Kitware Robot
Browse files

Merge topic 'fix-realdata-MPI-descriptive-test'

fc47aff3 Now verifying some results with respect to extracted data set parameters
da62c94e Removed a now unused predefined cardinality
70a6698a Remove TestRealDataPDescriptive from regression until there is baseline data
parents fbdbed60 fc47aff3
......@@ -169,13 +169,6 @@ IF (VTK_USE_RENDERING AND VTK_USE_DISPLAY)
${CXX_TEST_PATH}/${CXX_TEST_CONFIG}/TestParallelKMeansStatisticsMPI
${VTK_MPI_POSTFLAGS}
)
ADD_TEST(TestRealDataPDescriptiveStatisticsMPI
${VTK_MPIRUN_EXE} ${VTK_MPI_PRENUMPROC_FLAGS} ${VTK_MPI_NUMPROC_FLAG} ${VTK_MPI_MAX_NUMPROCS}
${VTK_MPI_PREFLAGS}
${CXX_TEST_PATH}/${CXX_TEST_CONFIG}/TestRealDataPDescriptiveStatisticsMPI
${VTK_MPI_POSTFLAGS}
)
ENDIF (VTK_MPIRUN_EXE)
ENDIF (VTK_USE_PARALLEL AND VTK_USE_MPI)
......
......@@ -42,7 +42,6 @@ PURPOSE. See the above copyright notice for more information.
struct RealDataDescriptiveStatisticsArgs
{
int nVals;
int* retVal;
int ioRank;
vtkStdString fileName;
......@@ -229,8 +228,8 @@ void RealDataDescriptiveStatistics( vtkMultiProcessController* controller, void*
myDataDim[0] = myBlockBounds[1][0] - myBlockBounds[0][0] + 1;
myDataDim[1] = myBlockBounds[1][1] - myBlockBounds[0][1] + 1;
myDataDim[2] = myBlockBounds[1][2] - myBlockBounds[0][2] + 1;
vtkIdType myDataSize = myDataDim[0] * myDataDim[1] * myDataDim[2];
float* buffer = new float[myDataSize];
vtkIdType card_l = myDataDim[0] * myDataDim[1] * myDataDim[2];
float* buffer = new float[card_l];
ReadFloatDataBlockFromFile( ifs,
args->dataDim,
......@@ -244,16 +243,11 @@ void RealDataDescriptiveStatistics( vtkMultiProcessController* controller, void*
floatArr->SetNumberOfComponents( 1 );
floatArr->SetName( varName );
for ( vtkIdType i = 0; i < myDataSize; ++ i )
for ( vtkIdType i = 0; i < card_l; ++ i )
{
floatArr->InsertNextValue( buffer[i] );
}
cout << "\n# Cardinality on process "
<< myRank
<< ": "
<< myDataSize
<< "\n";
vtkTable* inputData = vtkTable::New();
inputData->AddColumn( floatArr );
......@@ -269,10 +263,11 @@ void RealDataDescriptiveStatistics( vtkMultiProcessController* controller, void*
// Select column of interest
pcs->AddColumn( varName );
// Test (in parallel) with Learn, Derive, and Assess options turned on
// Test (in parallel) with Learn and Derive options turned on
pcs->SetLearnOption( true );
pcs->SetDeriveOption( true );
pcs->SetAssessOption( true );
pcs->SetTestOption( false );
pcs->SetAssessOption( false );
pcs->Update();
// Get output data and meta tables
......@@ -286,10 +281,7 @@ void RealDataDescriptiveStatistics( vtkMultiProcessController* controller, void*
if ( com->GetLocalProcessId() == args->ioRank )
{
cout << "\n## Completed parallel calculation of descriptive statistics (with assessment):\n"
<< " Total sample size: "
<< outputPrimary->GetValueByName( 0, "Cardinality" ).ToInt()
<< " \n"
cout << "\n## Completed parallel calculation of descriptive statistics (without assessment):\n"
<< " Wall time: "
<< timer->GetElapsedTime()
<< " sec.\n";
......@@ -323,6 +315,52 @@ void RealDataDescriptiveStatistics( vtkMultiProcessController* controller, void*
}
}
// Verify that sizes of read data sets sums up to the calculated global cardinality
if ( com->GetLocalProcessId() == args->ioRank )
{
cout << "\n## Verifying that sizes of read data sets sums up to the calculated global cardinality.\n";
}
// Gather all cardinalities
int numProcs = controller->GetNumberOfProcesses();
vtkIdType* card_g = new vtkIdType[numProcs];
com->AllGather( &card_l,
card_g,
1 );
// Calculated global cardinality
vtkIdType testIntValue = outputPrimary->GetValueByName( 0, "Cardinality" ).ToInt();
// Print and verify some results
if ( com->GetLocalProcessId() == args->ioRank )
{
vtkIdType sumCards = 0;
for ( int i = 0; i < numProcs; ++ i )
{
cout << " Cardinality of data set read on process "
<< i
<< ": "
<< card_g[i]
<< "\n";
sumCards += card_g[i];
}
cout << " Cardinality of global data set: "
<< sumCards
<< " \n";
if ( sumCards != testIntValue )
{
vtkGenericWarningMacro("Incorrect calculated global cardinality:"
<< testIntValue
<< " <> "
<< sumCards
<< ")");
*(args->retVal) = 1;
}
}
// Clean up
pcs->Delete();
inputData->Delete();
......@@ -547,7 +585,6 @@ int main( int argc, char** argv )
int testValue = 0;
RealDataDescriptiveStatisticsArgs args;
args.nVals = 100000;
args.retVal = &testValue;
args.ioRank = ioRank;
args.fileName = fileName;
......
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