Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat instrument catalyst #3459

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1ac86c4
build: add catalyst optional dependency
Jan 18, 2023
f2cea4c
BlueprintOutput: refactor conduit blueprint creation for reuse
Jan 19, 2023
ae895f7
CatalystOutput: new output for in-situ capability
Jan 19, 2023
69912ff
VTK: add mangling compatibility
Mar 13, 2023
e9bcd67
GCC13: fixes for warnings and errors
Jul 20, 2023
9c9eccf
Catalyst: improve blueprint formatting for multi-region support
Aug 8, 2023
e8354fd
CatalystOutput: remove now unrelevant shape information for adios
Aug 31, 2023
577732e
Merge remote-tracking branch 'public/develop' into feat-instrument-ca…
CharlesGueunet Jan 15, 2024
3482d36
Add python wrapping for Catalyst (attempt)
CharlesGueunet Feb 14, 2024
02cb389
Merge remote-tracking branch 'origin/develop' into feat-instrument-ca…
sframba Feb 15, 2024
cea54ad
removed to python function declaration that are not really wrapped
sframba Feb 15, 2024
7826b1c
Add multi-writer sst filename
CharlesGueunet Feb 15, 2024
14b7f11
added Catalyst output to pygeosx.cpp
sframba Feb 15, 2024
ab86833
added python type
sframba Feb 15, 2024
ace066c
Merge branch 'develop' into feat-instrument-catalyst
sframba Feb 15, 2024
34c6b25
Removed spurious parenthesis
sframba Feb 15, 2024
a422203
VTK --> Catalyst leftover
sframba Feb 15, 2024
58bec57
Merge branch 'feat-instrument-catalyst' of https://github.com/julienf…
sframba Feb 15, 2024
6e1ec04
Added leftover python include
sframba Feb 15, 2024
4f21bca
corrected bug in stub implementation
sframba Feb 20, 2024
f21bfbd
added correction from PR 2990 to test elastic workflow
sframba Feb 20, 2024
76396a3
Merge branch 'develop' into feat-instrument-catalyst
sframba Feb 20, 2024
f7f77e2
Merge branch 'develop' into feat-instrument-catalyst
sframba Feb 21, 2024
704a15f
Merge remote-tracking branch 'public/develop' into feat-instrument-ca…
CharlesGueunet Oct 14, 2024
868ee4b
update python for ubuntu docker
CharlesGueunet Nov 8, 2024
21f2c9c
update schema (temp)
CharlesGueunet Nov 19, 2024
62779c1
Fix conduit mapping multi region to avoid array erasing
CharlesGueunet Dec 6, 2024
4af06ff
GEOSX -> GEOS
CharlesGueunet Dec 10, 2024
f666bf6
Add fieldNames option to catalyst output
JeanFechter Dec 9, 2024
b0f6384
Merge pull request #1 from JeanFechter/feat-instrument-catalyst
CharlesGueunet Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions host-configs/tpls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ if(EXISTS ${GEOS_TPL_DIR}/conduit)
set(CONDUIT_DIR ${GEOS_TPL_DIR}/conduit CACHE PATH "" FORCE)
endif()

if(EXISTS ${GEOS_TPL_DIR}/catalyst)
set(CATALYST_DIR ${GEOS_TPL_DIR}/catalyst CACHE PATH "" FORCE)
endif()

if(EXISTS ${GEOS_TPL_DIR}/silo)
set(SILO_DIR ${GEOS_TPL_DIR}/silo CACHE PATH "" FORCE)
endif()
Expand Down
1 change: 1 addition & 0 deletions src/cmake/GeosxOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ option( ENABLE_SCOTCH "Enables SCOTCH" ON )

option( ENABLE_SILO "Enables SILO output" ON )
option( ENABLE_VTK "Enables VTK" ON )
option( ENABLE_CATALYST "Enables catalyst" ON )

option( ENABLE_TOTALVIEW_OUTPUT "Enables Totalview custom view" OFF )

Expand Down
46 changes: 44 additions & 2 deletions src/cmake/thirdparty/SetupGeosxThirdParty.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
####################################
###################################
#
# 3rd Party Dependencies
#
Expand Down Expand Up @@ -828,6 +828,48 @@ else()
message(STATUS "Not using VTK")
endif()

################################
# Catalyst
################################
if(DEFINED CATALYST_DIR)
message(STATUS "CATALYST_DIR = ${CATALYST_DIR}")

set(CATALYST_CMAKE_PREFIX ${CATALYST_DIR}/lib/cmake/catalyst-2.0)
if(NOT EXISTS ${CATALYST_CMAKE_PREFIX})
set(CATALYST_CMAKE_PREFIX ${CATALYST_DIR}/lib64/cmake/catalyst-2.0)
endif()

find_package(catalyst REQUIRED
PATHS ${CATALYST_CMAKE_PREFIX}
NO_DEFAULT_PATH)

if (NOT CATALYST_ABI_VERSION STREQUAL "2")
message(WARNING "CATALYST_DIR was set but catalyst with ABI version 2 was not found")
endif()

set(CATALYST_TARGETS catalyst::catalyst)
foreach( targetName ${CATALYST_TARGETS} )

get_target_property( includeDirs ${targetName} INTERFACE_INCLUDE_DIRECTORIES)

set_property(TARGET ${targetName}
APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
${includeDirs})
endforeach()

set(ENABLE_CATALYST ON CACHE BOOL "Boolean defining whether or not to build with catalyst")
set(thirdPartyLibs ${thirdPartyLibs} catalyst)

else()

if(ENABLE_CATALYST)
message(WARNING "ENABLE_CATALYST is ON but CATALYST_DIR is not defined")
endif()

set(ENABLE_CATALYST OFF CACHE BOOL "Boolean defining whether or not to build with catalyst")
message(STATUS "Not using catalyst")

endif()

################################
# uncrustify
Expand Down Expand Up @@ -867,7 +909,7 @@ if( ${CMAKE_VERSION} VERSION_LESS "3.19" )
set( PYTHON_AND_VERSION Python3 )
set( PYTHON_OPTIONAL_COMPONENTS)
else()
set( PYTHON_AND_VERSION Python3 3.6.0...3.12.2 )
set( PYTHON_AND_VERSION Python3 3.6.0...3.12.3 )
set( PYTHON_OPTIONAL_COMPONENTS OPTIONAL_COMPONENTS Development NumPy)
endif()
if(ENABLE_PYGEOSX)
Expand Down
9 changes: 9 additions & 0 deletions src/coreComponents/fileIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ set( fileIO_sources
set( dependencyList ${parallelDeps} events mesh HDF5::HDF5 )
if( ENABLE_PYGEOSX )
list( APPEND fileIO_headers
python/PyCatalystOutputType.hpp
python/PyHistoryCollectionType.hpp
python/PyHistoryOutputType.hpp
python/PyVTKOutputType.hpp )
list( APPEND fileIO_sources
python/PyCatalystOutput.cpp
python/PyHistoryCollection.cpp
python/PyHistoryOutput.cpp
python/PyVTKOutput.cpp )
Expand Down Expand Up @@ -79,6 +81,13 @@ if( ENABLE_CUDA AND ENABLE_CUDA_NVTOOLSEXT )
list( APPEND dependencyList CUDA::nvToolsExt )
endif()

if ( ENABLE_CATALYST )
add_subdirectory(Catalyst)
list( APPEND fileIO_headers Outputs/CatalystOutput.hpp )
list( APPEND fileIO_sources Outputs/CatalystOutput.cpp )
list( APPEND dependencyList fileIOCatalyst )
endif()

geos_decorate_link_dependencies( LIST decoratedDependencies
DEPENDENCIES ${dependencyList} )

Expand Down
29 changes: 29 additions & 0 deletions src/coreComponents/fileIO/Catalyst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set(catalyst_headers
CatalystActions.hpp
ConduitCapsule.hpp
GenericConduitCapsule.hpp
)

set(catalyst_sources
CatalystActions.cpp
ConduitCapsule.cpp
)

set(catalyst_template_sources
GenericConduitCapsule.tpp
)

set(catalyst_dependencies
catalyst::catalyst
)

list(APPEND ${catalyst_headers} ${catalyst_template_sources})

blt_add_library( NAME fileIOCatalyst
SOURCES ${catalyst_sources}
HEADERS ${catalyst_headers}
DEPENDS_ON ${catalyst_dependencies}
OBJECT ${GEOS_BUILD_OBJ_LIBS}
)

geosx_add_code_checks(PREFIX fileIOCatalyst )
174 changes: 174 additions & 0 deletions src/coreComponents/fileIO/Catalyst/CatalystActions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/

/**
* @file CatalystActions.cpp
*/

// source includes
#include "CatalystActions.hpp"

// external includes
#include <catalyst.hpp>

#include <functional>

namespace geos
{

namespace internal
{

/*
* Convert the encapsulated simulation conduit node into a catalyst conduit node
*/
conduit_cpp::Node Convert(ConduitCapsule* simulationNode)
{
conduit_cpp::Node convertedNode;

if (!simulationNode)
{
return convertedNode;
}

if(simulationNode->IsList() && simulationNode->IsInt8())
{
convertedNode.set_int8_vector(simulationNode->GetInt8Array());
}
else if(simulationNode->IsList() && simulationNode->IsInt16())
{
convertedNode.set_int16_vector(simulationNode->GetInt16Array());
}
else if(simulationNode->IsList() && simulationNode->IsInt32())
{
convertedNode.set_int32_vector(simulationNode->GetInt32Array());
}
else if(simulationNode->IsList() && simulationNode->IsInt64())
{
convertedNode.set_int64_vector(simulationNode->GetInt64Array());
}
else if(simulationNode->IsList() && simulationNode->IsUInt8())
{
convertedNode.set_uint8_vector(simulationNode->GetUInt8Array());
}
else if(simulationNode->IsList() && simulationNode->IsUInt16())
{
convertedNode.set_uint16_vector(simulationNode->GetUInt16Array());
}
else if(simulationNode->IsList() && simulationNode->IsUInt32())
{
convertedNode.set_uint32_vector(simulationNode->GetUInt32Array());
}
else if(simulationNode->IsList() && simulationNode->IsUInt64())
{
convertedNode.set_uint64_vector(simulationNode->GetUInt64Array());
}
else if(simulationNode->IsList() && simulationNode->IsFloat32())
{
convertedNode.set_float32_vector(simulationNode->GetFloat32Array());
}
else if(simulationNode->IsList() && simulationNode->IsFloat64())
{
convertedNode.set_float64_vector(simulationNode->GetFloat64Array());
}
else if(simulationNode->IsInt8())
{
convertedNode.set_int8(simulationNode->GetInt8Value());
}
else if(simulationNode->IsInt16())
{
convertedNode.set_int16(simulationNode->GetInt16Value());
}
else if(simulationNode->IsInt32())
{
convertedNode.set_int32(simulationNode->GetInt32Value());
}
else if(simulationNode->IsInt64())
{
convertedNode.set_int64(simulationNode->GetInt64Value());
}
else if(simulationNode->IsUInt8())
{
convertedNode.set_uint8(simulationNode->GetUInt8Value());
}
else if(simulationNode->IsUInt16())
{
convertedNode.set_uint16(simulationNode->GetUInt16Value());
}
else if(simulationNode->IsUInt32())
{
convertedNode.set_uint32(simulationNode->GetUInt32Value());
}
else if(simulationNode->IsUInt64())
{
convertedNode.set_uint64(simulationNode->GetUInt64Value());
}
else if(simulationNode->IsFloat32())
{
convertedNode.set_float32(simulationNode->GetFloat32Value());
}
else if(simulationNode->IsFloat64())
{
convertedNode.set_float64(simulationNode->GetFloat64Value());
}
else if(simulationNode->IsString())
{
convertedNode.set_string(simulationNode->GetStringValue());
}

// Recursively convert children
for(std::size_t iChild = 0; iChild < simulationNode->GetNumberOfChildren(); ++iChild)
{
auto childConduitNode = simulationNode->GetChild(iChild);
auto name = childConduitNode->GetName();
if(name.empty())
{
name="root";
}
convertedNode.set_path_node(name, Convert(childConduitNode.get()));
}

return convertedNode;
}

bool CatalystAction(ConduitCapsule* simulationNode, std::function<bool(conduit_node_impl*)> action)
{
if(!simulationNode)
{
return false;
}

conduit_cpp::Node convertedNode = Convert(simulationNode);

return (action(conduit_cpp::c_node(&convertedNode)) == catalyst_status::catalyst_status_ok);
}

}

bool CatalystInitialize(ConduitCapsule* simulationNode)
{
return internal::CatalystAction(simulationNode, catalyst_initialize);
}

bool CatalystExecute(ConduitCapsule* simulationNode)
{
return internal::CatalystAction(simulationNode, catalyst_execute);
}

bool CatalystFinalize(ConduitCapsule* simulationNode)
{
return internal::CatalystAction(simulationNode, catalyst_finalize);
}

}
46 changes: 46 additions & 0 deletions src/coreComponents/fileIO/Catalyst/CatalystActions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/

/**
* @file CatalystActions.hpp
*/

// source includes
#include "ConduitCapsule.hpp"

namespace geos
{

/**
* @brief Wrapped call to catalyst_initialize
* @param the encapsulated conduit node to convert and send to initialize method
* @returns true on success
*/
bool CatalystInitialize(ConduitCapsule* simulationNode);

/**
* @brief Wrapped call to catalyst_execute
* @param the encapsulated conduit node to convert and send to execute method
* @returns true on success
*/
bool CatalystExecute(ConduitCapsule* simulationNode);

/**
* @brief Wrapped call to catalyst_finalize
* @param the encapsulated conduit node to convert and send to finalize method
* @returns true on success
*/
bool CatalystFinalize(ConduitCapsule* simulationNode);

}
19 changes: 19 additions & 0 deletions src/coreComponents/fileIO/Catalyst/ConduitCapsule.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/

/**
* @file ConduitCapsule.cpp
*/

#include "ConduitCapsule.hpp"
Loading