Commit 228f5014 authored by Burlen Loring's avatar Burlen Loring

Merge branch 'release-3.2.0' into 'master'

Release 3.2.0

See merge request !232

Release notes:

This release contains ADIOS2 work. It is also a sync point with AMReX codes.
Now AMReX and WarpX development branches are tested and working.
In addition this release contains bug fixes for VTK I/O, Ascent, HDF5, and
sensei_config.

  1 c1ba0968 sensei_config remove spaces in link dependencies
  2 9757d421 (origin/fix_sensei_config_warning, fix_sensei_config_warning) fix sensei_config warning
  3 9c987ffc added std:: to i/ostreams
  4 9c18ee18 added filename for supported xml attribute name
  5 958d3e5a removed ADIOS1 traces
  6 f8aff402 fix a typo in ascent adaptor
  7 def834ca (origin/sensei_3_amrex, sensei_3_amrex) amr metadata validations
  8 a511934a adios2 fix miultiple defines
  9 9989a428 check adios2 calls for errors
 10 0a2edb11 XML attributes to set ADIOS 2 buffering
 11 a89934b5 IsoSurfacePartitioner write domain decomp in vtu format
 12 e32e7655 Add an XML option to ADIOS2 to specify the reader connection timeout
 13 567131a2 sensei_config get compiler from environment
 14 72298fcf only find MPI C library
 15 5930c5ea work around a bug in ADISO2 cmake code
 16 86289037 Added BlockLevel in slice extract VTK output
 17 ac229e6f always request ghost cells for AMR meshes
 18 88682d49 VTKPosthocIO dont write datasets that have no cells
 19 df340bec fix indexing bug for AMR data in SliceExtract
 20 28e902ac improve metadata validations
 21 e3238528 fixes to ADISO2 schema for AMR
 22 5a29cf7c disable experimentatal miniapps by default and mark them as experimental
 23 bbc5178d update the version number with every configure pass
 24 46d71432 use ADIOS2_DIR in CMake export config
 25 1b11270d expose version in sensei_config
 26 cb477c18 fix bad error check in VTKUtils
 27 a98dd16a (origin/macos_fixes_for_ci) Python fixes and improvements
 28 e6e7151a use Python 3 by default
 29 51724e12 don't enable VTK_RENDERING by default
 30 e8c3114f make oscillator VTK writer test depend on VTK_IO
 31 d66503ff make mandelbrot VTK writer test depend on VTK_MPI
 32 1412cb31 fix a warning in ADIOS2 schema
 33 752d720b move cdash site form hpcvis to nersc
 34 ffe93461 (origin/fix_ghost_cell_name, fix_ghost_cell_name) fix a crash when compiled against Debug build of VTK
 35 425203bb Add regression tests for ADISO2 M x N
 36 68922049 configurable analysis plumbing for adios2
 37 1fe2d8ec make send/receive ADIOS2 XML symetric
 38 a62d6da1 cleanup left over cmake code from old external diy
 39 63526f47 adios2 integer type for selections
 40 bb002891 clean up profiler macros
 41 2df4af27 remove adios2 end-point
 42 48732c1c apply profiler updates to adios2 work and minor cleanup
 43 56538ee9 Removing prints and adding ability to set adios2 parameters.
 44 b4c8bb63 Adding another testing file.
 45 a674d4c3 Updates to get SST working initially.
 46 4b9d878f Updates to get BP working and starting debug of sst.
 47 2970669a More updates to get adios2 integrated and fully building.
 48 9e063150 Working on adios2 rea updates.
 49 60364460 Updating a bunch of adios2 write stuff from adios1 version.
 50 7ff0dcb6 More adios2 updates using C bindings API from ADIOS2...
 51 8f73f202 Adding some initial ADIOS2 files and cmake logic.
parents 922302cb 4b1e24b6
......@@ -4,6 +4,8 @@ set(SENSEI_VERSION_MINOR "@SENSEI_VERSION_MINOR@")
set(SENSEI_VERSION_PATCH "@SENSEI_VERSION_PATCH@")
set(SENSEI_VERSION_DEVEL "@SENSEI_VERSION_DEVEL@")
include(CMakeFindDependencyMacro)
if (NOT SENSEI_DIR)
if (@SENSEI_BUILD@)
set(SENSEI_DIR "@CMAKE_BINARY_DIR@")
......@@ -31,6 +33,7 @@ set(ENABLE_CATALYST @ENABLE_CATALYST@)
set(ENABLE_CATALYST_PYTHON @ENABLE_CATALYST_PYTHON@)
set(ENABLE_LIBSIM @ENABLE_LIBSIM@)
set(ENABLE_ADIOS1 @ENABLE_ADIOS1@)
set(ENABLE_ADIOS2 @ENABLE_ADIOS2@)
set(ENABLE_HDF5 @ENABLE_HDF5@)
set(ENABLE_CONDUIT @ENABLE_CONDUIT@)
set(ENABLE_VTK_GENERIC_ARRAYS @ENABLE_VTK_GENERIC_ARRAYS@)
......@@ -50,13 +53,13 @@ endif()
if (ENABLE_CATALYST)
if (NOT ParaView_DIR)
set(ParaView_DIR "@ParaView_DIR@")
find_package(ParaView REQUIRED)
find_dependency(ParaView)
endif()
else()
if (NOT VTK_DIR)
set(VTK_DIR "@VTK_DIR@")
endif()
find_package(VTK REQUIRED)
find_dependency(VTK)
endif()
include(thread)
......@@ -64,6 +67,7 @@ include(sMPI)
include(sVTK)
include(pugixml)
include(sDIY)
if (ENABLE_VTKM)
include(sVTKm)
endif()
......@@ -73,21 +77,29 @@ endif()
if (ENABLE_ADIOS1)
include(sADIOS1)
endif()
if (ENABLE_ADIOS2)
if(NOT ADIOS2_DIR)
set(ADIOS2_DIR "@ADIOS2_DIR@")
endif()
find_dependency(ADIOS2)
list(APPEND CMAKE_MODULE_PATH "${SENSEI_DIR}")
include(sADIOS2)
endif()
if (ENABLE_HDF5)
include(sHDF5)
include(sHDF5)
endif()
if (ENABLE_CONDUIT)
if(NOT CONDUIT_DIR)
set(CONDUIT_DIR "@CONDUIT_DIR@")
endif()
find_package(Conduit REQUIRED NO_DEFAULT_PATH PATHS ${CONDUIT_DIR}/lib/cmake)
find_dependency(Conduit NO_DEFAULT_PATH PATHS ${CONDUIT_DIR})
include(sConduit)
endif()
if(ENABLE_ASCENT)
if(NOT ASCENT_DIR)
set(ASCENT_DIR "@ASCENT_DIR@")
endif()
find_package(Ascent REQUIRED NO_DEFAULT_PATH PATHS ${ASCENT_DIR}/lib/cmake)
find_dependency(Ascent NO_DEFAULT_PATH PATHS ${ASCENT_DIR})
include(sAscent)
endif()
include(senseiCore)
......
if(ENABLE_ADIOS2)
find_package(ADIOS2 REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
add_library(sADIOS2 INTERFACE)
target_link_libraries(sADIOS2 INTERFACE adios2::adios2)
install(TARGETS sADIOS2 EXPORT sADIOS2)
install(EXPORT sADIOS2 DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
endif()
......@@ -6,9 +6,9 @@ if (ENABLE_CRAY_MPICH OR (NOT DEFINED ENABLE_CRAY_MPICH AND NOT ("$ENV{CRAY_MPIC
set(MPI_C_INCLUDE_PATH ${CRAY_MPICH_INCLUDE_DIRS} CACHE STRING "MPI include directories")
set(MPI_C_LIBRARIES ${CRAY_MPICH_LDFLAGS} CACHE STRING "MPI link dependencies")
set(MPIEXEC srun CACHE STRING "Platform MPI run equivalent")
set(MPI_C_FOUND CACHE BOOL ON "status of MPI config")
set(MPI_C_FOUND CACHE BOOL TRUE "status of MPI config")
else()
find_package(MPI)
find_package(MPI COMPONENTS C)
endif()
if (NOT MPI_C_FOUND)
......
......@@ -9,13 +9,17 @@ cmake_dependent_option(ENABLE_CATALYST
"ENABLE_SENSEI" OFF)
cmake_dependent_option(ENABLE_CATALYST_PYTHON
"Enable analysis methods that use Catalyst Python scripts" OFF
"Enable analysis methods that use Catalyst Python scripts" ON
"ENABLE_CATALYST" OFF)
cmake_dependent_option(ENABLE_ADIOS1
"Enable analysis methods that use ADIOS 1" OFF
"ENABLE_SENSEI" OFF)
cmake_dependent_option(ENABLE_ADIOS2
"Enable analysis methods that use ADIOS 2" OFF
"ENABLE_SENSEI" OFF)
cmake_dependent_option(ENABLE_HDF5
"Enable analysis methods that use HDF5" OFF
"ENABLE_SENSEI" OFF)
......@@ -49,7 +53,7 @@ cmake_dependent_option(ENABLE_VTK_MPI
"ENABLE_SENSEI" OFF)
cmake_dependent_option(ENABLE_VTK_RENDERING
"Enable use of VTK's rendering libraries" ON
"Enable use of VTK's rendering libraries" OFF
"ENABLE_SENSEI" OFF)
cmake_dependent_option(ENABLE_VTK_ACCELERATORS
......@@ -69,19 +73,19 @@ cmake_dependent_option(ENABLE_VTKM_RENDERING
"ENABLE_VTKM" OFF)
option(ENABLE_OPTS "A version of the getopt function" ON)
option(ENABLE_PROFILER "Enable the internal profiler" OFF)
option(ENABLE_OSCILLATORS "Enable Oscillators miniapp" ON)
option(ENABLE_CONDUITTEST "Enable Conduit miniapp" OFF)
option(ENABLE_KRIPKE "Enable Kripke miniapp" OFF)
option(ENABLE_MANDELBROT "Enable Mandelbrot miniapp" ON)
option(ENABLE_VORTEX "Enable Vortex miniapp" ON)
option(ENABLE_MANDELBROT "Enable Mandelbrot AMR miniapp" ON)
option(ENABLE_VORTEX "Enable Vortex miniapp (experimental)" OFF)
option(ENABLE_CONDUITTEST "Enable Conduit miniapp (experimental)" OFF)
option(ENABLE_KRIPKE "Enable Kripke miniapp (experimental)" OFF)
message(STATUS "ENABLE_SENSEI=${ENABLE_SENSEI}")
message(STATUS "ENABLE_PYTHON=${ENABLE_PYTHON}")
message(STATUS "ENABLE_CATALYST=${ENABLE_CATALYST}")
message(STATUS "ENABLE_CATALYST_PYTHON=${ENABLE_CATALYST}")
message(STATUS "ENABLE_ADIOS1=${ENABLE_ADIOS1}")
message(STATUS "ENABLE_ADIOS2=${ENABLE_ADIOS2}")
message(STATUS "ENABLE_HDF5=${ENABLE_HDF5}")
message(STATUS "ENABLE_CONDUIT=${ENABLE_CONDUIT}")
message(STATUS "ENABLE_ASCENT=${ENABLE_ASCENT}")
......@@ -95,8 +99,11 @@ message(STATUS "ENABLE_VTK_FILTERS=${ENABLE_VTK_FILTERS}")
message(STATUS "ENABLE_VTKM=${ENABLE_VTKM}")
message(STATUS "ENABLE_VTKM_RENDERING=${ENABLE_VTKM_RENDERING}")
message(STATUS "ENABLE_PROFILER=${ENABLE_PROFILER}")
message(STATUS "ENABLE_DIY=${ENABLE_DIY}")
message(STATUS "ENABLE_OPTS=${ENABLE_OPTS}")
message(STATUS "ENABLE_OSCILLATORS=${ENABLE_OSCILLATORS}")
message(STATUS "ENABLE_CONDUITTEST=${ENABLE_CONDUITTEST}")
message(STATUS "ENABLE_KRIPKE=${ENABLE_KRIPKE}")
if (ENABLE_ADIOS1 AND ENABLE_ADIOS2)
message(FATAL_ERROR "ADIOS1 and ADIOS2 are mutually exclusive build options")
endif()
if (ENABLE_PYTHON)
set(SENSEI_PYTHON_VERSION 2 CACHE STRING "The major version number of Python SENSEI should use.")
set(SENSEI_PYTHON_VERSION 3 CACHE STRING
"The major version number of Python SENSEI should use.")
set_property(CACHE SENSEI_PYTHON_VERSION PROPERTY STRINGS 2 3)
find_package(PythonInterp ${SENSEI_PYTHON_VERSION} REQUIRED)
find_package(PythonLibs ${SENSEI_PYTHON_VERSION} REQUIRED)
......
......@@ -8,7 +8,7 @@ endif()
if(NOT tmp)
set(tmp "v0.0.0")
endif()
set(SENSEI_VERSION ${tmp} CACHE STRING "SENSEI version")
set(SENSEI_VERSION ${tmp} CACHE STRING "SENSEI version" FORCE)
string(REGEX REPLACE "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*$)"
"\\1" SENSEI_VERSION_MAJOR ${SENSEI_VERSION})
......
......@@ -5,10 +5,6 @@ set(sensei_vtk_components_modern)
set(sensei_vtk_components_legacy vtkCommonDataModel)
set(sensei_vtk_components_modern CommonDataModel)
# note: this may be a bug. VTKUtils::WriteDomainDecomp requires
# `vtkUnstructuredGridWriter`. Not sure if that requirement is reasonable. It
# adds a required dependency to `VTK::IOLegacy` which may not be a good idea in
# the long run.
list(APPEND sensei_vtk_components_legacy vtkIOLegacy)
list(APPEND sensei_vtk_components_modern IOLegacy)
......
......@@ -12,6 +12,7 @@ include(build)
include(threads)
include(mpi)
include(adios)
include(adios2)
include(hdf5)
include(vtk)
include(libsim)
......
set(CTEST_PROJECT_NAME "SENSEI")
set(CTEST_NIGHTLY_START_TIME "18:00:00 EDT")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "cdash.hpcvis.com")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EDT")
set(CTEST_DROP_METHOD "https")
set(CTEST_DROP_SITE "cdash.nersc.gov")
set(CTEST_DROP_LOCATION "/submit.php?project=SENSEI")
set(CTEST_DROP_SITE_CDASH TRUE)
......@@ -4,6 +4,10 @@ if(ENABLE_ADIOS1)
list(APPEND endPointLibs sADIOS1)
endif()
if(ENABLE_ADIOS2)
list(APPEND endPointLibs sADIOS2)
endif()
if(ENABLE_HDF5)
list(APPEND endPointLibs sHDF5)
endif()
......
......@@ -597,7 +597,7 @@ int main(int argc, char **argv)
#endif
//pause();
ofstream log;
std::ofstream log;
if(sim.log && sim.par_rank == 0)
{
log.open("mandelbrot.log");
......
......@@ -9,7 +9,7 @@ if (BUILD_TESTING)
mandelbrot -i 2 -l 2
-f ${CMAKE_CURRENT_SOURCE_DIR}/mandelbrot_histogram.xml)
if (ENABLE_VTK_IO)
if (ENABLE_VTK_IO AND ENABLE_VTK_MPI)
senseiAddTest(testMandelbrotVTKWriter
COMMAND mandelbrot -i 2 -l 2
-f ${CMAKE_CURRENT_SOURCE_DIR}/mandelbrot_vtkwriter.xml)
......
......@@ -715,7 +715,7 @@ int main(int argc, char **argv)
#endif
//pause();
ofstream log;
std::ofstream log;
if(sim.log && sim.par_rank == 0)
{
log.open("vortex.log");
......
......@@ -8,6 +8,15 @@ if (ENABLE_PYTHON)
PYTHON_ADD_MODULE(_senseiPython ${CMAKE_CURRENT_BINARY_DIR}/senseiPython.cxx)
# include the directory containing _senseiPython in the rpath
# this enables one not to have to set (DY)LD_LIBRARY_PATH
# prior to importing sensseiPython
if (APPLE)
set_target_properties(_senseiPython PROPERTIES INSTALL_RPATH "@loader_path/./")
elseif(UNIX)
set_target_properties(_senseiPython PROPERTIES INSTALL_RPATH "\$ORIGIN/./")
endif()
target_link_libraries(_senseiPython PUBLIC sensei sPython)
add_custom_command(TARGET _senseiPython POST_BUILD
......
......@@ -213,6 +213,15 @@ VTK_DERIVED(ADIOS1AnalysisAdaptor)
SENSEI_IN_TRANSIT_DATA_ADAPTOR(ADIOS1DataAdaptor)
#endif
/****************************************************************************
* ADIOS2AnalysisAdaptor/DataAdaptor
***************************************************************************/
#ifdef ENABLE_ADIOS2
VTK_DERIVED(ADIOS2AnalysisAdaptor)
SENSEI_IN_TRANSIT_DATA_ADAPTOR(ADIOS2DataAdaptor)
#endif
#ifdef ENABLE_VTK_IO
/****************************************************************************
* VTKPosthocIO
......
......@@ -78,6 +78,7 @@ bool ADIOS1AnalysisAdaptor::Execute(DataAdaptor* dataAdaptor)
flags.SetBlockDecomp();
flags.SetBlockSize();
flags.SetBlockBounds();
flags.SetBlockExtents();
flags.SetBlockArrayRange();
MeshMetadataMap mdm;
......@@ -126,7 +127,8 @@ bool ADIOS1AnalysisAdaptor::Execute(DataAdaptor* dataAdaptor)
}
// add the ghost cell arrays to the mesh
if (md->NumGhostCells && dataAdaptor->AddGhostCellsArray(dobj, mit.MeshName()))
if ((md->NumGhostCells || VTKUtils::AMR(md)) &&
dataAdaptor->AddGhostCellsArray(dobj, mit.MeshName()))
{
SENSEI_ERROR("Failed to get ghost cells for mesh \"" << mit.MeshName() << "\"")
return false;
......
......@@ -2738,10 +2738,12 @@ int DataObjectSchema::InitializeDataObject(MPI_Comm comm,
struct DataObjectCollectionSchema::InternalsType
{
InternalsType() : BlockOwnerArrayMetadata(0) {}
VersionSchema Version;
DataObjectSchema DataObject;
sensei::MeshMetadataMap SenderMdMap;
sensei::MeshMetadataMap ReceiverMdMap;
int BlockOwnerArrayMetadata;
};
// --------------------------------------------------------------------------
......@@ -2799,20 +2801,26 @@ int DataObjectCollectionSchema::ReadMeshMetadata(MPI_Comm comm, InputStream &iSt
sensei::MeshMetadataPtr md = sensei::MeshMetadata::New();
md->FromStream(bs);
// FIXME
// Don't add internally generated arrays, as these
// interfere with ghost cell/node arrays which are
// also special cases.
/*md->ArrayName.push_back("SenderBlockOwner");
md->ArrayCentering.push_back(vtkDataObject::CELL);
md->ArrayComponents.push_back(1);
md->ArrayType.push_back(VTK_INT);
md->ArrayName.push_back("ReceiverBlockOwner");
md->ArrayCentering.push_back(vtkDataObject::CELL);
md->ArrayComponents.push_back(1);
md->ArrayType.push_back(VTK_INT);
md->NumArrays += 2;*/
// also special cases. adding these breaks the numbering
// scheme we used but these arrays here are useful for
// testing and validation eg. visualizing the decomp
if (this->Internals->BlockOwnerArrayMetadata)
{
md->ArrayName.push_back("SenderBlockOwner");
md->ArrayCentering.push_back(vtkDataObject::CELL);
md->ArrayComponents.push_back(1);
md->ArrayType.push_back(VTK_INT);
md->ArrayName.push_back("ReceiverBlockOwner");
md->ArrayCentering.push_back(vtkDataObject::CELL);
md->ArrayComponents.push_back(1);
md->ArrayType.push_back(VTK_INT);
md->NumArrays += 2;
}
this->Internals->SenderMdMap.PushBack(md);
}
......
#include "ADIOS2AnalysisAdaptor.h"
#include "ADIOS2Schema.h"
#include "DataAdaptor.h"
#include "MeshMetadataMap.h"
#include "VTKUtils.h"
#include "MPIUtils.h"
#include "Profiler.h"
#include "Error.h"
#include <vtkCellTypes.h>
#include <vtkCellData.h>
#include <vtkCompositeDataIterator.h>
#include <vtkCompositeDataSet.h>
#include <vtkDataSetAttributes.h>
#include <vtkDoubleArray.h>
#include <vtkFloatArray.h>
#include <vtkIntArray.h>
#include <vtkUnsignedIntArray.h>
#include <vtkLongArray.h>
#include <vtkUnsignedLongArray.h>
#include <vtkCharArray.h>
#include <vtkUnsignedCharArray.h>
#include <vtkIdTypeArray.h>
#include <vtkCellArray.h>
#include <vtkUnstructuredGrid.h>
#include <vtkPolyData.h>
#include <vtkImageData.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
#include <vtkSmartPointer.h>
#include <mpi.h>
#include <vector>
namespace sensei
{
//----------------------------------------------------------------------------
senseiNewMacro(ADIOS2AnalysisAdaptor);
//----------------------------------------------------------------------------
ADIOS2AnalysisAdaptor::ADIOS2AnalysisAdaptor() : Schema(nullptr),
FileName("sensei.bp"), DebugMode(0)
{
this->Handles.io = nullptr;
this->Handles.engine = nullptr;
}
//----------------------------------------------------------------------------
ADIOS2AnalysisAdaptor::~ADIOS2AnalysisAdaptor()
{
delete this->Schema;
}
//-----------------------------------------------------------------------------
int ADIOS2AnalysisAdaptor::SetDataRequirements(const DataRequirements &reqs)
{
this->Requirements = reqs;
return 0;
}
//-----------------------------------------------------------------------------
int ADIOS2AnalysisAdaptor::AddDataRequirement(const std::string &meshName,
int association, const std::vector<std::string> &arrays)
{
this->Requirements.AddRequirement(meshName, association, arrays);
return 0;
}
//----------------------------------------------------------------------------
bool ADIOS2AnalysisAdaptor::Execute(DataAdaptor* dataAdaptor)
{
TimeEvent<128> mark("ADIOS2AnalysisAdaptor::Execute");
// figure out what the simulation can provide. include the full
// suite of metadata for the end-point partitioners
MeshMetadataFlags flags;
flags.SetBlockDecomp();
flags.SetBlockSize();
flags.SetBlockBounds();
flags.SetBlockExtents();
flags.SetBlockArrayRange();
MeshMetadataMap mdm;
if (mdm.Initialize(dataAdaptor, flags))
{
SENSEI_ERROR("Failed to get metadata")
return false;
}
// if no dataAdaptor requirements are given, push all the data
// fill in the requirements with every thing
if (this->Requirements.Empty())
{
if (this->Requirements.Initialize(dataAdaptor, false))
{
SENSEI_ERROR("Failed to initialze dataAdaptor description")
return false;
}
SENSEI_WARNING("No subset specified. Writing all available data")
}
// collect the specified data objects and metadata
std::vector<vtkCompositeDataSet*> objects;
std::vector<MeshMetadataPtr> metadata;
MeshRequirementsIterator mit =
this->Requirements.GetMeshRequirementsIterator();
while (mit)
{
// get metadata
MeshMetadataPtr md;
if (mdm.GetMeshMetadata(mit.MeshName(), md))
{
SENSEI_ERROR("Failed to get mesh metadata for mesh \""
<< mit.MeshName() << "\"")
return false;
}
// get the mesh
vtkCompositeDataSet *dobj = nullptr;
if (dataAdaptor->GetMesh(mit.MeshName(), mit.StructureOnly(), dobj))
{
SENSEI_ERROR("Failed to get mesh \"" << mit.MeshName() << "\"")
return false;
}
// add the ghost cell arrays to the mesh
if ((md->NumGhostCells || VTKUtils::AMR(md)) &&
dataAdaptor->AddGhostCellsArray(dobj, mit.MeshName()))
{
SENSEI_ERROR("Failed to get ghost cells for mesh \"" << mit.MeshName() << "\"")
return false;
}
// add the ghost node arrays to the mesh
if (md->NumGhostNodes && dataAdaptor->AddGhostNodesArray(dobj, mit.MeshName()))
{
SENSEI_ERROR("Failed to get ghost nodes for mesh \"" << mit.MeshName() << "\"")
return false;
}
// add the required arrays
ArrayRequirementsIterator ait =
this->Requirements.GetArrayRequirementsIterator(mit.MeshName());
while (ait)
{
if (dataAdaptor->AddArray(dobj, mit.MeshName(),
ait.Association(), ait.Array()))
{
SENSEI_ERROR("Failed to add "
<< VTKUtils::GetAttributesName(ait.Association())
<< " data array \"" << ait.Array() << "\" to mesh \""
<< mit.MeshName() << "\"")
return false;
}
++ait;
}
// generate a global view of the metadata. everything we do from here
// on out depends on having the global view.
md->GlobalizeView(this->GetCommunicator());
// add to the collection
objects.push_back(dobj);
metadata.push_back(md);
++mit;
}
unsigned long timeStep = dataAdaptor->GetDataTimeStep();
double time = dataAdaptor->GetDataTime();
if (this->InitializeADIOS2(metadata) ||
this->WriteTimestep(timeStep, time, metadata, objects))
return false;
unsigned int n_objects = objects.size();
for (unsigned int i = 0; i < n_objects; ++i)
objects[i]->Delete();
return true;
}
//----------------------------------------------------------------------------
int ADIOS2AnalysisAdaptor::InitializeADIOS2(
const std::vector<MeshMetadataPtr> &metadata)
{
TimeEvent<128> mark("ADIOS2AnalysisAdaptor::IntializeADIOS2");
if (!this->Schema)
{
// initialize adios2
this->Adios = adios2_init(this->GetCommunicator(),
adios2_debug_mode(this->DebugMode));
if (this->Adios == nullptr)
{
SENSEI_ERROR("adios2_init failed")
return -1;
}
// Open the io handle
this->Handles.io = adios2_declare_io(this->Adios, "SENSEI");
if (this->Handles.io == nullptr)
{
SENSEI_ERROR("adios2_declare_io failed")
return -1;
}
// create space for ADIOS2 variables
this->Schema = new senseiADIOS2::DataObjectCollectionSchema;
// Open the engine now variables are declared
if (adios2_set_engine(this->Handles.io, this->EngineName.c_str()))
{
SENSEI_ERROR("adios2_set_engine failed")
return -1;
}
}
// On subsequent ts we need to clear the existing variables so we don't try to
// redefine existing variables
adios2_error clearErr = adios2_remove_all_variables(this->Handles.io);
if (clearErr != 0)
{
SENSEI_ERROR("adios2_remove_all_variables failed " << clearErr )
return -1;
}
// (re)define variables to support meshes that evovle in time
if (this->Schema->DefineVariables(this->GetCommunicator(),
this->Handles, metadata))
{
SENSEI_ERROR("Failed to define variables")
return -1;
}
return 0;
}
//----------------------------------------------------------------------------
int ADIOS2AnalysisAdaptor::FinalizeADIOS2()
{
adios2_error err = adios2_finalize(this->Adios);
if (err != 0)
{
SENSEI_ERROR("ADIOS2 error on adios2_finalize call, error code enum: " << err )
return -1;
}
return 0;
}
//----------------------------------------------------------------------------
int ADIOS2AnalysisAdaptor::Finalize()
{
TimeEvent<128> mark("ADIOS2AnalysisAdaptor::Finalize");
if (this->Schema)
{
adios2_error err = adios2_close(this->Handles.engine);
if (err != 0)
{
SENSEI_ERROR("ADIOS2 error on adios2_close call, error code enum: " << err )
return -1;
}
this->FinalizeADIOS2();
}
delete this->Schema;
this->Schema = nullptr;
this->Handles.io = nullptr;
this->Handles.engine = nullptr;
return 0;
}
//----------------------------------------------------------------------------
int ADIOS2AnalysisAdaptor::WriteTimestep(unsigned long timeStep,
double time, const std::vector<MeshMetadataPtr> &metadata,
const std::vector<vtkCompositeDataSet*> &objects)
{
TimeEvent<128> mark("ADIOS2AnalysisAdaptor::WriteTimestep");
int ierr = 0;
if (!this->Handles.engine)
{
// If the user set additional parameters, add them now to ADIOS2
for (unsigned int j = 0; j < this->Parameters.size(); j++)
{
adios2_set_parameter(this->Handles.io,
this->Parameters[j].first.c_str(),
this->Parameters[j].second.c_str());
}