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

STK: Snapshot 10-31-24 13:21 from Sierra 5.21.6-582-g4d9ef71d #13564

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions packages/stk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

5.21.6-1 (STK_VERSION 5210601) 10/31/2024
stk_mesh, stk_search: more fixes for HIP unified and Cuda no-uvm builds

5.21.6 (STK_VERSION 5210600) 10/25/2024
stk_search: fix build-error (instantiation error for morton_lbvh_search) for gcc 13.2
stk_util: added parallel/OutputStreams.hpp
Expand Down
55 changes: 35 additions & 20 deletions packages/stk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
cmake_minimum_required(VERSION 3.23 FATAL_ERROR)

message("starting STK cmake configuration, CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}")
message("Starting STK cmake configuration, CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}")

option(STK_BUILT_FOR_SIERRA "Enable SIERRA capability" OFF)
set(SIERRA_MIGRATION ${STK_BUILT_FOR_SIERRA} CACHE BOOL "Enable SIERRA capability")
Expand All @@ -46,14 +46,14 @@ endif()
IF(COMMAND TRIBITS_PACKAGE_DECL)
SET(HAVE_STK_Trilinos ON)
TRIBITS_PACKAGE_DECL(STK)
MESSAGE("*** Building STK as a Trilinos package. ***")
message("*** Building STK as a Trilinos package. ***")
ELSE()
SET(HAVE_STK_Trilinos OFF)
project(STK CXX Fortran)

SET(PACKAGE_NAME "STK")

MESSAGE("*** Building STK as a stand-alone cmake package. ***")
message("*** Building STK as a stand-alone cmake package. ***")
ENDIF()

SET(STK_TOPLEVEL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down Expand Up @@ -87,9 +87,9 @@ endif()

STK_ADD_DEBUG_AND_DEPRECATED_OPTIONS()

MESSAGE("\nPROJECT_NAME: '${PROJECT_NAME}'")
MESSAGE("PACKAGE_NAME: '${PACKAGE_NAME}'")
MESSAGE("${PACKAGE_NAME}_SOURCE_DIR: '${${PACKAGE_NAME}_SOURCE_DIR}'\n")
message("\nPROJECT_NAME: '${PROJECT_NAME}'")
message("PACKAGE_NAME: '${PACKAGE_NAME}'")
message("${PACKAGE_NAME}_SOURCE_DIR: '${${PACKAGE_NAME}_SOURCE_DIR}'\n")

IF (HAVE_STK_Trilinos)
SET(STK_HAVE_KOKKOS ON)
Expand All @@ -110,12 +110,12 @@ ELSE()

IF(DEFINED STK_ENABLE_MPI)
IF(STK_ENABLE_MPI)
MESSAGE("MPI requested via STK_ENABLE_MPI=ON")
message("MPI requested via STK_ENABLE_MPI=ON")
ELSE()
MESSAGE("MPI disabled via STK_ENABLE_MPI=OFF")
message("MPI disabled via STK_ENABLE_MPI=OFF")
ENDIF()
ELSE()
MESSAGE("MPI defaulting to off. (STK_ENABLE_MPI not defined)")
message("MPI defaulting to off. (STK_ENABLE_MPI not defined)")
ENDIF()

IF(STK_ENABLE_MPI)
Expand All @@ -125,36 +125,51 @@ ELSE()
include_directories(SYSTEM ${MPI_INCLUDE_PATH})
message("MPI_INCLUDE_PATH: ${MPI_INCLUDE_PATH}")
ELSE()
MESSAGE(FATAL_ERROR "MPI enabled by '-DSTK_ENABLE_MPI' but not found.")
message(FATAL_ERROR "MPI enabled by '-DSTK_ENABLE_MPI' but not found.")
ENDIF()
ELSE()
MESSAGE("Building serial without MPI. (To enable MPI, use '-DSTK_ENABLE_MPI:BOOL=ON')")
message("Building serial without MPI. (To enable MPI, use '-DSTK_ENABLE_MPI:BOOL=ON')")
ENDIF()
ENDIF()

find_package(ArborX QUIET)
if(TARGET ArborX::ArborX)
MESSAGE("Found ArborX, making it available within stk")
SET(STK_HAS_ARBORX ON)
IF (STK_ENABLE_ARBORX OR (NOT HAVE_STK_Trilinos))
if (HAVE_STK_Trilinos)
message("Caution: when building in Trilinos with ArborX enabled, Kokkos versions need to be consistent.")
endif()
find_package(ArborX QUIET)
if(TARGET ArborX::ArborX)
message("Found ArborX, making it available for stk search")
SET(STK_HAS_ARBORX ON)
else()
message("Optional search library ArborX is not enabled.")
endif()
else()
MESSAGE("Optional search library ArborX is not enabled.")
message("Optional search library ArborX is not enabled.")
endif()

stk_check_fp_handling()

if(NOT HAVE_STK_Trilinos)
find_package(SEACAS)
find_package(SEACAS QUIET)
endif()

if(SEACAS_ENABLE_SEACASIoss)
message("Enabling stk usage of SEACASIoss")
SET(STK_HAS_SEACAS_IOSS ON)
else()
message("Optional SEACASIoss usage not enabled")
endif()
if(SEACAS_ENABLE_SEACASExodus)
message("Enabling stk usage of SEACASExodus")
SET(STK_HAS_SEACAS_EXODUS ON)
else()
message("Optional SEACASExodus usage not enabled")
endif()
if(SEACAS_ENABLE_SEACASNemesis)
message("Enabling stk usage of SEACASNemesis")
SET(STK_HAS_SEACAS_NEMESIS ON)
else()
message("Optional SEACASNemesis usage not enabled")
endif()

if (Trilinos_ENABLE_Intrepid2)
Expand Down Expand Up @@ -206,11 +221,11 @@ ELSEIF("${FC_FN_UNDERSCORE}" STREQUAL "UNDER")
ELSEIF("${FC_FN_UNDERSCORE}" STREQUAL "SECOND_UNDER")
SET(FORTRAN_TWO_UNDERSCORES ON)
ELSE()
MESSAGE("Could not determine the Fortran mangling; defaulting to one underscore.")
message("Could not determine the Fortran mangling; defaulting to one underscore.")
SET(FORTRAN_ONE_UNDERSCORE ON)
ENDIF()

MESSAGE("\nCMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message("\nCMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")

STK_CONFIGURE_FILE(STK_Trilinos_config.h)

Expand Down
3 changes: 3 additions & 0 deletions packages/stk/cmake/STK_Trilinos_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
#cmakedefine FORTRAN_TWO_UNDERSCORES
#endif

#cmakedefine STK_HAVE_FP_EXCEPT
#cmakedefine STK_HAVE_FP_ERRNO

#cmakedefine SIERRA_MIGRATION

#cmakedefine STK_16BIT_UPWARDCONN_INDEX_TYPE
Expand Down
23 changes: 23 additions & 0 deletions packages/stk/cmake/fperrno/fperrno_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

#include <cfenv>
#include <cmath>
#include <iostream>

int main(int argc, char** argv)
{
bool haveFpErrno = false;
if (math_errhandling & MATH_ERRNO) {
[[maybe_unused]] auto result = std::log(0.0);
if (errno == ERANGE) {
haveFpErrno = true;
std::cout<<"ON"; //no newline, this output will set a cmake variable
}
}

if (!haveFpErrno) {
std::cout<<"OFF";
}

return 0;
}

23 changes: 23 additions & 0 deletions packages/stk/cmake/fpexcept/fpexcept_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

#include <cfenv>
#include <cmath>
#include <iostream>

int main(int argc, char** argv)
{
bool haveFpExcept = false;
if (math_errhandling & MATH_ERREXCEPT) {
[[maybe_unused]] auto result = std::log(0.0);
if (std::fetestexcept(FE_DIVBYZERO)) {
haveFpExcept = true;
std::cout<<"ON"; //no newline, this output will set a cmake variable
}
}

if (!haveFpExcept) {
std::cout<<"OFF";
}

return 0;
}

29 changes: 29 additions & 0 deletions packages/stk/cmake/stk_wrappers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,35 @@ macro(STK_CONFIGURE_FILE filename)
endif()
endmacro()

function(stk_check_fp_handling)
#
# The following try_run commands use syntax that is supposed to work for
# cmake versions older than 3.25, as stated in cmake documentation
# here: https://cmake.org/cmake/help/latest/command/try_run.html
# As of Nov 8, 2024, trilinos and stk require cmake 3.23
#
message("calling try_run with bindir=${CMAKE_CURRENT_BINARY_DIR}/fpexcept, srcfile=${${PACKAGE_NAME}_SOURCE_DIR}/cmake/fpexcept/fpexcept_test.cpp")
try_run(RUN_RESULT COMPILE_RESULT
${CMAKE_CURRENT_BINARY_DIR}/fpexcept
${${PACKAGE_NAME}_SOURCE_DIR}/cmake/fpexcept/fpexcept_test.cpp
RUN_OUTPUT_VARIABLE FP_RESULT)

message("FP-EXCEPT-CHECK COMPILE_RESULT: ${COMPILE_RESULT}")
message("FP-EXCEPT-CHECK RUN_RESULT: ${RUN_RESULT}")
set(STK_HAVE_FP_EXCEPT ${FP_RESULT} CACHE BOOL "")
message("STK_HAVE_FP_EXCEPT: ${STK_HAVE_FP_EXCEPT}")

try_run(RUN_RESULT COMPILE_RESULT
${CMAKE_CURRENT_BINARY_DIR}/fperrno
${${PACKAGE_NAME}_SOURCE_DIR}/cmake/fperrno/fperrno_test.cpp
RUN_OUTPUT_VARIABLE FP_RESULT)

message("FP-ERRNO-CHECK COMPILE_RESULT: ${COMPILE_RESULT}")
message("FP-ERRNO-CHECK RUN_RESULT: ${RUN_RESULT}")
set(STK_HAVE_FP_ERRNO ${FP_RESULT} CACHE BOOL "")
message("STK_HAVE_FP_ERRNO: ${STK_HAVE_FP_ERRNO}")
endfunction()

function(stk_process_enables)
message("******** Begin stk_process_enables ******")
if(STK_ENABLE_ALL)
Expand Down
2 changes: 2 additions & 0 deletions packages/stk/stk_expreval/stk_expreval/Eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Eval::Eval(VariableMap::Resolver & resolver, const std::string & expression, Var
m_expression(expression),
m_syntaxStatus(false),
m_parseStatus(false),
m_fpErrorBehavior(FPErrorBehavior::Warn),
m_headNode(nullptr),
m_arrayOffsetType(arrayOffsetType),
m_parsedEval(nullptr)
Expand All @@ -58,6 +59,7 @@ Eval::Eval(const std::string & expression, Variable::ArrayOffset arrayOffsetType
m_expression(expression),
m_syntaxStatus(false),
m_parseStatus(false),
m_fpErrorBehavior(FPErrorBehavior::Warn),
m_headNode(nullptr),
m_arrayOffsetType(arrayOffsetType),
m_parsedEval(nullptr)
Expand Down
11 changes: 11 additions & 0 deletions packages/stk/stk_expreval/stk_expreval/Eval.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class Eval
public:
typedef std::set<std::string> UndefinedFunctionSet;

enum class FPErrorBehavior {
Ignore,
Warn,
Error
};

Eval(VariableMap::Resolver &resolver = VariableMap::getDefaultResolver(),
const std::string &expr = "",
const Variable::ArrayOffset arrayOffsetType = Variable::ZERO_BASED_INDEX);
Expand Down Expand Up @@ -113,6 +119,10 @@ class Eval

UndefinedFunctionSet &getUndefinedFunctionSet() { return m_undefinedFunctionSet; }

void set_fp_error_behavior(FPErrorBehavior flag) { m_fpErrorBehavior = flag; }

FPErrorBehavior get_fp_error_behavior() const { return m_fpErrorBehavior; }

bool getSyntaxStatus() const { return m_syntaxStatus; }

bool getParseStatus() const { return m_parseStatus; }
Expand Down Expand Up @@ -198,6 +208,7 @@ class Eval
std::string m_expression;
bool m_syntaxStatus;
bool m_parseStatus;
FPErrorBehavior m_fpErrorBehavior;

Node* m_headNode;
std::vector<std::shared_ptr<Node>> m_nodes;
Expand Down
4 changes: 3 additions & 1 deletion packages/stk/stk_expreval/stk_expreval/NgpNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "stk_expreval/NgpNode.hpp"
#include "stk_expreval/Function.hpp"
#include "stk_expreval/Eval.hpp"

namespace stk {
namespace expreval {
Expand All @@ -47,7 +48,8 @@ NgpNode::NgpNode(const Node& node)
m_ternaryFalseNextNodeIndex(node.m_ternaryFalseNextNodeIndex),
m_leftNodeIndex((node.m_left != nullptr) ? node.m_left->m_currentNodeIndex : -1),
m_rightNodeIndex((node.m_right != nullptr) ? node.m_right->m_currentNodeIndex : -1),
m_ternaryOtherNodeIndex((node.m_ternaryOther != nullptr) ? node.m_ternaryOther->m_currentNodeIndex : -1)
m_ternaryOtherNodeIndex((node.m_ternaryOther != nullptr) ? node.m_ternaryOther->m_currentNodeIndex : -1),
m_fpErrorBehavior(node.m_owner->get_fp_error_behavior())
{
if (m_opcode == OPCODE_CONSTANT) {
m_data.constant.value = node.m_data.constant.value;
Expand Down
Loading
Loading