mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Split up the particle advection/streamline test
The test for particle advection filters was one large test that tested 3 versions --- advection, streamlines, and pathlines --- with each tested for a variety of conditions including asynchronous communication, number of blocks, ghost cells, etc. This was causing the test to take a while and sometimes time out. (It would also sometimes seg fault, which I hope is related.) To attempt to fix this problem, break up this test into pieces so that each piece takes a shorter amount of time. Because these tests share most of their implementation (which is why they were grouped together in the first place) the common code is placed in a source file of shared implementation. To support this I also added a way to mark a source file to `vtkm_unit_tests` as a source file that does not contain its own test. Normally you would just compile all of the tests together, select each with command line arguments, and use duplicate `add_tests` for each argument. But that is not how `vtkm_unit_tests` works, and it would be too hard to make that change.
This commit is contained in:
parent
00cd139be8
commit
2631e5561f
@ -39,11 +39,24 @@ function(_vtkm_create_test_executable
|
||||
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "")
|
||||
endif()
|
||||
|
||||
#the creation of the test source list needs to occur before the labeling as
|
||||
#The creation of the test source list needs to occur before the labeling as
|
||||
#cuda. This is so that we get the correctly named entry points generated
|
||||
create_test_sourcelist(test_sources ${prog}.cxx ${sources} ${device_sources} ${extraArgs})
|
||||
#Also, although we usually assume that each source file is a test, we need
|
||||
#to check for the `NOT_A_TEST` property for support code that should be
|
||||
#compiled with the executable but is not a test itself.
|
||||
set(test_sources)
|
||||
set(extra_sources)
|
||||
foreach(src IN LISTS sources device_sources)
|
||||
get_source_file_property(not_a_test ${src} NOT_A_TEST)
|
||||
if (not_a_test)
|
||||
list(APPEND extra_sources ${src})
|
||||
else()
|
||||
list(APPEND test_sources ${src})
|
||||
endif()
|
||||
endforeach()
|
||||
create_test_sourcelist(test_sources ${prog}.cxx ${test_sources} ${extraArgs})
|
||||
|
||||
add_executable(${prog} ${test_sources})
|
||||
add_executable(${prog} ${test_sources} ${extra_sources})
|
||||
vtkm_add_drop_unused_function_flags(${prog})
|
||||
target_compile_definitions(${prog} PRIVATE ${defines})
|
||||
|
||||
@ -91,6 +104,14 @@ endfunction()
|
||||
# function with the same name as the source file. For example, if SOURCES
|
||||
# contains `UnitTestFoo.cxx`, then `UnitTestFoo.cxx` should contain a
|
||||
# function named `UnitTestFoo`. A test with this name is also added to ctest.
|
||||
# If you want to add a source file that should not be treated as a test, then
|
||||
# you can attach the `NOT_A_TEST` property to those files (using
|
||||
# `set_source_files_properties`), and that file will be added to the test
|
||||
# executable without adding an associated test.
|
||||
#
|
||||
# DEVICE_SOURCES: The same as SOURCES except that each file will be compiled
|
||||
# with the device compiler. You can use both SOURCES and DEVICE_SOURCES
|
||||
# together to specify which compiler to use for each file.
|
||||
#
|
||||
# LIBRARIES: Extra libraries that this set of tests need to link to.
|
||||
#
|
||||
@ -296,6 +317,10 @@ vtkm_unit_tests but not in its test dependencies. Add test dependencies to \
|
||||
endif()
|
||||
|
||||
foreach (test ${VTKm_UT_SOURCES} ${VTKm_UT_DEVICE_SOURCES})
|
||||
get_source_file_property(not_a_test ${test} NOT_A_TEST)
|
||||
if (not_a_test)
|
||||
continue()
|
||||
endif()
|
||||
get_filename_component(tname ${test} NAME_WE)
|
||||
if(VTKm_UT_MPI)
|
||||
if (VTKm_ENABLE_MPI)
|
||||
|
@ -37,12 +37,23 @@ vtkm_unit_tests(
|
||||
#if MPI is enabled.
|
||||
if (VTKm_ENABLE_MPI)
|
||||
set(mpi_unit_tests
|
||||
UnitTestAdvectionAsynchronousMPI.cxx
|
||||
UnitTestAdvectionSynchronousMPI.cxx
|
||||
UnitTestParticleMessengerMPI.cxx
|
||||
UnitTestStreamlineFilterMPI.cxx
|
||||
)
|
||||
UnitTestPathlineAsynchronousMPI.cxx
|
||||
UnitTestPathlineSynchronousMPI.cxx
|
||||
UnitTestStreamlineAMRMPI.cxx
|
||||
UnitTestStreamlineAsynchronousMPI.cxx
|
||||
UnitTestStreamlineSynchronousMPI.cxx
|
||||
)
|
||||
set(mpi_helpers
|
||||
TestingFlow.cxx
|
||||
TestingFlow.h
|
||||
)
|
||||
set_source_files_properties(${mpi_helpers} PROPERTIES NOT_A_TEST TRUE)
|
||||
vtkm_unit_tests(
|
||||
MPI
|
||||
DEVICE_SOURCES ${mpi_unit_tests}
|
||||
SOURCES ${mpi_unit_tests} ${mpi_helpers}
|
||||
USE_VTKM_JOB_POOL
|
||||
)
|
||||
endif()
|
||||
|
313
vtkm/filter/flow/testing/TestingFlow.cxx
Normal file
313
vtkm/filter/flow/testing/TestingFlow.cxx
Normal file
@ -0,0 +1,313 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include "TestingFlow.h"
|
||||
|
||||
#include <vtkm/CellClassification.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/flow/ParticleAdvection.h>
|
||||
#include <vtkm/filter/flow/Pathline.h>
|
||||
#include <vtkm/filter/flow/Streamline.h>
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
#include <vtkm/worklet/testing/GenerateTestDataSets.h>
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3f> CreateConstantVectorField(vtkm::Id num, const vtkm::Vec3f& vec)
|
||||
{
|
||||
vtkm::cont::ArrayHandleConstant<vtkm::Vec3f> vecConst;
|
||||
vecConst = vtkm::cont::make_ArrayHandleConstant(vec, num);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3f> vecField;
|
||||
vtkm::cont::ArrayCopy(vecConst, vecField);
|
||||
return vecField;
|
||||
}
|
||||
|
||||
void AddVectorFields(vtkm::cont::PartitionedDataSet& pds,
|
||||
const std::string& fieldName,
|
||||
const vtkm::Vec3f& vec)
|
||||
{
|
||||
for (auto& ds : pds)
|
||||
ds.AddPointField(fieldName, CreateConstantVectorField(ds.GetNumberOfPoints(), vec));
|
||||
}
|
||||
|
||||
std::vector<vtkm::cont::PartitionedDataSet> CreateAllDataSetBounds(vtkm::Id nPerRank, bool useGhost)
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
|
||||
vtkm::Id totNumBlocks = nPerRank * comm.size();
|
||||
vtkm::Id numDims = 5;
|
||||
|
||||
vtkm::FloatDefault x0 = 0;
|
||||
vtkm::FloatDefault x1 = x0 + static_cast<vtkm::FloatDefault>(numDims - 1);
|
||||
vtkm::FloatDefault dx = x1 - x0;
|
||||
vtkm::FloatDefault y0 = 0, y1 = numDims - 1, z0 = 0, z1 = numDims - 1;
|
||||
|
||||
if (useGhost)
|
||||
{
|
||||
numDims = numDims + 2; //add 1 extra on each side
|
||||
x0 = x0 - 1;
|
||||
x1 = x1 + 1;
|
||||
dx = x1 - x0 - 2;
|
||||
y0 = y0 - 1;
|
||||
y1 = y1 + 1;
|
||||
z0 = z0 - 1;
|
||||
z1 = z1 + 1;
|
||||
}
|
||||
|
||||
//Create ALL of the blocks.
|
||||
std::vector<vtkm::Bounds> bounds;
|
||||
for (vtkm::Id i = 0; i < totNumBlocks; i++)
|
||||
{
|
||||
bounds.push_back(vtkm::Bounds(x0, x1, y0, y1, z0, z1));
|
||||
x0 += dx;
|
||||
x1 += dx;
|
||||
}
|
||||
|
||||
const vtkm::Id3 dims(numDims, numDims, numDims);
|
||||
auto allPDS = vtkm::worklet::testing::CreateAllDataSets(bounds, dims, useGhost);
|
||||
|
||||
return allPDS;
|
||||
}
|
||||
|
||||
std::vector<vtkm::Range> ExtractMaxXRanges(const vtkm::cont::PartitionedDataSet& pds, bool useGhost)
|
||||
{
|
||||
std::vector<vtkm::Range> xMaxRanges;
|
||||
for (const auto& ds : pds.GetPartitions())
|
||||
{
|
||||
auto bounds = ds.GetCoordinateSystem().GetBounds();
|
||||
auto xMax = bounds.X.Max;
|
||||
if (useGhost)
|
||||
xMax = xMax - 1;
|
||||
xMaxRanges.push_back(vtkm::Range(xMax, xMax + static_cast<vtkm::FloatDefault>(.5)));
|
||||
}
|
||||
|
||||
return xMaxRanges;
|
||||
}
|
||||
|
||||
void ValidateOutput(const vtkm::cont::DataSet& out,
|
||||
vtkm::Id numSeeds,
|
||||
const vtkm::Range& xMaxRange,
|
||||
FilterType fType,
|
||||
bool checkEndPoint,
|
||||
bool blockDuplication)
|
||||
{
|
||||
//Validate the result is correct.
|
||||
VTKM_TEST_ASSERT(out.GetNumberOfCoordinateSystems() == 1,
|
||||
"Wrong number of coordinate systems in the output dataset");
|
||||
|
||||
vtkm::cont::UnknownCellSet dcells = out.GetCellSet();
|
||||
vtkm::Id numCells = out.GetNumberOfCells();
|
||||
|
||||
if (!blockDuplication)
|
||||
VTKM_TEST_ASSERT(numCells == numSeeds, "Wrong number of cells");
|
||||
|
||||
auto coords = out.GetCoordinateSystem().GetDataAsMultiplexer();
|
||||
auto ptPortal = coords.ReadPortal();
|
||||
|
||||
if (fType == STREAMLINE || fType == PATHLINE)
|
||||
{
|
||||
vtkm::cont::CellSetExplicit<> explicitCells;
|
||||
VTKM_TEST_ASSERT(dcells.IsType<vtkm::cont::CellSetExplicit<>>(), "Wrong cell type.");
|
||||
explicitCells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
|
||||
for (vtkm::Id j = 0; j < numCells; j++)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> indices;
|
||||
explicitCells.GetIndices(j, indices);
|
||||
vtkm::Id nPts = indices.GetNumberOfValues();
|
||||
auto iPortal = indices.ReadPortal();
|
||||
vtkm::Vec3f lastPt = ptPortal.Get(iPortal.Get(nPts - 1));
|
||||
if (checkEndPoint)
|
||||
VTKM_TEST_ASSERT(xMaxRange.Contains(lastPt[0]), "Wrong end point for seed");
|
||||
}
|
||||
}
|
||||
else if (fType == PARTICLE_ADVECTION)
|
||||
{
|
||||
if (!blockDuplication)
|
||||
VTKM_TEST_ASSERT(out.GetNumberOfPoints() == numSeeds, "Wrong number of coordinates");
|
||||
if (checkEndPoint)
|
||||
{
|
||||
for (vtkm::Id i = 0; i < numCells; i++)
|
||||
VTKM_TEST_ASSERT(xMaxRange.Contains(ptPortal.Get(i)[0]), "Wrong end point for seed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestPartitionedDataSet(vtkm::Id nPerRank,
|
||||
bool useGhost,
|
||||
FilterType fType,
|
||||
bool useThreaded,
|
||||
bool useAsyncComm,
|
||||
bool useBlockIds,
|
||||
bool duplicateBlocks)
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
if (comm.rank() == 0)
|
||||
{
|
||||
switch (fType)
|
||||
{
|
||||
case PARTICLE_ADVECTION:
|
||||
std::cout << "Particle advection";
|
||||
break;
|
||||
case STREAMLINE:
|
||||
std::cout << "Streamline";
|
||||
break;
|
||||
case PATHLINE:
|
||||
std::cout << "Pathline";
|
||||
break;
|
||||
}
|
||||
std::cout << " blocksPerRank= " << nPerRank;
|
||||
if (useGhost)
|
||||
std::cout << " - using ghost cells";
|
||||
if (useThreaded)
|
||||
std::cout << " - using threaded";
|
||||
if (useAsyncComm)
|
||||
std::cout << " - usingAsyncComm";
|
||||
else
|
||||
std::cout << " - usingSyncComm";
|
||||
|
||||
if (useBlockIds)
|
||||
std::cout << " - using block IDs";
|
||||
if (duplicateBlocks)
|
||||
std::cout << " - with duplicate blocks";
|
||||
std::cout << " - on a partitioned data set" << std::endl;
|
||||
}
|
||||
|
||||
std::vector<vtkm::Id> blockIds;
|
||||
//Uniform assignment.
|
||||
for (vtkm::Id i = 0; i < nPerRank; i++)
|
||||
blockIds.push_back(comm.rank() * nPerRank + i);
|
||||
|
||||
//For block duplication, give everyone the 2nd to last block.
|
||||
//We want to keep the last block on the last rank for validation.
|
||||
if (duplicateBlocks && blockIds.size() > 1)
|
||||
{
|
||||
vtkm::Id totNumBlocks = comm.size() * nPerRank;
|
||||
vtkm::Id dupBlock = totNumBlocks - 2;
|
||||
for (int r = 0; r < comm.size(); r++)
|
||||
{
|
||||
if (std::find(blockIds.begin(), blockIds.end(), dupBlock) == blockIds.end())
|
||||
blockIds.push_back(dupBlock);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<vtkm::cont::PartitionedDataSet> allPDS, allPDS2;
|
||||
allPDS = CreateAllDataSetBounds(nPerRank, useGhost);
|
||||
allPDS2 = CreateAllDataSetBounds(nPerRank, useGhost);
|
||||
auto xMaxRanges = ExtractMaxXRanges(allPDS[0], useGhost);
|
||||
|
||||
vtkm::FloatDefault time0 = 0;
|
||||
vtkm::FloatDefault time1 = xMaxRanges[xMaxRanges.size() - 1].Max;
|
||||
|
||||
vtkm::Vec3f vecX(1, 0, 0);
|
||||
std::string fieldName = "vec";
|
||||
vtkm::FloatDefault stepSize = 0.1f;
|
||||
vtkm::Id numSteps = 100000;
|
||||
for (std::size_t n = 0; n < allPDS.size(); n++)
|
||||
{
|
||||
vtkm::cont::PartitionedDataSet pds;
|
||||
for (const auto& bid : blockIds)
|
||||
pds.AppendPartition(allPDS[n].GetPartition(bid));
|
||||
AddVectorFields(pds, fieldName, vecX);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Particle> seedArray;
|
||||
seedArray = vtkm::cont::make_ArrayHandle({ vtkm::Particle(vtkm::Vec3f(.2f, 1.0f, .2f), 0),
|
||||
vtkm::Particle(vtkm::Vec3f(.2f, 2.0f, .2f), 1) });
|
||||
vtkm::Id numSeeds = seedArray.GetNumberOfValues();
|
||||
|
||||
if (fType == STREAMLINE)
|
||||
{
|
||||
vtkm::filter::flow::Streamline streamline;
|
||||
SetFilter(streamline,
|
||||
stepSize,
|
||||
numSteps,
|
||||
fieldName,
|
||||
seedArray,
|
||||
useThreaded,
|
||||
useAsyncComm,
|
||||
useBlockIds,
|
||||
blockIds);
|
||||
auto out = streamline.Execute(pds);
|
||||
|
||||
vtkm::Id numOutputs = out.GetNumberOfPartitions();
|
||||
bool checkEnds = numOutputs == static_cast<vtkm::Id>(blockIds.size());
|
||||
for (vtkm::Id i = 0; i < numOutputs; i++)
|
||||
{
|
||||
ValidateOutput(out.GetPartition(i),
|
||||
numSeeds,
|
||||
xMaxRanges[blockIds[i]],
|
||||
fType,
|
||||
checkEnds,
|
||||
duplicateBlocks);
|
||||
}
|
||||
}
|
||||
else if (fType == PARTICLE_ADVECTION)
|
||||
{
|
||||
vtkm::filter::flow::ParticleAdvection particleAdvection;
|
||||
SetFilter(particleAdvection,
|
||||
stepSize,
|
||||
numSteps,
|
||||
fieldName,
|
||||
seedArray,
|
||||
useThreaded,
|
||||
useAsyncComm,
|
||||
useBlockIds,
|
||||
blockIds);
|
||||
|
||||
auto out = particleAdvection.Execute(pds);
|
||||
|
||||
//Particles end up in last rank.
|
||||
if (comm.rank() == comm.size() - 1)
|
||||
{
|
||||
bool checkEnds = out.GetNumberOfPartitions() == static_cast<vtkm::Id>(blockIds.size());
|
||||
VTKM_TEST_ASSERT(out.GetNumberOfPartitions() == 1, "Wrong number of partitions in output");
|
||||
ValidateOutput(out.GetPartition(0),
|
||||
numSeeds,
|
||||
xMaxRanges[xMaxRanges.size() - 1],
|
||||
fType,
|
||||
checkEnds,
|
||||
duplicateBlocks);
|
||||
}
|
||||
else
|
||||
VTKM_TEST_ASSERT(out.GetNumberOfPartitions() == 0, "Wrong number of partitions in output");
|
||||
}
|
||||
else if (fType == PATHLINE)
|
||||
{
|
||||
vtkm::cont::PartitionedDataSet pds2;
|
||||
for (const auto& bid : blockIds)
|
||||
pds2.AppendPartition(allPDS2[n].GetPartition(bid));
|
||||
AddVectorFields(pds2, fieldName, vecX);
|
||||
|
||||
vtkm::filter::flow::Pathline pathline;
|
||||
SetFilter(pathline,
|
||||
stepSize,
|
||||
numSteps,
|
||||
fieldName,
|
||||
seedArray,
|
||||
useThreaded,
|
||||
useAsyncComm,
|
||||
useBlockIds,
|
||||
blockIds);
|
||||
|
||||
pathline.SetPreviousTime(time0);
|
||||
pathline.SetNextTime(time1);
|
||||
pathline.SetNextDataSet(pds2);
|
||||
|
||||
auto out = pathline.Execute(pds);
|
||||
vtkm::Id numOutputs = out.GetNumberOfPartitions();
|
||||
bool checkEnds = numOutputs == static_cast<vtkm::Id>(blockIds.size());
|
||||
for (vtkm::Id i = 0; i < numOutputs; i++)
|
||||
ValidateOutput(out.GetPartition(i),
|
||||
numSeeds,
|
||||
xMaxRanges[blockIds[i]],
|
||||
fType,
|
||||
checkEnds,
|
||||
duplicateBlocks);
|
||||
}
|
||||
}
|
||||
}
|
82
vtkm/filter/flow/testing/TestingFlow.h
Normal file
82
vtkm/filter/flow/testing/TestingFlow.h
Normal file
@ -0,0 +1,82 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_flow_testing_TestingFlow_h
|
||||
#define vtk_m_filter_flow_testing_TestingFlow_h
|
||||
|
||||
#include <vtkm/Particle.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/PartitionedDataSet.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
enum FilterType
|
||||
{
|
||||
PARTICLE_ADVECTION,
|
||||
STREAMLINE,
|
||||
PATHLINE
|
||||
};
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3f> CreateConstantVectorField(vtkm::Id num,
|
||||
const vtkm::Vec3f& vec);
|
||||
|
||||
void AddVectorFields(vtkm::cont::PartitionedDataSet& pds,
|
||||
const std::string& fieldName,
|
||||
const vtkm::Vec3f& vec);
|
||||
|
||||
std::vector<vtkm::cont::PartitionedDataSet> CreateAllDataSetBounds(vtkm::Id nPerRank,
|
||||
bool useGhost);
|
||||
|
||||
std::vector<vtkm::Range> ExtractMaxXRanges(const vtkm::cont::PartitionedDataSet& pds,
|
||||
bool useGhost);
|
||||
|
||||
template <typename FilterType>
|
||||
void SetFilter(FilterType& filter,
|
||||
vtkm::FloatDefault stepSize,
|
||||
vtkm::Id numSteps,
|
||||
const std::string& fieldName,
|
||||
vtkm::cont::ArrayHandle<vtkm::Particle> seedArray,
|
||||
bool useThreaded,
|
||||
bool useAsyncComm,
|
||||
bool useBlockIds,
|
||||
const std::vector<vtkm::Id>& blockIds)
|
||||
{
|
||||
filter.SetStepSize(stepSize);
|
||||
filter.SetNumberOfSteps(numSteps);
|
||||
filter.SetSeeds(seedArray);
|
||||
filter.SetActiveField(fieldName);
|
||||
filter.SetUseThreadedAlgorithm(useThreaded);
|
||||
if (useAsyncComm)
|
||||
filter.SetUseAsynchronousCommunication();
|
||||
else
|
||||
filter.SetUseSynchronousCommunication();
|
||||
|
||||
if (useBlockIds)
|
||||
filter.SetBlockIDs(blockIds);
|
||||
}
|
||||
|
||||
void ValidateOutput(const vtkm::cont::DataSet& out,
|
||||
vtkm::Id numSeeds,
|
||||
const vtkm::Range& xMaxRange,
|
||||
FilterType fType,
|
||||
bool checkEndPoint,
|
||||
bool blockDuplication);
|
||||
|
||||
void TestPartitionedDataSet(vtkm::Id nPerRank,
|
||||
bool useGhost,
|
||||
FilterType fType,
|
||||
bool useThreaded,
|
||||
bool useAsyncComm,
|
||||
bool useBlockIds,
|
||||
bool duplicateBlocks);
|
||||
|
||||
#endif // vtk_m_filter_flow_testing_TestingFlow_h
|
@ -0,0 +1,59 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include "TestingFlow.h"
|
||||
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void DoTest()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
|
||||
FilterType filterType = PARTICLE_ADVECTION;
|
||||
bool useAsyncComm = true;
|
||||
|
||||
for (vtkm::Id nPerRank = 1; nPerRank < 3; ++nPerRank)
|
||||
{
|
||||
for (bool useGhost : { true, false })
|
||||
{
|
||||
for (bool useThreaded : { true, false })
|
||||
{
|
||||
for (bool useBlockIds : { true, false })
|
||||
{
|
||||
//Run blockIds with and without block duplication.
|
||||
if (useBlockIds && comm.size() > 1)
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestAdvectionAsynchronousMPI(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(DoTest, argc, argv);
|
||||
}
|
59
vtkm/filter/flow/testing/UnitTestAdvectionSynchronousMPI.cxx
Normal file
59
vtkm/filter/flow/testing/UnitTestAdvectionSynchronousMPI.cxx
Normal file
@ -0,0 +1,59 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include "TestingFlow.h"
|
||||
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void DoTest()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
|
||||
FilterType filterType = PARTICLE_ADVECTION;
|
||||
bool useAsyncComm = false;
|
||||
|
||||
for (vtkm::Id nPerRank = 1; nPerRank < 3; ++nPerRank)
|
||||
{
|
||||
for (bool useGhost : { true, false })
|
||||
{
|
||||
for (bool useThreaded : { true, false })
|
||||
{
|
||||
for (bool useBlockIds : { true, false })
|
||||
{
|
||||
//Run blockIds with and without block duplication.
|
||||
if (useBlockIds && comm.size() > 1)
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestAdvectionSynchronousMPI(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(DoTest, argc, argv);
|
||||
}
|
59
vtkm/filter/flow/testing/UnitTestPathlineAsynchronousMPI.cxx
Normal file
59
vtkm/filter/flow/testing/UnitTestPathlineAsynchronousMPI.cxx
Normal file
@ -0,0 +1,59 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include "TestingFlow.h"
|
||||
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void DoTest()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
|
||||
FilterType filterType = PATHLINE;
|
||||
bool useAsyncComm = true;
|
||||
|
||||
for (vtkm::Id nPerRank = 1; nPerRank < 3; ++nPerRank)
|
||||
{
|
||||
for (bool useGhost : { true, false })
|
||||
{
|
||||
for (bool useThreaded : { true, false })
|
||||
{
|
||||
for (bool useBlockIds : { true, false })
|
||||
{
|
||||
//Run blockIds with and without block duplication.
|
||||
if (useBlockIds && comm.size() > 1)
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestPathlineAsynchronousMPI(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(DoTest, argc, argv);
|
||||
}
|
59
vtkm/filter/flow/testing/UnitTestPathlineSynchronousMPI.cxx
Normal file
59
vtkm/filter/flow/testing/UnitTestPathlineSynchronousMPI.cxx
Normal file
@ -0,0 +1,59 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include "TestingFlow.h"
|
||||
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void DoTest()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
|
||||
FilterType filterType = PATHLINE;
|
||||
bool useAsyncComm = false;
|
||||
|
||||
for (vtkm::Id nPerRank = 1; nPerRank < 3; ++nPerRank)
|
||||
{
|
||||
for (bool useGhost : { true, false })
|
||||
{
|
||||
for (bool useThreaded : { true, false })
|
||||
{
|
||||
for (bool useBlockIds : { true, false })
|
||||
{
|
||||
//Run blockIds with and without block duplication.
|
||||
if (useBlockIds && comm.size() > 1)
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestPathlineSynchronousMPI(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(DoTest, argc, argv);
|
||||
}
|
@ -45,60 +45,6 @@ void AddVectorFields(vtkm::cont::PartitionedDataSet& pds,
|
||||
ds.AddPointField(fieldName, CreateConstantVectorField(ds.GetNumberOfPoints(), vec));
|
||||
}
|
||||
|
||||
std::vector<vtkm::cont::PartitionedDataSet> CreateAllDataSetBounds(vtkm::Id nPerRank, bool useGhost)
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
|
||||
vtkm::Id totNumBlocks = nPerRank * comm.size();
|
||||
vtkm::Id numDims = 5;
|
||||
|
||||
vtkm::FloatDefault x0 = 0;
|
||||
vtkm::FloatDefault x1 = x0 + static_cast<vtkm::FloatDefault>(numDims - 1);
|
||||
vtkm::FloatDefault dx = x1 - x0;
|
||||
vtkm::FloatDefault y0 = 0, y1 = numDims - 1, z0 = 0, z1 = numDims - 1;
|
||||
|
||||
if (useGhost)
|
||||
{
|
||||
numDims = numDims + 2; //add 1 extra on each side
|
||||
x0 = x0 - 1;
|
||||
x1 = x1 + 1;
|
||||
dx = x1 - x0 - 2;
|
||||
y0 = y0 - 1;
|
||||
y1 = y1 + 1;
|
||||
z0 = z0 - 1;
|
||||
z1 = z1 + 1;
|
||||
}
|
||||
|
||||
//Create ALL of the blocks.
|
||||
std::vector<vtkm::Bounds> bounds;
|
||||
for (vtkm::Id i = 0; i < totNumBlocks; i++)
|
||||
{
|
||||
bounds.push_back(vtkm::Bounds(x0, x1, y0, y1, z0, z1));
|
||||
x0 += dx;
|
||||
x1 += dx;
|
||||
}
|
||||
|
||||
const vtkm::Id3 dims(numDims, numDims, numDims);
|
||||
auto allPDS = vtkm::worklet::testing::CreateAllDataSets(bounds, dims, useGhost);
|
||||
|
||||
return allPDS;
|
||||
}
|
||||
|
||||
std::vector<vtkm::Range> ExtractMaxXRanges(const vtkm::cont::PartitionedDataSet& pds, bool useGhost)
|
||||
{
|
||||
std::vector<vtkm::Range> xMaxRanges;
|
||||
for (const auto& ds : pds.GetPartitions())
|
||||
{
|
||||
auto bounds = ds.GetCoordinateSystem().GetBounds();
|
||||
auto xMax = bounds.X.Max;
|
||||
if (useGhost)
|
||||
xMax = xMax - 1;
|
||||
xMaxRanges.push_back(vtkm::Range(xMax, xMax + static_cast<vtkm::FloatDefault>(.5)));
|
||||
}
|
||||
|
||||
return xMaxRanges;
|
||||
}
|
||||
|
||||
template <typename FilterType>
|
||||
void SetFilter(FilterType& filter,
|
||||
vtkm::FloatDefault stepSize,
|
||||
@ -356,265 +302,29 @@ void TestAMRStreamline(FilterType fType, bool useThreaded, bool useAsyncComm)
|
||||
}
|
||||
}
|
||||
|
||||
void ValidateOutput(const vtkm::cont::DataSet& out,
|
||||
vtkm::Id numSeeds,
|
||||
const vtkm::Range& xMaxRange,
|
||||
FilterType fType,
|
||||
bool checkEndPoint,
|
||||
bool blockDuplication)
|
||||
{
|
||||
//Validate the result is correct.
|
||||
VTKM_TEST_ASSERT(out.GetNumberOfCoordinateSystems() == 1,
|
||||
"Wrong number of coordinate systems in the output dataset");
|
||||
|
||||
vtkm::cont::UnknownCellSet dcells = out.GetCellSet();
|
||||
vtkm::Id numCells = out.GetNumberOfCells();
|
||||
|
||||
if (!blockDuplication)
|
||||
VTKM_TEST_ASSERT(numCells == numSeeds, "Wrong number of cells");
|
||||
|
||||
auto coords = out.GetCoordinateSystem().GetDataAsMultiplexer();
|
||||
auto ptPortal = coords.ReadPortal();
|
||||
|
||||
if (fType == STREAMLINE || fType == PATHLINE)
|
||||
{
|
||||
vtkm::cont::CellSetExplicit<> explicitCells;
|
||||
VTKM_TEST_ASSERT(dcells.IsType<vtkm::cont::CellSetExplicit<>>(), "Wrong cell type.");
|
||||
explicitCells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
|
||||
for (vtkm::Id j = 0; j < numCells; j++)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> indices;
|
||||
explicitCells.GetIndices(j, indices);
|
||||
vtkm::Id nPts = indices.GetNumberOfValues();
|
||||
auto iPortal = indices.ReadPortal();
|
||||
vtkm::Vec3f lastPt = ptPortal.Get(iPortal.Get(nPts - 1));
|
||||
if (checkEndPoint)
|
||||
VTKM_TEST_ASSERT(xMaxRange.Contains(lastPt[0]), "Wrong end point for seed");
|
||||
}
|
||||
}
|
||||
else if (fType == PARTICLE_ADVECTION)
|
||||
{
|
||||
if (!blockDuplication)
|
||||
VTKM_TEST_ASSERT(out.GetNumberOfPoints() == numSeeds, "Wrong number of coordinates");
|
||||
if (checkEndPoint)
|
||||
{
|
||||
for (vtkm::Id i = 0; i < numCells; i++)
|
||||
VTKM_TEST_ASSERT(xMaxRange.Contains(ptPortal.Get(i)[0]), "Wrong end point for seed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestPartitionedDataSet(vtkm::Id nPerRank,
|
||||
bool useGhost,
|
||||
FilterType fType,
|
||||
bool useThreaded,
|
||||
bool useAsyncComm,
|
||||
bool useBlockIds,
|
||||
bool duplicateBlocks)
|
||||
void DoTest()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
if (comm.rank() == 0)
|
||||
{
|
||||
switch (fType)
|
||||
{
|
||||
case PARTICLE_ADVECTION:
|
||||
std::cout << "Particle advection";
|
||||
break;
|
||||
case STREAMLINE:
|
||||
std::cout << "Streamline";
|
||||
break;
|
||||
case PATHLINE:
|
||||
std::cout << "Pathline";
|
||||
break;
|
||||
}
|
||||
std::cout << " blocksPerRank= " << nPerRank;
|
||||
if (useGhost)
|
||||
std::cout << " - using ghost cells";
|
||||
if (useThreaded)
|
||||
std::cout << " - using threaded";
|
||||
if (useAsyncComm)
|
||||
std::cout << " - usingAsyncComm";
|
||||
else
|
||||
std::cout << " - usingSyncComm";
|
||||
|
||||
if (useBlockIds)
|
||||
std::cout << " - using block IDs";
|
||||
if (duplicateBlocks)
|
||||
std::cout << " - with duplicate blocks";
|
||||
std::cout << " - on a partitioned data set" << std::endl;
|
||||
std::cout << std::endl << "*** TestStreamlineAMRMPI" << std::endl;
|
||||
}
|
||||
|
||||
std::vector<vtkm::Id> blockIds;
|
||||
//Uniform assignment.
|
||||
for (vtkm::Id i = 0; i < nPerRank; i++)
|
||||
blockIds.push_back(comm.rank() * nPerRank + i);
|
||||
|
||||
//For block duplication, give everyone the 2nd to last block.
|
||||
//We want to keep the last block on the last rank for validation.
|
||||
if (duplicateBlocks && blockIds.size() > 1)
|
||||
for (auto fType : { PARTICLE_ADVECTION, STREAMLINE, PATHLINE })
|
||||
{
|
||||
vtkm::Id totNumBlocks = comm.size() * nPerRank;
|
||||
vtkm::Id dupBlock = totNumBlocks - 2;
|
||||
for (int r = 0; r < comm.size(); r++)
|
||||
for (auto useThreaded : { true, false })
|
||||
{
|
||||
if (std::find(blockIds.begin(), blockIds.end(), dupBlock) == blockIds.end())
|
||||
blockIds.push_back(dupBlock);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<vtkm::cont::PartitionedDataSet> allPDS, allPDS2;
|
||||
allPDS = CreateAllDataSetBounds(nPerRank, useGhost);
|
||||
allPDS2 = CreateAllDataSetBounds(nPerRank, useGhost);
|
||||
auto xMaxRanges = ExtractMaxXRanges(allPDS[0], useGhost);
|
||||
|
||||
vtkm::FloatDefault time0 = 0;
|
||||
vtkm::FloatDefault time1 = xMaxRanges[xMaxRanges.size() - 1].Max;
|
||||
|
||||
vtkm::Vec3f vecX(1, 0, 0);
|
||||
std::string fieldName = "vec";
|
||||
vtkm::FloatDefault stepSize = 0.1f;
|
||||
vtkm::Id numSteps = 100000;
|
||||
for (std::size_t n = 0; n < allPDS.size(); n++)
|
||||
{
|
||||
vtkm::cont::PartitionedDataSet pds;
|
||||
for (const auto& bid : blockIds)
|
||||
pds.AppendPartition(allPDS[n].GetPartition(bid));
|
||||
AddVectorFields(pds, fieldName, vecX);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Particle> seedArray;
|
||||
seedArray = vtkm::cont::make_ArrayHandle({ vtkm::Particle(vtkm::Vec3f(.2f, 1.0f, .2f), 0),
|
||||
vtkm::Particle(vtkm::Vec3f(.2f, 2.0f, .2f), 1) });
|
||||
vtkm::Id numSeeds = seedArray.GetNumberOfValues();
|
||||
|
||||
if (fType == STREAMLINE)
|
||||
{
|
||||
vtkm::filter::flow::Streamline streamline;
|
||||
SetFilter(streamline,
|
||||
stepSize,
|
||||
numSteps,
|
||||
fieldName,
|
||||
seedArray,
|
||||
useThreaded,
|
||||
useAsyncComm,
|
||||
useBlockIds,
|
||||
blockIds);
|
||||
auto out = streamline.Execute(pds);
|
||||
|
||||
vtkm::Id numOutputs = out.GetNumberOfPartitions();
|
||||
bool checkEnds = numOutputs == static_cast<vtkm::Id>(blockIds.size());
|
||||
for (vtkm::Id i = 0; i < numOutputs; i++)
|
||||
for (auto useAsyncComm : { true, false })
|
||||
{
|
||||
ValidateOutput(out.GetPartition(i),
|
||||
numSeeds,
|
||||
xMaxRanges[blockIds[i]],
|
||||
fType,
|
||||
checkEnds,
|
||||
duplicateBlocks);
|
||||
}
|
||||
}
|
||||
else if (fType == PARTICLE_ADVECTION)
|
||||
{
|
||||
vtkm::filter::flow::ParticleAdvection particleAdvection;
|
||||
SetFilter(particleAdvection,
|
||||
stepSize,
|
||||
numSteps,
|
||||
fieldName,
|
||||
seedArray,
|
||||
useThreaded,
|
||||
useAsyncComm,
|
||||
useBlockIds,
|
||||
blockIds);
|
||||
|
||||
auto out = particleAdvection.Execute(pds);
|
||||
|
||||
//Particles end up in last rank.
|
||||
if (comm.rank() == comm.size() - 1)
|
||||
{
|
||||
bool checkEnds = out.GetNumberOfPartitions() == static_cast<vtkm::Id>(blockIds.size());
|
||||
VTKM_TEST_ASSERT(out.GetNumberOfPartitions() == 1, "Wrong number of partitions in output");
|
||||
ValidateOutput(out.GetPartition(0),
|
||||
numSeeds,
|
||||
xMaxRanges[xMaxRanges.size() - 1],
|
||||
fType,
|
||||
checkEnds,
|
||||
duplicateBlocks);
|
||||
}
|
||||
else
|
||||
VTKM_TEST_ASSERT(out.GetNumberOfPartitions() == 0, "Wrong number of partitions in output");
|
||||
}
|
||||
else if (fType == PATHLINE)
|
||||
{
|
||||
vtkm::cont::PartitionedDataSet pds2;
|
||||
for (const auto& bid : blockIds)
|
||||
pds2.AppendPartition(allPDS2[n].GetPartition(bid));
|
||||
AddVectorFields(pds2, fieldName, vecX);
|
||||
|
||||
vtkm::filter::flow::Pathline pathline;
|
||||
SetFilter(pathline,
|
||||
stepSize,
|
||||
numSteps,
|
||||
fieldName,
|
||||
seedArray,
|
||||
useThreaded,
|
||||
useAsyncComm,
|
||||
useBlockIds,
|
||||
blockIds);
|
||||
|
||||
pathline.SetPreviousTime(time0);
|
||||
pathline.SetNextTime(time1);
|
||||
pathline.SetNextDataSet(pds2);
|
||||
|
||||
auto out = pathline.Execute(pds);
|
||||
vtkm::Id numOutputs = out.GetNumberOfPartitions();
|
||||
bool checkEnds = numOutputs == static_cast<vtkm::Id>(blockIds.size());
|
||||
for (vtkm::Id i = 0; i < numOutputs; i++)
|
||||
ValidateOutput(out.GetPartition(i),
|
||||
numSeeds,
|
||||
xMaxRanges[blockIds[i]],
|
||||
fType,
|
||||
checkEnds,
|
||||
duplicateBlocks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestStreamlineFiltersMPI()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
if (comm.rank() == 0)
|
||||
std::cout << std::endl << "*** TestStreamlineFiltersMPI" << std::endl;
|
||||
|
||||
std::vector<bool> flags = { true, false };
|
||||
std::vector<FilterType> filterTypes = { PARTICLE_ADVECTION, STREAMLINE, PATHLINE };
|
||||
|
||||
for (int n = 1; n < 3; n++)
|
||||
for (auto useGhost : flags)
|
||||
for (auto fType : filterTypes)
|
||||
for (auto useThreaded : flags)
|
||||
for (auto useAsyncComm : flags)
|
||||
for (auto useBlockIds : flags)
|
||||
{
|
||||
//Run blockIds with and without block duplication.
|
||||
if (useBlockIds && comm.size() > 1)
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
n, useGhost, fType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
TestPartitionedDataSet(
|
||||
n, useGhost, fType, useThreaded, useAsyncComm, useBlockIds, true);
|
||||
}
|
||||
else
|
||||
TestPartitionedDataSet(
|
||||
n, useGhost, fType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
}
|
||||
|
||||
for (auto fType : filterTypes)
|
||||
for (auto useThreaded : flags)
|
||||
for (auto useAsyncComm : flags)
|
||||
TestAMRStreamline(fType, useThreaded, useAsyncComm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int UnitTestStreamlineFilterMPI(int argc, char* argv[])
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestStreamlineAMRMPI(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(TestStreamlineFiltersMPI, argc, argv);
|
||||
return vtkm::cont::testing::Testing::Run(DoTest, argc, argv);
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include "TestingFlow.h"
|
||||
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void DoTest()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
|
||||
FilterType filterType = STREAMLINE;
|
||||
bool useAsyncComm = true;
|
||||
|
||||
for (vtkm::Id nPerRank = 1; nPerRank < 3; ++nPerRank)
|
||||
{
|
||||
for (bool useGhost : { true, false })
|
||||
{
|
||||
for (bool useThreaded : { true, false })
|
||||
{
|
||||
for (bool useBlockIds : { true, false })
|
||||
{
|
||||
//Run blockIds with and without block duplication.
|
||||
if (useBlockIds && comm.size() > 1)
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestStreamlineAsynchronousMPI(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(DoTest, argc, argv);
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include "TestingFlow.h"
|
||||
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void DoTest()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
|
||||
FilterType filterType = STREAMLINE;
|
||||
bool useAsyncComm = false;
|
||||
|
||||
for (vtkm::Id nPerRank = 1; nPerRank < 3; ++nPerRank)
|
||||
{
|
||||
for (bool useGhost : { true, false })
|
||||
{
|
||||
for (bool useThreaded : { true, false })
|
||||
{
|
||||
for (bool useBlockIds : { true, false })
|
||||
{
|
||||
//Run blockIds with and without block duplication.
|
||||
if (useBlockIds && comm.size() > 1)
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestPartitionedDataSet(
|
||||
nPerRank, useGhost, filterType, useThreaded, useAsyncComm, useBlockIds, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestStreamlineSynchronousMPI(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(DoTest, argc, argv);
|
||||
}
|
Loading…
Reference in New Issue
Block a user