Skip to content

Commit

Permalink
Merge 'trilinos/Trilinos:develop' (9f89a22) into 'tcad-charon/Trilino…
Browse files Browse the repository at this point in the history
…s:develop' (28a7b37).

* trilinos-develop:
  Have Kokkos TriBITS build set compiler options as target properties (trilinos#11545)
  Update logic for TPL_ENABLE_Kokkos=ON (trilinos#11545)
  TrilinosInstallTests_find_package_Trilinos: Run in own subdir
  Move check for ParMETS version for Zoltan2 to Zoltan2 (trilinos#63)
  Have Kokkos TriBITS build properly export options to package config files (trilinos#11545)
  • Loading branch information
Charonops Jenkins Pipeline committed Apr 1, 2023
2 parents 28a7b37 + 9f89a22 commit 6daa138
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 65 deletions.
6 changes: 5 additions & 1 deletion cmake/ProjectCompilerPostConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
IF (${PROJECT_NAME}_ENABLE_Kokkos)
tribits_get_package_enable_status(Kokkos KokkosEnable "")

IF (KokkosEnable)
MESSAGE("-- " "Skip adding flags for OpenMP because Kokkos flags does that ...")
SET(OpenMP_CXX_FLAGS_OVERRIDE " ")

Expand All @@ -7,4 +9,6 @@ IF (${PROJECT_NAME}_ENABLE_Kokkos)
# Grab those variables here so we know what was the original top-level flags
# and what are the CMAKE_CXX_FLAGS added afterwards for an individual package
SET(TRILINOS_TOPLEVEL_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# NOTE: Setting TRILINOS_TOPLEVEL_CXX_FLAGS only has any impact if Kokkos is
# being treated as an internal package.
ENDIF()
32 changes: 0 additions & 32 deletions cmake/TPLs/FindTPLParMETIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,3 @@ TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( ParMETIS
REQUIRED_HEADERS "parmetis.h;metis.h"
REQUIRED_LIBS_NAMES "parmetis;metis"
)

# Zoltan2 has a dependency on ParMETIS 4.0.3

include(CheckCSourceCompiles)
FUNCTION(CHECK_PARMETIS_HAS_VERSION_4_0_3 VARNAME)
SET(SOURCE
"
#include <stdio.h>
#include <parmetis.h>
int main()
{
#if PARMETIS_MAJOR_VERSION > 4
return 0;
#elif PARMETIS_MAJOR_VERSION == 4 && PARMETIS_MINOR_VERSION > 0
return 0;
#elif PARMETIS_MAJOR_VERSION == 4 && PARMETIS_MINOR_VERSION == 0 && PARMETIS_SUBMINOR_VERSION >= 3
return 0;
#else
parmetis_version_failure
#endif
}
"
)
SET(CMAKE_REQUIRED_LIBRARIES ParMETIS::all_libs)
CHECK_C_SOURCE_COMPILES("${SOURCE}" ${VARNAME})
ENDFUNCTION()

# We can't compile ParMETIS without MPI
IF(TPL_ENABLE_MPI AND TPL_ENABLE_ParMETIS)
CHECK_PARMETIS_HAS_VERSION_4_0_3(HAVE_PARMETIS_VERSION_4_0_3)
ENDIF()
1 change: 1 addition & 0 deletions packages/TrilinosInstallTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ endif()

tribits_add_advanced_test(find_package_Trilinos
OVERALL_NUM_MPI_PROCS 1
OVERALL_WORKING_DIRECTORY TEST_NAME
TEST_0
MESSAGE "Configure a dummy project that calls find_package(Trilinos)"
CMND "${CMAKE_COMMAND}"
Expand Down
12 changes: 9 additions & 3 deletions packages/kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ if( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
message( FATAL_ERROR "FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt." )
endif()

if (COMMAND TRIBITS_PACKAGE_DECL)
TRIBITS_PACKAGE_DECL(Kokkos)
endif()

# We want to determine if options are given with the wrong case
# In order to detect which arguments are given to compare against
# the list of valid arguments, at the beginning here we need to
# form a list of all the given variables. If it begins with any
# case of KoKkOS, we add it to the list.


GET_CMAKE_PROPERTY(_variableNames VARIABLES)
SET(KOKKOS_GIVEN_VARIABLES)
FOREACH (var ${_variableNames})
Expand Down Expand Up @@ -123,6 +126,8 @@ IF(NOT KOKKOS_HAS_TRILINOS)
FORCE)
ENDIF()
ENDIF()
ELSE()
SET(KOKKOS_COMPILE_LANGUAGE CXX)
ENDIF()

IF (NOT CMAKE_SIZEOF_VOID_P)
Expand Down Expand Up @@ -288,8 +293,9 @@ IF (KOKKOS_HAS_TRILINOS)
$<$<COMPILE_LANGUAGE:CXX>:${KOKKOS_ALL_COMPILE_OPTIONS}>)
ENDIF()

KOKKOS_PACKAGE_DECL()

if (NOT COMMAND TRIBITS_PACKAGE_DECL)
KOKKOS_PACKAGE_DECL()
endif()

#------------------------------------------------------------------------------
#
Expand Down
9 changes: 9 additions & 0 deletions packages/kokkos/cmake/kokkos_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# Validate options are given with correct case and define an internal
# upper-case version for use within

set(Kokkos_OPTIONS_NOT_TO_EXPORT
Kokkos_ENABLE_TESTS Kokkos_ENABLE_EXAMPLES)

#
#
# @FUNCTION: kokkos_deprecated_list
Expand Down Expand Up @@ -57,6 +60,12 @@ FUNCTION(kokkos_option CAMEL_SUFFIX DEFAULT TYPE DOCSTRING)
# Make sure this appears in the cache with the appropriate DOCSTRING
SET(${CAMEL_NAME} ${DEFAULT} CACHE ${TYPE} ${DOCSTRING})

IF (KOKKOS_HAS_TRILINOS)
IF (NOT CAMEL_NAME IN_LIST Kokkos_OPTIONS_NOT_TO_EXPORT)
TRIBITS_PKG_EXPORT_CACHE_VAR(${CAMEL_NAME})
ENDIF()
ENDIF()

#I don't love doing it this way because it's N^2 in number options, but c'est la vie
FOREACH(opt ${KOKKOS_GIVEN_VARIABLES})
STRING(TOUPPER ${opt} OPT_UC)
Expand Down
43 changes: 17 additions & 26 deletions packages/kokkos/cmake/kokkos_tribits.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ MACRO(KOKKOS_INSTALL_ADDITIONAL_FILES)
DESTINATION ${KOKKOS_HEADER_DIR})
ENDMACRO()


FUNCTION(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME)
CMAKE_PARSE_ARGUMENTS(PARSE
"PLAIN_STYLE"
Expand Down Expand Up @@ -441,6 +442,7 @@ FUNCTION(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME)
ENDIF()
ENDFUNCTION()


FUNCTION(KOKKOS_INTERNAL_ADD_LIBRARY LIBRARY_NAME)
CMAKE_PARSE_ARGUMENTS(PARSE
"STATIC;SHARED"
Expand Down Expand Up @@ -503,19 +505,11 @@ FUNCTION(KOKKOS_ADD_LIBRARY LIBRARY_NAME)
# preserving the directory structure, e.g. impl
# If headers got installed in both locations, it breaks some
# downstream packages
TRIBITS_ADD_LIBRARY(${LIBRARY_NAME} ${PARSE_UNPARSED_ARGUMENTS})
#Stolen from Tribits - it can add prefixes
SET(TRIBITS_LIBRARY_NAME_PREFIX "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}")
SET(TRIBITS_LIBRARY_NAME ${TRIBITS_LIBRARY_NAME_PREFIX}${LIBRARY_NAME})
#Tribits has way too much techinical debt and baggage to even
#allow PUBLIC target_compile_options to be used. It forces C++ flags on projects
#as a giant blob of space-separated strings. We end up with duplicated
#flags between the flags implicitly forced on Kokkos-dependent and those Kokkos
#has in its public INTERFACE_COMPILE_OPTIONS.
#These do NOT get de-deduplicated because Tribits
#creates flags as a giant monolithic space-separated string
#Do not set any transitive properties and keep everything working as before
#KOKKOS_SET_LIBRARY_PROPERTIES(${TRIBITS_LIBRARY_NAME} PLAIN_STYLE)
TRIBITS_ADD_LIBRARY(${LIBRARY_NAME} ${PARSE_UNPARSED_ARGUMENTS}
ADDED_LIB_TARGET_NAME_OUT ${LIBRARY_NAME}_TARGET_NAME )
IF (PARSE_ADD_BUILD_OPTIONS)
KOKKOS_SET_LIBRARY_PROPERTIES(${${LIBRARY_NAME}_TARGET_NAME})
ENDIF()
ELSE()
# Forward the headers, we want to know about all headers
# to make sure they appear correctly in IDEs
Expand All @@ -527,15 +521,17 @@ FUNCTION(KOKKOS_ADD_LIBRARY LIBRARY_NAME)
ENDIF()
ENDFUNCTION()


FUNCTION(KOKKOS_ADD_INTERFACE_LIBRARY NAME)
IF (KOKKOS_HAS_TRILINOS)
TRIBITS_ADD_LIBRARY(${NAME} ${ARGN})
ELSE()
ADD_LIBRARY(${NAME} INTERFACE)
KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME})
ENDIF()
IF (KOKKOS_HAS_TRILINOS)
TRIBITS_ADD_LIBRARY(${NAME} ${ARGN})
ELSE()
ADD_LIBRARY(${NAME} INTERFACE)
KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME})
ENDIF()
ENDFUNCTION()


FUNCTION(KOKKOS_LIB_INCLUDE_DIRECTORIES TARGET)
IF(KOKKOS_HAS_TRILINOS)
#ignore the target, tribits doesn't do anything directly with targets
Expand All @@ -549,13 +545,8 @@ FUNCTION(KOKKOS_LIB_INCLUDE_DIRECTORIES TARGET)
ENDFUNCTION()

FUNCTION(KOKKOS_LIB_COMPILE_OPTIONS TARGET)
IF(KOKKOS_HAS_TRILINOS)
#don't trust tribits to do this correctly
KOKKOS_TARGET_COMPILE_OPTIONS(${TARGET} ${ARGN})
ELSE()
KOKKOS_LIB_TYPE(${TARGET} INCTYPE)
KOKKOS_TARGET_COMPILE_OPTIONS(${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${TARGET} ${INCTYPE} ${ARGN})
ENDIF()
KOKKOS_LIB_TYPE(${TARGET} INCTYPE)
KOKKOS_TARGET_COMPILE_OPTIONS(${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${TARGET} ${INCTYPE} ${ARGN})
ENDFUNCTION()

MACRO(KOKKOS_ADD_TEST_DIRECTORIES)
Expand Down
10 changes: 7 additions & 3 deletions packages/zoltan2/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ IF(Zoltan2_ENABLE_ParMETIS AND NOT TPL_ENABLE_MPI)
"Zoltan2_ENABLE_ParMETIS OFF.")
ENDIF()

IF(Zoltan2_ENABLE_ParMETIS AND NOT HAVE_PARMETIS_VERSION_4_0_3)
MESSAGE(FATAL_ERROR "Zoltan2 requires ParMETIS_version 4.0.3 or later. Upgrade"
" or set TPL_ENABLE_ParMETIS OFF or set Zoltan2_ENABLE_ParMETIS OFF.")
IF(Zoltan2_ENABLE_ParMETIS)
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cmake/Zoltan2CheckParMETISVersion.cmake")
ZOLTAN2_CHECK_PARMETIS_HAS_VERSION_4_0_3(HAVE_PARMETIS_VERSION_4_0_3l)
IF (NOT "${HAVE_PARMETIS_VERSION_4_0_3l}" STREQUAL "1")
MESSAGE(FATAL_ERROR "Zoltan2 requires ParMETIS_version 4.0.3 or later. Upgrade"
" or set TPL_ENABLE_ParMETIS OFF or set Zoltan2_ENABLE_ParMETIS OFF.")
ENDIF()
ENDIF()

IF(Zoltan2_ENABLE_Scotch AND NOT HAVE_SCOTCH_VERSION_6_0_3)
Expand Down
25 changes: 25 additions & 0 deletions packages/zoltan2/core/cmake/Zoltan2CheckParMETISVersion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
include(CheckCSourceCompiles)

FUNCTION(ZOLTAN2_CHECK_PARMETIS_HAS_VERSION_4_0_3 VARNAME)
SET(SOURCE
"
#include <stdio.h>
#include <parmetis.h>
int main()
{
#if PARMETIS_MAJOR_VERSION > 4
return 0;
#elif PARMETIS_MAJOR_VERSION == 4 && PARMETIS_MINOR_VERSION > 0
return 0;
#elif PARMETIS_MAJOR_VERSION == 4 && PARMETIS_MINOR_VERSION == 0 && PARMETIS_SUBMINOR_VERSION >= 3
return 0;
#else
parmetis_version_failure
#endif
}
"
)
SET(CMAKE_REQUIRED_LIBRARIES ParMETIS::all_libs)
CHECK_C_SOURCE_COMPILES("${SOURCE}" ${VARNAME})
ENDFUNCTION()

0 comments on commit 6daa138

Please sign in to comment.