From c5ebcac9fd010d17752bfa5dc2ab206fac41312f Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 5 Aug 2020 14:01:39 -0500 Subject: [PATCH 001/330] feat: add shell script snippet from spack to handle multiple Python versions --- cmake/run-clang-format.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmake/run-clang-format.py b/cmake/run-clang-format.py index ef3fa0f47..2966381de 100755 --- a/cmake/run-clang-format.py +++ b/cmake/run-clang-format.py @@ -1,4 +1,18 @@ -#!/usr/bin/env python +#!/bin/sh + +# This file is bilingual. The following shell code finds our preferred python. +# Following line is a shell no-op, and starts a multi-line Python comment. +# See https://stackoverflow.com/a/47886254 +""":" +# prefer python3, then python, then python2 +for cmd in python3 python python2; do + command -v > /dev/null $cmd && exec $cmd $0 "$@" +done +echo "==> Error: run-clang-format could not find a python interpreter!" >&2 +exit 1 +":""" +# Line above is a shell no-op, and ends a python multi-line comment. +# The code above runs this file with our preferred python interpreter. from __future__ import print_function, unicode_literals From 73cf9b83d6d6d96148d9858fc0db78265b7cb8fb Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 5 Aug 2020 14:40:54 -0500 Subject: [PATCH 002/330] docs: update release notes and contributing instructions --- CONTRIBUTING.md | 3 ++- RELEASE-NOTES.md | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 158ca92e7..90f60f897 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,6 +3,8 @@ We welcome contributions to BLT. To do so please submit a pull request through our BLT github page at https://github.com/LLNL/blt. +Before submitting a pull request, update `RELEASE-NOTES.md` accordingly. + All contributions to BLT must be made under the BSD License. Any questions can be sent to blt-dev@llnl.gov. @@ -27,4 +29,3 @@ Since we want everyone to feel they are getting the proper attribution for their * Martin McFadden, LLNL * Mark Miller, LLNL * David Poliakoff, Sandia National Laboratories - diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 04940d840..89931c15d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -9,6 +9,9 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd +### Fixed +- ClangFormat checks now support multiple Python executable names + ## [Version 0.3.6] - Release date 2020-07-27 ### Changed From f71ebcb7b0d068d4128975708cd89a4b4e42953f Mon Sep 17 00:00:00 2001 From: Cyrus Harrison Date: Wed, 12 Aug 2020 09:20:01 -0700 Subject: [PATCH 003/330] mpi: protect rpath flags (#386) * mpi: protect rpath flags * update rel notes --- RELEASE-NOTES.md | 6 +++++- cmake/thirdparty/SetupMPI.cmake | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 89931c15d..7f7225cc0 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -9,16 +9,20 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd +### Changed +- MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed as single string prefixed by ``SHELL:`` to prevent +de-duplication of flags passed to ``target_link_options``. + ### Fixed - ClangFormat checks now support multiple Python executable names + ## [Version 0.3.6] - Release date 2020-07-27 ### Changed - ``CUDA_TOOLKIT_ROOT_DIR`` is now optional. If it is not specified, FindCUDA.cmake will attempt to set it. - ## [Version 0.3.5] - Release date 2020-07-20 ### Added diff --git a/cmake/thirdparty/SetupMPI.cmake b/cmake/thirdparty/SetupMPI.cmake index c618dc3c2..1cb2cddc1 100644 --- a/cmake/thirdparty/SetupMPI.cmake +++ b/cmake/thirdparty/SetupMPI.cmake @@ -136,6 +136,15 @@ if (BLT_MPI_LINK_FLAGS) set(_mpi_link_flags ${BLT_MPI_LINK_FLAGS}) endif() +# +# We use `LINK_OPTIONS` for CMake 3.13 and beyond. +# To make sure that de-duping doesn't undermine our MPI flags +# use a string with SHELL: prefix +# +if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) + string(REPLACE ";" " " _mpi_link_flags "${_mpi_link_flags}") + set(_mpi_link_flags "SHELL:${_mpi_link_flags}") +endif() # Output all MPI information message(STATUS "BLT MPI Compile Flags: ${_mpi_compile_flags}") From f44e2a1ee561daab0889e85e1e3773b11bea1048 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Thu, 13 Aug 2020 20:13:47 -0400 Subject: [PATCH 004/330] check for possible C++17 support by the CUDA compiler --- cmake/SetupCompilerOptions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/SetupCompilerOptions.cmake b/cmake/SetupCompilerOptions.cmake index 49d92c953..7cf71173a 100644 --- a/cmake/SetupCompilerOptions.cmake +++ b/cmake/SetupCompilerOptions.cmake @@ -265,7 +265,7 @@ if (BLT_CXX_STD) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "XL") message(FATAL_ERROR "XL does not support C++17.") endif() - if (ENABLE_CUDA) + if (ENABLE_CUDA AND (NOT DEFINED CMAKE_CUDA_COMPILE_FEATURES OR (NOT "cuda_std_17" IN_LIST CMAKE_CUDA_COMPILE_FEATURES))) message(FATAL_ERROR "CMake's CUDA_STANDARD does not support C++17.") endif() From c1425c50ca7f7b741e108f5297a7239367970902 Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Mon, 17 Aug 2020 10:42:39 -0700 Subject: [PATCH 005/330] Remove CUDA PIE flag for PGI --- cmake/thirdparty/SetupCUDA.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index 9453ae02d..80388acfe 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -58,7 +58,6 @@ if (CUDA_LINK_WITH_NVCC) set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG "-Xlinker -rpath -Xlinker " CACHE STRING "") endif() - ############################################################ # Basics ############################################################ @@ -121,6 +120,14 @@ else() set(CUDA_HOST_COMPILER ${CMAKE_C_COMPILER}) endif() +# Set PIE options to empty for PGI since it doesn't understand -fPIE This +# option is set in the CUDA toolchain file so must be unset after +# enable_language(CUDA) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") + set(CMAKE_CUDA_COMPILE_OPTIONS_PIE "") +endif() + + set(_cuda_compile_flags " ") if (ENABLE_CLANG_CUDA) set (_cuda_compile_flags -x cuda --cuda-gpu-arch=${BLT_CLANG_CUDA_ARCH} --cuda-path=${CUDA_TOOLKIT_ROOT_DIR}) From ec244f0ff59d844fc6a41a53047ed4f456ec866d Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Mon, 17 Aug 2020 16:27:50 -0700 Subject: [PATCH 006/330] Add host-config for PGI and CUDA --- .../pgi@20.4_nvcc.cmake | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake new file mode 100644 index 000000000..d36f01240 --- /dev/null +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake @@ -0,0 +1,23 @@ +# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) + +#------------------------------------------------------------------------------ +# Example host-config file for using PGI and CUDA +#------------------------------------------------------------------------------ +set (CMAKE_CXX_COMPILER "/usr/tce/packages/pgi/pgi-20.4/bin/pgc++" CACHE PATH "") +set (CMAKE_C_COMPILER "/usr/tce/packages/pgi/pgi-20.4/bin/pgcc" CACHE PATH "") + +set(ENABLE_FORTRAN OFF CACHE BOOL "") +set(ENABLE_MPI OFF CACHE BOOL "") +set(ENABLE_OPENMP OFF CACHE BOOL "") + +set(ENABLE_CUDA ON CACHE BOOL "") + +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.243" CACHE PATH "") +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") +set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "") + +set (_cuda_arch "sm_70") +set (CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-lambda -G" CACHE STRING "" ) From 86a7d6b5ee93d8b7b3233a3e54a4f06f8d8308d3 Mon Sep 17 00:00:00 2001 From: Cyrus Harrison Date: Thu, 20 Aug 2020 11:26:10 -0700 Subject: [PATCH 007/330] =?UTF-8?q?prefix=20several=20BLT=20internal=20var?= =?UTF-8?q?s=20with=20=5F=20to=20avoid=20expanding=20and=20duping=E2=80=A6?= =?UTF-8?q?=20(#391)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * prefix several BLT internal vars with _ to avoid expanding and duping var contents on re-configure * updated docs and rel notes --- RELEASE-NOTES.md | 8 +++--- cmake/BLTMacros.cmake | 52 ++++++++++++++++++------------------ cmake/BLTPrivateMacros.cmake | 40 +++++++++++++-------------- docs/api/target.rst | 27 ++++++++++--------- 4 files changed, 66 insertions(+), 61 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7f7225cc0..2592bcb89 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,12 +10,14 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd ### Changed -- MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed as single string prefixed by ``SHELL:`` to prevent -de-duplication of flags passed to ``target_link_options``. +- MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed + as single string prefixed by ``SHELL:`` to prevent de-duplication of flags + passed to ``target_link_options``. ### Fixed - ClangFormat checks now support multiple Python executable names - +- Prefixed blt_register_library() internal variables with ``_`` to avoid collision + with input parameters. ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 5dc382b36..09368e026 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -321,60 +321,60 @@ macro(blt_register_library) string(TOUPPER ${arg_NAME} uppercase_name) - set(BLT_${uppercase_name}_IS_REGISTERED_LIBRARY TRUE CACHE BOOL "" FORCE) + set(_BLT_${uppercase_name}_IS_REGISTERED_LIBRARY TRUE CACHE BOOL "" FORCE) if( arg_DEPENDS_ON ) - set(BLT_${uppercase_name}_DEPENDS_ON ${arg_DEPENDS_ON} CACHE STRING "" FORCE) - mark_as_advanced(BLT_${uppercase_name}_DEPENDS_ON) + set(_BLT_${uppercase_name}_DEPENDS_ON ${arg_DEPENDS_ON} CACHE STRING "" FORCE) + mark_as_advanced(_BLT_${uppercase_name}_DEPENDS_ON) endif() if( arg_INCLUDES ) - set(BLT_${uppercase_name}_INCLUDES ${arg_INCLUDES} CACHE STRING "" FORCE) - mark_as_advanced(BLT_${uppercase_name}_INCLUDES) + set(_BLT_${uppercase_name}_INCLUDES ${arg_INCLUDES} CACHE STRING "" FORCE) + mark_as_advanced(_BLT_${uppercase_name}_INCLUDES) endif() if( ${arg_OBJECT} ) - set(BLT_${uppercase_name}_IS_OBJECT_LIBRARY TRUE CACHE BOOL "" FORCE) + set(_BLT_${uppercase_name}_IS_OBJECT_LIBRARY TRUE CACHE BOOL "" FORCE) else() - set(BLT_${uppercase_name}_IS_OBJECT_LIBRARY FALSE CACHE BOOL "" FORCE) + set(_BLT_${uppercase_name}_IS_OBJECT_LIBRARY FALSE CACHE BOOL "" FORCE) endif() - mark_as_advanced(BLT_${uppercase_name}_IS_OBJECT_LIBRARY) + mark_as_advanced(_BLT_${uppercase_name}_IS_OBJECT_LIBRARY) if( ${arg_TREAT_INCLUDES_AS_SYSTEM} ) - set(BLT_${uppercase_name}_TREAT_INCLUDES_AS_SYSTEM TRUE CACHE BOOL "" FORCE) + set(_BLT_${uppercase_name}_TREAT_INCLUDES_AS_SYSTEM TRUE CACHE BOOL "" FORCE) else() - set(BLT_${uppercase_name}_TREAT_INCLUDES_AS_SYSTEM FALSE CACHE BOOL "" FORCE) + set(_BLT_${uppercase_name}_TREAT_INCLUDES_AS_SYSTEM FALSE CACHE BOOL "" FORCE) endif() - mark_as_advanced(BLT_${uppercase_name}_TREAT_INCLUDES_AS_SYSTEM) + mark_as_advanced(_BLT_${uppercase_name}_TREAT_INCLUDES_AS_SYSTEM) if( ENABLE_FORTRAN AND arg_FORTRAN_MODULES ) - set(BLT_${uppercase_name}_FORTRAN_MODULES ${arg_INCLUDES} CACHE STRING "" FORCE) - mark_as_advanced(BLT_${uppercase_name}_FORTRAN_MODULES) + set(_BLT_${uppercase_name}_FORTRAN_MODULES ${arg_INCLUDES} CACHE STRING "" FORCE) + mark_as_advanced(_BLT_${uppercase_name}_FORTRAN_MODULES) endif() if( arg_LIBRARIES ) - set(BLT_${uppercase_name}_LIBRARIES ${arg_LIBRARIES} CACHE STRING "" FORCE) + set(_BLT_${uppercase_name}_LIBRARIES ${arg_LIBRARIES} CACHE STRING "" FORCE) else() # This prevents cmake from falling back on adding -l # to the command line for BLT registered libraries which are not # actual CMake targets - set(BLT_${uppercase_name}_LIBRARIES "BLT_NO_LIBRARIES" CACHE STRING "" FORCE) + set(_BLT_${uppercase_name}_LIBRARIES "BLT_NO_LIBRARIES" CACHE STRING "" FORCE) endif() - mark_as_advanced(BLT_${uppercase_name}_LIBRARIES) + mark_as_advanced(_BLT_${uppercase_name}_LIBRARIES) if( arg_COMPILE_FLAGS ) - set(BLT_${uppercase_name}_COMPILE_FLAGS "${arg_COMPILE_FLAGS}" CACHE STRING "" FORCE) - mark_as_advanced(BLT_${uppercase_name}_COMPILE_FLAGS) + set(_BLT_${uppercase_name}_COMPILE_FLAGS "${arg_COMPILE_FLAGS}" CACHE STRING "" FORCE) + mark_as_advanced(_BLT_${uppercase_name}_COMPILE_FLAGS) endif() if( arg_LINK_FLAGS ) - set(BLT_${uppercase_name}_LINK_FLAGS "${arg_LINK_FLAGS}" CACHE STRING "" FORCE) - mark_as_advanced(BLT_${uppercase_name}_LINK_FLAGS) + set(_BLT_${uppercase_name}_LINK_FLAGS "${arg_LINK_FLAGS}" CACHE STRING "" FORCE) + mark_as_advanced(_BLT_${uppercase_name}_LINK_FLAGS) endif() if( arg_DEFINES ) - set(BLT_${uppercase_name}_DEFINES ${arg_DEFINES} CACHE STRING "" FORCE) - mark_as_advanced(BLT_${uppercase_name}_DEFINES) + set(_BLT_${uppercase_name}_DEFINES ${arg_DEFINES} CACHE STRING "" FORCE) + mark_as_advanced(_BLT_${uppercase_name}_DEFINES) endif() endmacro(blt_register_library) @@ -1099,7 +1099,7 @@ macro(blt_print_target_properties) set(_is_blt_registered_target FALSE) string(TOUPPER ${arg_TARGET} _target_upper) - if(BLT_${_target_upper}_IS_REGISTERED_LIBRARY) + if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) set(_is_blt_registered_target TRUE) message (STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a blt_registered target") endif() @@ -1141,11 +1141,11 @@ macro(blt_print_target_properties) unset(_propval) endif() - ## Additionally, output variables generated via blt_register_target of the form "BLT__*" + ## Additionally, output variables generated via blt_register_target of the form "_BLT__*" if(_is_blt_registered_target) - set(_target_prefix "BLT_${_target_upper}_") + set(_target_prefix "_BLT_${_target_upper}_") - ## Filter to get variables of the form BLT__ and print + ## Filter to get variables of the form _BLT__ and print get_cmake_property(_variable_names VARIABLES) foreach (prop ${_variable_names}) if(prop MATCHES "^${_target_prefix}") diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 584872400..6badf07f1 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -271,8 +271,8 @@ macro(blt_setup_target) foreach( dependency ${_expanded_DEPENDS_ON} ) string(TOUPPER ${dependency} uppercase_dependency ) - if ( DEFINED BLT_${uppercase_dependency}_DEPENDS_ON ) - foreach(new_dependency ${BLT_${uppercase_dependency}_DEPENDS_ON}) + if ( DEFINED _BLT_${uppercase_dependency}_DEPENDS_ON ) + foreach(new_dependency ${_BLT_${uppercase_dependency}_DEPENDS_ON}) if (NOT ${new_dependency} IN_LIST _expanded_DEPENDS_ON) list(APPEND _expanded_DEPENDS_ON ${new_dependency}) endif() @@ -285,29 +285,29 @@ macro(blt_setup_target) foreach( dependency ${_expanded_DEPENDS_ON} ) string(TOUPPER ${dependency} uppercase_dependency ) - if ( NOT arg_OBJECT AND BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY ) + if ( NOT arg_OBJECT AND _BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY ) target_sources(${arg_NAME} PRIVATE $) endif() - if ( DEFINED BLT_${uppercase_dependency}_INCLUDES ) - if ( BLT_${uppercase_dependency}_TREAT_INCLUDES_AS_SYSTEM ) + if ( DEFINED _BLT_${uppercase_dependency}_INCLUDES ) + if ( _BLT_${uppercase_dependency}_TREAT_INCLUDES_AS_SYSTEM ) target_include_directories( ${arg_NAME} SYSTEM PUBLIC - ${BLT_${uppercase_dependency}_INCLUDES} ) + ${_BLT_${uppercase_dependency}_INCLUDES} ) else() target_include_directories( ${arg_NAME} PUBLIC - ${BLT_${uppercase_dependency}_INCLUDES} ) + ${_BLT_${uppercase_dependency}_INCLUDES} ) endif() endif() - if ( DEFINED BLT_${uppercase_dependency}_FORTRAN_MODULES ) + if ( DEFINED _BLT_${uppercase_dependency}_FORTRAN_MODULES ) target_include_directories( ${arg_NAME} PUBLIC - ${BLT_${uppercase_dependency}_FORTRAN_MODULES} ) + ${_BLT_${uppercase_dependency}_FORTRAN_MODULES} ) endif() if ( arg_OBJECT ) # Object libraries need to inherit info from their CMake targets listed # in their LIBRARIES - foreach( _library ${BLT_${uppercase_dependency}_LIBRARIES} ) + foreach( _library ${_BLT_${uppercase_dependency}_LIBRARIES} ) if(TARGET ${_library}) blt_inherit_target_info(TO ${arg_NAME} FROM ${_library} @@ -316,7 +316,7 @@ macro(blt_setup_target) endforeach() endif() - if ( arg_OBJECT OR BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY ) + if ( arg_OBJECT OR _BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY ) # We want object libraries to inherit the vital info but not call # target_link_libraries() otherwise you have to install the object # files associated with the object library which noone wants. @@ -325,32 +325,32 @@ macro(blt_setup_target) FROM ${dependency} OBJECT ${arg_OBJECT}) endif() - elseif (DEFINED BLT_${uppercase_dependency}_LIBRARIES) + elseif (DEFINED _BLT_${uppercase_dependency}_LIBRARIES) # This prevents cmake from adding -l to the # command line for BLT registered libraries which are not # actual CMake targets - if(NOT "${BLT_${uppercase_dependency}_LIBRARIES}" + if(NOT "${_BLT_${uppercase_dependency}_LIBRARIES}" STREQUAL "BLT_NO_LIBRARIES" ) target_link_libraries( ${arg_NAME} PUBLIC - ${BLT_${uppercase_dependency}_LIBRARIES} ) + ${_BLT_${uppercase_dependency}_LIBRARIES} ) endif() else() target_link_libraries( ${arg_NAME} PUBLIC ${dependency} ) endif() - if ( DEFINED BLT_${uppercase_dependency}_DEFINES ) + if ( DEFINED _BLT_${uppercase_dependency}_DEFINES ) target_compile_definitions( ${arg_NAME} PUBLIC - ${BLT_${uppercase_dependency}_DEFINES} ) + ${_BLT_${uppercase_dependency}_DEFINES} ) endif() - if ( DEFINED BLT_${uppercase_dependency}_COMPILE_FLAGS ) + if ( DEFINED _BLT_${uppercase_dependency}_COMPILE_FLAGS ) blt_add_target_compile_flags(TO ${arg_NAME} - FLAGS ${BLT_${uppercase_dependency}_COMPILE_FLAGS} ) + FLAGS ${_BLT_${uppercase_dependency}_COMPILE_FLAGS} ) endif() - if ( NOT arg_OBJECT AND DEFINED BLT_${uppercase_dependency}_LINK_FLAGS ) + if ( NOT arg_OBJECT AND DEFINED _BLT_${uppercase_dependency}_LINK_FLAGS ) blt_add_target_link_flags(TO ${arg_NAME} - FLAGS ${BLT_${uppercase_dependency}_LINK_FLAGS} ) + FLAGS ${_BLT_${uppercase_dependency}_LINK_FLAGS} ) endif() endforeach() diff --git a/docs/api/target.rst b/docs/api/target.rst index 075fcfad8..35d89e0b6 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -188,7 +188,7 @@ Normal libraries are libraries that have sources that are compiled and linked in library and have headers that go along with them (unless it's a Fortran library). Header-only libraries are useful when you do not want the library separately compiled or -are using C++ templates that require the library's user to instatiate them. These libraries +are using C++ templates that require the library's user to instantiate them. These libraries have headers but no sources. To create a header-only library (CMake calls them INTERFACE libraries), simply list all headers under the HEADER argument and do not specify SOURCES (because there aren't any). @@ -262,7 +262,7 @@ This macro assists with building up the correct command line. It will prepend the RUNTIME_OUTPUT_DIRECTORY target property to the executable. If NUM_MPI_TASKS is given or ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC is set, the macro -will appropiately use MPIEXEC, MPIEXEC_NUMPROC_FLAG, and BLT_MPI_COMMAND_APPEND +will appropriately use MPIEXEC, MPIEXEC_NUMPROC_FLAG, and BLT_MPI_COMMAND_APPEND to create the MPI run line. MPIEXEC and MPIEXEC_NUMPROC_FLAG are filled in by CMake's FindMPI.cmake but can @@ -329,13 +329,16 @@ Note: The OBJECT parameter is for internal BLT support for object libraries and is not for users. Object libraries are created using blt_add_library(). Internally created variables (NAME = "foo"): - | BLT_FOO_IS_REGISTERED_LIBRARY - | BLT_FOO_IS_OBJECT_LIBRARY - | BLT_FOO_DEPENDS_ON - | BLT_FOO_INCLUDES - | BLT_FOO_TREAT_INCLUDES_AS_SYSTEM - | BLT_FOO_FORTRAN_MODULES - | BLT_FOO_LIBRARIES - | BLT_FOO_COMPILE_FLAGS - | BLT_FOO_LINK_FLAGS - | BLT_FOO_DEFINES + | _BLT_FOO_IS_REGISTERED_LIBRARY + | _BLT_FOO_IS_OBJECT_LIBRARY + | _BLT_FOO_DEPENDS_ON + | _BLT_FOO_INCLUDES + | _BLT_FOO_TREAT_INCLUDES_AS_SYSTEM + | _BLT_FOO_FORTRAN_MODULES + | _BLT_FOO_LIBRARIES + | _BLT_FOO_COMPILE_FLAGS + | _BLT_FOO_LINK_FLAGS + | _BLT_FOO_DEFINES + +Internal variable names are prefixed with ``_`` to avoid collision with input parameters. + From e3819e622d168730aec32bf64f1888be3eb6eff2 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 25 Aug 2020 20:52:28 -0700 Subject: [PATCH 008/330] Add new blueos c++17 host-config, Remove BGQ host-config, Guard system includes on PGI compilers, Add ability to exclude CUDA implicit link dirs --- RELEASE-NOTES.md | 8 +++ cmake/BLTMacros.cmake | 3 +- cmake/thirdparty/SetupCUDA.cmake | 25 +++++-- docs/tutorial/calc_pi/CMakeLists.txt | 4 -- .../llnl/bgqos_0/clang@4.0.0_xlf.cmake | 51 -------------- .../clang@upstream_nvcc_c++17.cmake | 68 +++++++++++++++++++ .../pgi@20.4_nvcc.cmake | 2 + tests/internal/CMakeLists.txt | 2 +- .../googlemock/CMakeLists.txt | 16 ++--- .../googletest/CMakeLists.txt | 16 ++--- ...020-08-25-turn-off-exported-includes.patch | 54 +++++++++++++++ 11 files changed, 170 insertions(+), 79 deletions(-) delete mode 100644 host-configs/llnl/bgqos_0/clang@4.0.0_xlf.cmake create mode 100644 host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake create mode 100644 thirdparty_builtin/patches/gtest-2020-08-25-turn-off-exported-includes.patch diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 2592bcb89..45666ecb9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -9,6 +9,11 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd +## Added +- Added variable to allow removing of implicit link directories added to CUDA executables + BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE. See the following example host-config: + host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake + ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed as single string prefixed by ``SHELL:`` to prevent de-duplication of flags @@ -18,6 +23,9 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - ClangFormat checks now support multiple Python executable names - Prefixed blt_register_library() internal variables with ``_`` to avoid collision with input parameters. +- Turn off system includes for registered libraries when using the PGI compiler +- Removed unneeded INTERFACE system includes added by googletest that was causing problems + PGI builds (BLT was adding them already to the register library calls) ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 09368e026..e8960b92e 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -340,7 +340,8 @@ macro(blt_register_library) endif() mark_as_advanced(_BLT_${uppercase_name}_IS_OBJECT_LIBRARY) - if( ${arg_TREAT_INCLUDES_AS_SYSTEM} ) + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) set(_BLT_${uppercase_name}_TREAT_INCLUDES_AS_SYSTEM TRUE CACHE BOOL "" FORCE) else() set(_BLT_${uppercase_name}_TREAT_INCLUDES_AS_SYSTEM FALSE CACHE BOOL "" FORCE) diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index 80388acfe..ce79afcf0 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -58,6 +58,7 @@ if (CUDA_LINK_WITH_NVCC) set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG "-Xlinker -rpath -Xlinker " CACHE STRING "") endif() + ############################################################ # Basics ############################################################ @@ -111,6 +112,8 @@ message(STATUS "CUDA Compile Flags: ${CMAKE_CUDA_FLAGS}") message(STATUS "CUDA Link Flags: ${CMAKE_CUDA_LINK_FLAGS}") message(STATUS "CUDA Separable Compilation: ${CUDA_SEPARABLE_COMPILATION}") message(STATUS "CUDA Link with NVCC: ${CUDA_LINK_WITH_NVCC}") +message(STATUS "CUDA Implicit Link Libraries: ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES}") +message(STATUS "CUDA Implicit Link Directories: ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") # don't propagate host flags - too easy to break stuff! set (CUDA_PROPAGATE_HOST_FLAGS Off) @@ -140,11 +143,11 @@ endif() # leaving it to the default source file language. # This logic is handled in the blt_add_library/executable # macros -blt_register_library(NAME cuda +blt_register_library(NAME cuda COMPILE_FLAGS ${_cuda_compile_flags} - INCLUDES ${CUDA_INCLUDE_DIRS} - LIBRARIES ${CUDA_LIBRARIES} - LINK_FLAGS "${CMAKE_CUDA_LINK_FLAGS}" + INCLUDES ${CUDA_INCLUDE_DIRS} + LIBRARIES ${CUDA_LIBRARIES} + LINK_FLAGS "${CMAKE_CUDA_LINK_FLAGS}" ) # same as 'cuda' but we don't flag your source files as @@ -153,6 +156,16 @@ blt_register_library(NAME cuda # linking with nvcc. # This logic is handled in the blt_add_library/executable # macros -blt_register_library(NAME cuda_runtime - INCLUDES ${CUDA_INCLUDE_DIRS} +blt_register_library(NAME cuda_runtime + INCLUDES ${CUDA_INCLUDE_DIRS} LIBRARIES ${CUDA_LIBRARIES}) + +# Allow the removal of implicitly found link directories +# Note: This is a very specific fix for working around CMake adding implicit link +# directories returned by the BlueOS compilers to link CUDA executables +# They are added by logic found in the CMake source: Modules/CMakeTestCUDACompiler.cmake +if(BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE) + message(STATUS "Removing implicit CUDA link directories: ${BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}") + list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES ${BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) + message(STATUS "Updated CUDA Implicit Link Directories: ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") +endif() diff --git a/docs/tutorial/calc_pi/CMakeLists.txt b/docs/tutorial/calc_pi/CMakeLists.txt index 5fa6f4a39..0e22dd62b 100644 --- a/docs/tutorial/calc_pi/CMakeLists.txt +++ b/docs/tutorial/calc_pi/CMakeLists.txt @@ -95,8 +95,6 @@ endif() #------------------------------------------------------------------------------ if(CUDA_FOUND) # _blt_tutorial_calcpi_cuda_start - # avoid warnings about sm_20 deprecated - set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_30) blt_add_library( NAME calc_pi_cuda HEADERS calc_pi_cuda.hpp calc_pi_cuda_exports.h @@ -107,8 +105,6 @@ if(CUDA_FOUND) target_compile_definitions(calc_pi_cuda PUBLIC WIN32_SHARED_LIBS) endif() - - blt_add_executable( NAME test_3 SOURCES test_3.cpp DEPENDS_ON calc_pi calc_pi_cuda gtest cuda_runtime) diff --git a/host-configs/llnl/bgqos_0/clang@4.0.0_xlf.cmake b/host-configs/llnl/bgqos_0/clang@4.0.0_xlf.cmake deleted file mode 100644 index 4d24224b1..000000000 --- a/host-configs/llnl/bgqos_0/clang@4.0.0_xlf.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details -# -# SPDX-License-Identifier: (BSD-3-Clause) - -#------------------------------------------------------------------------------ -# Example host-config file for clang C/C++ compiler -# paired with xlf Fortran compiler on LLNL's bgq machine -#------------------------------------------------------------------------------ - -set(CLANG_HOME "/collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable") -set(CMAKE_C_COMPILER "${CLANG_HOME}/llnl/bin/mpiclang" CACHE PATH "") -set(CMAKE_CXX_COMPILER "${CLANG_HOME}/llnl/bin/mpiclang++11" CACHE PATH "") - -# Set Fortran compiler -set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/opt/ibmcmp/xlf/bg/14.1/bin/bgxlf2003" CACHE PATH "") - - -#------------------------------------------------------------------------------ -# Extra options and flags -#------------------------------------------------------------------------------ - -set(ENABLE_DOCS OFF CACHE BOOL "") -set(CMAKE_SKIP_RPATH TRUE CACHE BOOL "") - -# Use clang's libc++ instead of libstdc++ -set(BLT_CXX_FLAGS "-stdlib=libc++" CACHE STRING "") -set(gtest_defines "-DGTEST_HAS_CXXABI_H_=0" CACHE STRING "") - -# Converts C-style comments to Fortran style in preprocessed files -set(BLT_FORTRAN_FLAGS "-WF,-C!" CACHE STRING "") - - -#------------------------------------------------------------------------------ -# MPI Support -# Note: On BGQ, CMake uses the wrong linker flags when using FindMPI. -# Disable FindMPI to use LLNL wrapper scripts via CMake compiler variables. -#------------------------------------------------------------------------------ - -set(ENABLE_MPI ON CACHE BOOL "") -set(ENABLE_FIND_MPI OFF CACHE BOOL "") - -# Pass in an explicit path to help find mpif.h -set(MPI_Fortran_INCLUDE_PATH "/usr/local/tools/deg/drivers/V1R2M0/ppc64/comm/gcc/include" CACHE PATH "") - -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") - -# Ensures that tests will be wrapped with srun to run on the backend nodes -set(ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC TRUE CACHE BOOL "Run tests on backend nodes") diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake new file mode 100644 index 000000000..24758923c --- /dev/null +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake @@ -0,0 +1,68 @@ +# Copyright (c) 2020, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) + +#------------------------------------------------------------------------------ +# Example host-config file for the blue_os cluster at LLNL, specifically Lassen +#------------------------------------------------------------------------------ +# +# This file provides CMake with paths / details for: +# C/C++: Clang with GCC 8.3.1 toolchain +# Cuda +# MPI +# +#------------------------------------------------------------------------------ + +#--------------------------------------- +# Compilers +#--------------------------------------- + +set(_CLANG_VER "clang-upstream-2019.08.15") +set(_CLANG_DIR "/usr/tce/packages/clang/${_CLANG_VER}") +set(_GCC_DIR "/usr/tce/packages/gcc/gcc-8.3.1") + +set(CMAKE_C_COMPILER "${_CLANG_DIR}/bin/clang" CACHE PATH "") +set(CMAKE_CXX_COMPILER "${_CLANG_DIR}/bin/clang++" CACHE PATH "") + +set(BLT_CXX_STD "c++17" CACHE STRING "") + +set(CMAKE_C_FLAGS "--gcc-toolchain=${_GCC_DIR}" CACHE PATH "") +set(CMAKE_CXX_FLAGS "--gcc-toolchain=${_GCC_DIR}" CACHE PATH "") + +set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,${_GCC_DIR}/lib" CACHE PATH "Adds a missing libstdc++ rpath") + +#--------------------------------------- +# MPI +#--------------------------------------- +set(ENABLE_MPI OFF CACHE BOOL "") + +set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VER}") + +set(MPI_C_COMPILER "${_MPI_BASE_DIR}/bin/mpicc" CACHE PATH "") +set(MPI_CXX_COMPILER "${_MPI_BASE_DIR}/bin/mpicxx" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Cuda +#------------------------------------------------------------------------------ + +set(ENABLE_CUDA ON CACHE BOOL "") + +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-11.0.182" CACHE PATH "") + +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") +set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "") + +set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") +set(_cuda_arch "sm_${CMAKE_CUDA_ARCHITECTURES}") +set(CMAKE_CUDA_FLAGS "-Xcompiler=--gcc-toolchain=${_GCC_DIR} -restrict -arch ${_cuda_arch} -std=c++17 --expt-extended-lambda -G" CACHE STRING "") + +set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "" ) + +# nvcc does not like gtest's 'pthreads' flag +set(gtest_disable_pthreads ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") + +# Very specific fix for working around CMake adding implicit link directories returned by the BlueOS +# compilers to link CUDA executables +set(BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE "/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/powerpc64le-unknown-linux-gnu/4.9.3;/usr/tce/packages/gcc/gcc-4.9.3/lib64" CACHE STRING "") diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake index d36f01240..2179cdffb 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake @@ -19,5 +19,7 @@ set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.243" CACHE PATH "") set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "") +set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "" ) + set (_cuda_arch "sm_70") set (CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-lambda -G" CACHE STRING "" ) diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 321e8362c..3c3c984bc 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -255,7 +255,7 @@ endif() message(STATUS "Exercising blt_print_target_properties macro on some targets and non-targets.") message(STATUS "") -foreach(_target gtest example t_example_smoke not-a-target blt_header_only mpi) +foreach(_target gtest example t_example_smoke not-a-target blt_header_only mpi cuda cuda_runtime) blt_print_target_properties(TARGET ${_target}) endforeach() diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt index d32b70b5b..3409d3044 100644 --- a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt +++ b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt @@ -106,14 +106,14 @@ endif() # If the CMake version supports it, attach header directory information # to the targets for when we are part of a parent build (ie being pulled # in via add_subdirectory() rather than being a standalone build). -if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gmock SYSTEM INTERFACE - "$" - "$/${CMAKE_INSTALL_INCLUDEDIR}>") - target_include_directories(gmock_main SYSTEM INTERFACE - "$" - "$/${CMAKE_INSTALL_INCLUDEDIR}>") -endif() +#if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") +# target_include_directories(gmock SYSTEM INTERFACE +# "$" +# "$/${CMAKE_INSTALL_INCLUDEDIR}>") +# target_include_directories(gmock_main SYSTEM INTERFACE +# "$" +# "$/${CMAKE_INSTALL_INCLUDEDIR}>") +#endif() ######################################################################## # diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt index 4fd7b5262..b67c13a2d 100644 --- a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt +++ b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt @@ -130,14 +130,14 @@ cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc) # If the CMake version supports it, attach header directory information # to the targets for when we are part of a parent build (ie being pulled # in via add_subdirectory() rather than being a standalone build). -if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gtest SYSTEM INTERFACE - "$" - "$/${CMAKE_INSTALL_INCLUDEDIR}>") - target_include_directories(gtest_main SYSTEM INTERFACE - "$" - "$/${CMAKE_INSTALL_INCLUDEDIR}>") -endif() +#if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") +# target_include_directories(gtest SYSTEM INTERFACE +# "$" +# "$/${CMAKE_INSTALL_INCLUDEDIR}>") +# target_include_directories(gtest_main SYSTEM INTERFACE +# "$" +# "$/${CMAKE_INSTALL_INCLUDEDIR}>") +#endif() target_link_libraries(gtest_main PUBLIC gtest) ######################################################################## diff --git a/thirdparty_builtin/patches/gtest-2020-08-25-turn-off-exported-includes.patch b/thirdparty_builtin/patches/gtest-2020-08-25-turn-off-exported-includes.patch new file mode 100644 index 000000000..476161011 --- /dev/null +++ b/thirdparty_builtin/patches/gtest-2020-08-25-turn-off-exported-includes.patch @@ -0,0 +1,54 @@ +diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt +index d32b70b..3409d30 100644 +--- a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt ++++ b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt +@@ -106,14 +106,14 @@ endif() + # If the CMake version supports it, attach header directory information + # to the targets for when we are part of a parent build (ie being pulled + # in via add_subdirectory() rather than being a standalone build). +-if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") +- target_include_directories(gmock SYSTEM INTERFACE +- "$" +- "$/${CMAKE_INSTALL_INCLUDEDIR}>") +- target_include_directories(gmock_main SYSTEM INTERFACE +- "$" +- "$/${CMAKE_INSTALL_INCLUDEDIR}>") +-endif() ++#if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") ++# target_include_directories(gmock SYSTEM INTERFACE ++# "$" ++# "$/${CMAKE_INSTALL_INCLUDEDIR}>") ++# target_include_directories(gmock_main SYSTEM INTERFACE ++# "$" ++# "$/${CMAKE_INSTALL_INCLUDEDIR}>") ++#endif() + + ######################################################################## + # +diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt +index 4fd7b52..b67c13a 100644 +--- a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt ++++ b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt +@@ -130,14 +130,14 @@ cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc) + # If the CMake version supports it, attach header directory information + # to the targets for when we are part of a parent build (ie being pulled + # in via add_subdirectory() rather than being a standalone build). +-if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") +- target_include_directories(gtest SYSTEM INTERFACE +- "$" +- "$/${CMAKE_INSTALL_INCLUDEDIR}>") +- target_include_directories(gtest_main SYSTEM INTERFACE +- "$" +- "$/${CMAKE_INSTALL_INCLUDEDIR}>") +-endif() ++#if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") ++# target_include_directories(gtest SYSTEM INTERFACE ++# "$" ++# "$/${CMAKE_INSTALL_INCLUDEDIR}>") ++# target_include_directories(gtest_main SYSTEM INTERFACE ++# "$" ++# "$/${CMAKE_INSTALL_INCLUDEDIR}>") ++#endif() + target_link_libraries(gtest_main PUBLIC gtest) + + ######################################################################## From edd89a8b7793e80471706413623cc4a294f87049 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 25 Aug 2020 20:58:07 -0700 Subject: [PATCH 009/330] Guard test that requires separable compilation --- ...ang@upstream_nvcc_c++17_no_separable.cmake | 66 +++++++++++++++++++ tests/internal/CMakeLists.txt | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake new file mode 100644 index 000000000..c37dbb35d --- /dev/null +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake @@ -0,0 +1,66 @@ +# Copyright (c) 2020, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) + +#------------------------------------------------------------------------------ +# Example host-config file for the blue_os cluster at LLNL, specifically Lassen +#------------------------------------------------------------------------------ +# +# This file provides CMake with paths / details for: +# C/C++: Clang with GCC 8.3.1 toolchain +# Cuda +# MPI +# +#------------------------------------------------------------------------------ + +#--------------------------------------- +# Compilers +#--------------------------------------- + +set(_CLANG_VER "clang-upstream-2019.08.15") +set(_CLANG_DIR "/usr/tce/packages/clang/${_CLANG_VER}") +set(_GCC_DIR "/usr/tce/packages/gcc/gcc-8.3.1") + +set(CMAKE_C_COMPILER "${_CLANG_DIR}/bin/clang" CACHE PATH "") +set(CMAKE_CXX_COMPILER "${_CLANG_DIR}/bin/clang++" CACHE PATH "") + +set(BLT_CXX_STD "c++17" CACHE STRING "") + +set(CMAKE_C_FLAGS "--gcc-toolchain=${_GCC_DIR}" CACHE PATH "") +set(CMAKE_CXX_FLAGS "--gcc-toolchain=${_GCC_DIR}" CACHE PATH "") + +set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,${_GCC_DIR}/lib" CACHE PATH "Adds a missing libstdc++ rpath") + +#--------------------------------------- +# MPI +#--------------------------------------- +set(ENABLE_MPI OFF CACHE BOOL "") + +set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VER}") + +set(MPI_C_COMPILER "${_MPI_BASE_DIR}/bin/mpicc" CACHE PATH "") +set(MPI_CXX_COMPILER "${_MPI_BASE_DIR}/bin/mpicxx" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Cuda +#------------------------------------------------------------------------------ + +set(ENABLE_CUDA ON CACHE BOOL "") + +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-11.0.182" CACHE PATH "") + +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") +set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "") + +set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") +set(_cuda_arch "sm_${CMAKE_CUDA_ARCHITECTURES}") +set(CMAKE_CUDA_FLAGS "-Xcompiler=--gcc-toolchain=${_GCC_DIR} -restrict -arch ${_cuda_arch} -std=c++17 --expt-extended-lambda -G" CACHE STRING "") + +# nvcc does not like gtest's 'pthreads' flag +set(gtest_disable_pthreads ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") + +# Very specific fix for working around CMake adding implicit link directories returned by the BlueOS +# compilers to link CUDA executables +set(BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE "/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/powerpc64le-unknown-linux-gnu/4.9.3;/usr/tce/packages/gcc/gcc-4.9.3/lib64" CACHE STRING "") diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 3c3c984bc..321f4caeb 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -159,7 +159,7 @@ if(ENABLE_GTEST) #------------------------------------------------------ # CUDA tests #------------------------------------------------------ - if (ENABLE_CUDA) + if (ENABLE_CUDA AND CUDA_SEPARABLE_COMPILATION) add_subdirectory(src/test_cuda_device_call_from_kernel) endif() From 3167cc8945fed3c92050da6f28dd6dd44991ae82 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 25 Aug 2020 21:11:20 -0700 Subject: [PATCH 010/330] Turn back on mpi --- .../llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake | 2 +- .../clang@upstream_nvcc_c++17_no_separable.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake index 24758923c..c30785580 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake @@ -35,7 +35,7 @@ set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,${_GCC_DIR}/lib" CACHE PATH "Adds a missin #--------------------------------------- # MPI #--------------------------------------- -set(ENABLE_MPI OFF CACHE BOOL "") +set(ENABLE_MPI ON CACHE BOOL "") set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VER}") diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake index c37dbb35d..219d98408 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake @@ -35,7 +35,7 @@ set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,${_GCC_DIR}/lib" CACHE PATH "Adds a missin #--------------------------------------- # MPI #--------------------------------------- -set(ENABLE_MPI OFF CACHE BOOL "") +set(ENABLE_MPI ON CACHE BOOL "") set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VER}") From c3d117a65103dd270cbf18be7307b4f78f7ab293 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 26 Aug 2020 09:55:36 -0700 Subject: [PATCH 011/330] Fixing history --- ...ang@upstream_nvcc_c++17_no_separable.cmake | 66 ------------------- 1 file changed, 66 deletions(-) delete mode 100644 host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake deleted file mode 100644 index 219d98408..000000000 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (c) 2020, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details -# -# SPDX-License-Identifier: (BSD-3-Clause) - -#------------------------------------------------------------------------------ -# Example host-config file for the blue_os cluster at LLNL, specifically Lassen -#------------------------------------------------------------------------------ -# -# This file provides CMake with paths / details for: -# C/C++: Clang with GCC 8.3.1 toolchain -# Cuda -# MPI -# -#------------------------------------------------------------------------------ - -#--------------------------------------- -# Compilers -#--------------------------------------- - -set(_CLANG_VER "clang-upstream-2019.08.15") -set(_CLANG_DIR "/usr/tce/packages/clang/${_CLANG_VER}") -set(_GCC_DIR "/usr/tce/packages/gcc/gcc-8.3.1") - -set(CMAKE_C_COMPILER "${_CLANG_DIR}/bin/clang" CACHE PATH "") -set(CMAKE_CXX_COMPILER "${_CLANG_DIR}/bin/clang++" CACHE PATH "") - -set(BLT_CXX_STD "c++17" CACHE STRING "") - -set(CMAKE_C_FLAGS "--gcc-toolchain=${_GCC_DIR}" CACHE PATH "") -set(CMAKE_CXX_FLAGS "--gcc-toolchain=${_GCC_DIR}" CACHE PATH "") - -set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,${_GCC_DIR}/lib" CACHE PATH "Adds a missing libstdc++ rpath") - -#--------------------------------------- -# MPI -#--------------------------------------- -set(ENABLE_MPI ON CACHE BOOL "") - -set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VER}") - -set(MPI_C_COMPILER "${_MPI_BASE_DIR}/bin/mpicc" CACHE PATH "") -set(MPI_CXX_COMPILER "${_MPI_BASE_DIR}/bin/mpicxx" CACHE PATH "") - -#------------------------------------------------------------------------------ -# Cuda -#------------------------------------------------------------------------------ - -set(ENABLE_CUDA ON CACHE BOOL "") - -set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-11.0.182" CACHE PATH "") - -set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") -set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "") - -set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") -set(_cuda_arch "sm_${CMAKE_CUDA_ARCHITECTURES}") -set(CMAKE_CUDA_FLAGS "-Xcompiler=--gcc-toolchain=${_GCC_DIR} -restrict -arch ${_cuda_arch} -std=c++17 --expt-extended-lambda -G" CACHE STRING "") - -# nvcc does not like gtest's 'pthreads' flag -set(gtest_disable_pthreads ON CACHE BOOL "") -set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") - -# Very specific fix for working around CMake adding implicit link directories returned by the BlueOS -# compilers to link CUDA executables -set(BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE "/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/powerpc64le-unknown-linux-gnu/4.9.3;/usr/tce/packages/gcc/gcc-4.9.3/lib64" CACHE STRING "") From 812fafbb497bcddf68cfb905d9183bcd8617c8d2 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 25 Aug 2020 10:39:51 -0500 Subject: [PATCH 012/330] add hostconfig generated from evaleev PR --- .../clang@upstream_gfortran.cmake | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake new file mode 100644 index 000000000..694cadcfe --- /dev/null +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake @@ -0,0 +1,52 @@ +# Copyright (c) 2020, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) + +#------------------------------------------------------------------------------ +# Example host-config file for the blue_os cluster at LLNL, specifically Lassen +#------------------------------------------------------------------------------ +# +# This file provides CMake with paths / details for: +# C/C++: Clang with GCC 8.3.1 toolchain +# Fortran: GFortran +# Cuda +# MPI +# +#------------------------------------------------------------------------------ + +#--------------------------------------- +# Compilers +#--------------------------------------- +set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang" CACHE PATH "") + +set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang++" CACHE PATH "") + +set(CMAKE_C_FLAGS "--gcc-toolchain=/usr/tce/packages/gcc/gcc-8.3.1" CACHE PATH "") + +set(CMAKE_CXX_FLAGS "--gcc-toolchain=/usr/tce/packages/gcc/gcc-8.3.1" CACHE PATH "") + +set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,/usr/tce/packages/gcc/gcc-8.3.1/lib" CACHE PATH "Adds a missing libstdc++ rpath") + +#------------------------------------------------------------------------------ +# Cuda +#------------------------------------------------------------------------------ + +set(ENABLE_CUDA ON CACHE BOOL "") + +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-11.0.182" CACHE PATH "") + +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") + +set(CMAKE_CUDA_FLAGS "-arch sm_70 --gcc-toolchain=/usr/tce/packages/gcc/gcc-8.3.1" CACHE STRING "") + +set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") + +#--------------------------------------- +# MPI +#--------------------------------------- +set(ENABLE_MPI "ON" CACHE PATH "") + +set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2020.01.09-clang-ibm-2019.10.03/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2020.01.09-clang-ibm-2019.10.03/bin/mpicxx" CACHE PATH "") From 004a31ef796695e68d6d293a202a57f0daa897e6 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 25 Aug 2020 10:41:56 -0500 Subject: [PATCH 013/330] add specification of CXX standard that would otherwise be in CMakeLists --- .../llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake index 694cadcfe..04aa7cf4c 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake @@ -22,6 +22,8 @@ set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clan set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang++" CACHE PATH "") +set(BLT_CXX_STD "c++17" CACHE STRING "") + set(CMAKE_C_FLAGS "--gcc-toolchain=/usr/tce/packages/gcc/gcc-8.3.1" CACHE PATH "") set(CMAKE_CXX_FLAGS "--gcc-toolchain=/usr/tce/packages/gcc/gcc-8.3.1" CACHE PATH "") From 441dbabf0b85f345dda16567945e8f5979c1a8bf Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 26 Aug 2020 10:02:34 -0700 Subject: [PATCH 014/330] Standardize host-config --- .../clang@upstream_gfortran.cmake | 54 --------------- ...ang@upstream_nvcc_c++17_no_separable.cmake | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 54 deletions(-) delete mode 100644 host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake create mode 100644 host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake deleted file mode 100644 index 04aa7cf4c..000000000 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_gfortran.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2020, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details -# -# SPDX-License-Identifier: (BSD-3-Clause) - -#------------------------------------------------------------------------------ -# Example host-config file for the blue_os cluster at LLNL, specifically Lassen -#------------------------------------------------------------------------------ -# -# This file provides CMake with paths / details for: -# C/C++: Clang with GCC 8.3.1 toolchain -# Fortran: GFortran -# Cuda -# MPI -# -#------------------------------------------------------------------------------ - -#--------------------------------------- -# Compilers -#--------------------------------------- -set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang" CACHE PATH "") - -set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang++" CACHE PATH "") - -set(BLT_CXX_STD "c++17" CACHE STRING "") - -set(CMAKE_C_FLAGS "--gcc-toolchain=/usr/tce/packages/gcc/gcc-8.3.1" CACHE PATH "") - -set(CMAKE_CXX_FLAGS "--gcc-toolchain=/usr/tce/packages/gcc/gcc-8.3.1" CACHE PATH "") - -set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,/usr/tce/packages/gcc/gcc-8.3.1/lib" CACHE PATH "Adds a missing libstdc++ rpath") - -#------------------------------------------------------------------------------ -# Cuda -#------------------------------------------------------------------------------ - -set(ENABLE_CUDA ON CACHE BOOL "") - -set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-11.0.182" CACHE PATH "") - -set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") - -set(CMAKE_CUDA_FLAGS "-arch sm_70 --gcc-toolchain=/usr/tce/packages/gcc/gcc-8.3.1" CACHE STRING "") - -set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") - -#--------------------------------------- -# MPI -#--------------------------------------- -set(ENABLE_MPI "ON" CACHE PATH "") - -set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2020.01.09-clang-ibm-2019.10.03/bin/mpicc" CACHE PATH "") - -set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2020.01.09-clang-ibm-2019.10.03/bin/mpicxx" CACHE PATH "") diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake new file mode 100644 index 000000000..c6f94d049 --- /dev/null +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake @@ -0,0 +1,66 @@ +# Copyright (c) 2020, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) + +#------------------------------------------------------------------------------ +# Example host-config file for the blue_os cluster at LLNL +#------------------------------------------------------------------------------ +# +# This file provides CMake with paths / details for: +# C/C++: Clang with GCC 8.3.1 toolchain with C++17 support +# Cuda +# MPI +# +#------------------------------------------------------------------------------ + +#--------------------------------------- +# Compilers +#--------------------------------------- + +set(_CLANG_VER "clang-upstream-2019.08.15") +set(_CLANG_DIR "/usr/tce/packages/clang/${_CLANG_VER}") +set(_GCC_DIR "/usr/tce/packages/gcc/gcc-8.3.1") + +set(CMAKE_C_COMPILER "${_CLANG_DIR}/bin/clang" CACHE PATH "") +set(CMAKE_CXX_COMPILER "${_CLANG_DIR}/bin/clang++" CACHE PATH "") + +set(BLT_CXX_STD "c++17" CACHE STRING "") + +set(CMAKE_C_FLAGS "--gcc-toolchain=${_GCC_DIR}" CACHE PATH "") +set(CMAKE_CXX_FLAGS "--gcc-toolchain=${_GCC_DIR}" CACHE PATH "") + +set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,${_GCC_DIR}/lib" CACHE PATH "Adds a missing libstdc++ rpath") + +#--------------------------------------- +# MPI +#--------------------------------------- +set(ENABLE_MPI ON CACHE BOOL "") + +set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VER}") + +set(MPI_C_COMPILER "${_MPI_BASE_DIR}/bin/mpicc" CACHE PATH "") +set(MPI_CXX_COMPILER "${_MPI_BASE_DIR}/bin/mpicxx" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Cuda +#------------------------------------------------------------------------------ + +set(ENABLE_CUDA ON CACHE BOOL "") + +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-11.0.182" CACHE PATH "") + +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") +set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "") + +set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") +set(_cuda_arch "sm_${CMAKE_CUDA_ARCHITECTURES}") +set(CMAKE_CUDA_FLAGS "-Xcompiler=--gcc-toolchain=${_GCC_DIR} -restrict -arch ${_cuda_arch} -std=c++17 --expt-extended-lambda -G" CACHE STRING "") + +# nvcc does not like gtest's 'pthreads' flag +set(gtest_disable_pthreads ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") + +# Very specific fix for working around CMake adding implicit link directories returned by the BlueOS +# compilers to link CUDA executables +set(BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE "/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/powerpc64le-unknown-linux-gnu/4.9.3;/usr/tce/packages/gcc/gcc-4.9.3/lib64" CACHE STRING "") From 5bf4ee4c2a6ae476e87296fcd6aa0877e91e2531 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 26 Aug 2020 10:02:45 -0700 Subject: [PATCH 015/330] Clarify comments --- RELEASE-NOTES.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 45666ecb9..dd196511a 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,8 +10,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd ## Added -- Added variable to allow removing of implicit link directories added to CUDA executables - BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE. See the following example host-config: +- Added variable BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE to allow removing + implicit link directories added to CUDA executables by CMake. See the following example host-config: host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake ### Changed @@ -25,7 +25,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ with input parameters. - Turn off system includes for registered libraries when using the PGI compiler - Removed unneeded INTERFACE system includes added by googletest that was causing problems - PGI builds (BLT was adding them already to the register library calls) + in PGI builds (BLT was adding them already to the register library calls) ## [Version 0.3.6] - Release date 2020-07-27 From b5815b07a98e797f560ea250c2aa86269b8c23a1 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 26 Aug 2020 10:24:58 -0700 Subject: [PATCH 016/330] update mailmap --- .mailmap | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.mailmap b/.mailmap index 5be06a215..bf5068254 100644 --- a/.mailmap +++ b/.mailmap @@ -1,10 +1,16 @@ -George Zagaris George Zagaris -Kenneth Weiss Kenneth Weiss -Kenneth Weiss Kenny Weiss -Kenneth Weiss Kenny Weiss -Peter B. Robinson robinson96 -Peter B. Robinson robinspb -Randolph R. Settgast Randolph R. Settgast -Randolph R. Settgast Randolph Settgast -Randolph R. Settgast Randolph Settgast - +Alfredo Metere Alfredo Metere +Alfredo Metere metere1llnl <51676123+metere1llnl@users.noreply.github.com> +Benjamin Curtice Corbett Ben Corbett <32752943+corbett5@users.noreply.github.com> +Burl M. Hall BurlMHall <47543546+BurlMHall@users.noreply.github.com> +George Zagaris George Zagaris +Jason Burmark Jason Burmark +Kenneth Weiss Kenny Weiss +Kenneth Weiss Kenny Weiss +Kenneth Weiss Kenneth Weiss +Marty McFadden Marty McFadden +Peter B. Robinson robinson96 +Peter B. Robinson robinspb +Randolph R. Settgast Randolph Settgast +Randolph R. Settgast Randolph R. Settgast +Randolph R. Settgast Randolph Settgast +Johann Dahm Johann Dahm From 3f8891611705874987b84c05ef5786f1af130737 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 3 Sep 2020 14:18:27 -0500 Subject: [PATCH 017/330] feat: initial addition of clang-tidy --- cmake/BLTOptions.cmake | 2 +- cmake/SetupCodeChecks.cmake | 91 ++++++- cmake/run-clang-tidy.py | 350 +++++++++++++++++++++++++ cmake/thirdparty/SetupThirdParty.cmake | 5 +- 4 files changed, 445 insertions(+), 3 deletions(-) create mode 100755 cmake/run-clang-tidy.py diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index 465059153..18cdd9dc4 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -28,6 +28,7 @@ option(ENABLE_SPHINX "Enables Sphinx support" ON) # Quality option(ENABLE_CLANGQUERY "Enables Clang-query support" ON) +option(ENABLE_CLANGTIDY "Enables clang-tidy support" ON) option(ENABLE_CPPCHECK "Enables Cppcheck support" ON) option(ENABLE_VALGRIND "Enables Valgrind support" ON) @@ -142,4 +143,3 @@ mark_as_advanced( BLT_CODE_STYLE_TARGET_NAME BLT_DOCS_TARGET_NAME BLT_RUN_BENCHMARKS_TARGET_NAME ) - diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 4e47c4dc7..deee80e6e 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -55,11 +55,23 @@ if(CLANGQUERY_FOUND) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} clang_query_check) endif() +if(CLANGTIDY_FOUND) + # note: interactive_clang_tidy_check + # is for the use of code developers who + # want to check specific attributes of + # specific targets, and does not make + # sense as a dependency of check + add_custom_target(clang_tidy_check) + add_custom_target(interactive_clang-tidy_check) + add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} clang_tidy_check) +endif() + # Code check targets should only be run on demand foreach(target check uncrustify_check astyle_check clangformat_check cppcheck_check style uncrustify_style astyle_style clangformat_style - clang_query_check interactive_clang_query_check) + clang_query_check interactive_clang_query_check + clang_tidy_check interactive_clang_tidy_check) if(TARGET ${target}) set_property(TARGET ${target} PROPERTY EXCLUDE_FROM_ALL TRUE) set_property(TARGET ${target} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) @@ -203,6 +215,14 @@ macro(blt_add_code_checks) SRC_FILES ${_c_sources}) endif() + if (CLANGTIDY_FOUND) + set(_clang_tidy_target_name ${arg_PREFIX}_clang_tidy_check) + blt_error_if_target_exists(${_clang_tidy_target_name} ${_error_msg}) + blt_add_clang_tidy_target( NAME ${_clang_tidy_target_name} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + SRC_FILES ${_c_sources}) + endif() + endmacro(blt_add_code_checks) ##----------------------------------------------------------------------------- @@ -279,6 +299,75 @@ macro(blt_add_clang_query_target) endif() endmacro(blt_add_clang_query_target) +##----------------------------------------------------------------------------- +## blt_add_clang_tidy_target( NAME +## WORKING_DIRECTORY +## COMMENT +## CHECKS +## SRC_FILES [FILE1 [FILE2 ...]] ) +## +## Creates a new target with the given NAME for running clang=tidy over the given SRC_FILES +##----------------------------------------------------------------------------- +macro(blt_add_clang_tidy_target) + if(CLANGTIDY_FOUND) + + ## parse the arguments to the macro + set(options) + set(singleValueArgs NAME COMMENT WORKING_DIRECTORY) + set(multiValueArgs SRC_FILES CHECKS) + + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # Check required parameters + if(NOT DEFINED arg_NAME) + message(FATAL_ERROR "blt_add_clang_tidy_target requires a NAME parameter") + endif() + + if(NOT DEFINED arg_SRC_FILES) + message(FATAL_ERROR "blt_add_clang_tidy_target requires a SRC_FILES parameter") + endif() + + if(DEFINED arg_WORKING_DIRECTORY) + set(_wd ${arg_WORKING_DIRECTORY}) + else() + set(_wd ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + set(interactive_tidy_target_name interactive_tidy_${arg_NAME}) + set(CLANG_TIDY_HELPER_SCRIPT ${BLT_ROOT_DIR}/cmake/run-clang-tidy.py) + set(CLANG_TIDY_HELPER_COMMAND ${CLANG_TIDY_HELPER_SCRIPT} -clang-tidy-binary=${CLANGTIDY_EXECUTABLE} -p ${CMAKE_BINARY_DIR}) + + if(DEFINED arg_CHECKS) + STRING(REGEX REPLACE " " ":" CHECK_ARG_STRING ${arg_CHECKS}) + add_custom_target(${arg_NAME} + COMMAND ${CLANG_TIDY_HELPER_COMMAND} -checks=${CHECK_ARG_STRING} ${arg_SRC_FILES} + WORKING_DIRECTORY ${_wd} + COMMENT "${arg_COMMENT}Running specified clang-tidy source code static analysis checks.") + else() #DEFINED CHECKERS + add_custom_target(${arg_NAME} + COMMAND ${CLANG_TIDY_HELPER_COMMAND} -checks=* ${arg_SRC_FILES} + WORKING_DIRECTORY ${_wd} + COMMENT "${arg_COMMENT}Running default clang-tidy source code static analysis checks.") + endif() + + add_custom_target(${interactive_tidy_target_name} + COMMAND ${CLANG_TIDY_HELPER_COMMAND} -i ${arg_SRC_FILES} + WORKING_DIRECTORY ${_wd} + COMMENT "${arg_COMMENT}Running clang-tidy source code static analysis checks.") + + # hook our new target into the proper dependency chain + add_dependencies(clang_tidy_check ${arg_NAME}) + add_dependencies(interactive_clang-tidy_check ${interactive_tidy_target_name}) + + # Code check targets should only be run on demand + set_property(TARGET ${interactive_tidy_target_name} PROPERTY EXCLUDE_FROM_ALL TRUE) + set_property(TARGET ${interactive_tidy_target_name} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) + set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_ALL TRUE) + set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) + endif() +endmacro(blt_add_clang_tidy_target) + ##----------------------------------------------------------------------------- ## blt_add_cppcheck_target( NAME diff --git a/cmake/run-clang-tidy.py b/cmake/run-clang-tidy.py new file mode 100755 index 000000000..1d4fc544f --- /dev/null +++ b/cmake/run-clang-tidy.py @@ -0,0 +1,350 @@ +#!/bin/sh + +# This file is bilingual. The following shell code finds our preferred python. +# Following line is a shell no-op, and starts a multi-line Python comment. +# See https://stackoverflow.com/a/47886254 +""":" +# prefer python3, then python, then python2 +for cmd in python3 python python2; do + command -v > /dev/null $cmd && exec $cmd $0 "$@" +done +echo "==> Error: run-clang-format could not find a python interpreter!" >&2 +exit 1 +":""" +# Line above is a shell no-op, and ends a python multi-line comment. +# The code above runs this file with our preferred python interpreter. + +#===- run-clang-tidy.py - Parallel clang-tidy runner --------*- python -*--===# +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===-----------------------------------------------------------------------===# +# FIXME: Integrate with clang-tidy-diff.py + +from __future__ import print_function + +""" +Parallel clang-tidy runner +========================== + +Runs clang-tidy over all files in a compilation database. Requires clang-tidy +and clang-apply-replacements in $PATH. + +Example invocations. +- Run clang-tidy on all files in the current working directory with a default + set of checks and show warnings in the cpp files and all project headers. + run-clang-tidy.py $PWD + +- Fix all header guards. + run-clang-tidy.py -fix -checks=-*,llvm-header-guard + +- Fix all header guards included from clang-tidy and header guards + for clang-tidy headers. + run-clang-tidy.py -fix -checks=-*,llvm-header-guard extra/clang-tidy \ + -header-filter=extra/clang-tidy + +Compilation database setup: +http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html +""" + +import argparse +import glob +import json +import multiprocessing +import os +import re +import shutil +import subprocess +import sys +import tempfile +import threading +import traceback + +try: + import yaml +except ImportError: + yaml = None + +is_py2 = sys.version[0] == '2' + +if is_py2: + import Queue as queue +else: + import queue as queue + + +def find_compilation_database(path): + """Adjusts the directory until a compilation database is found.""" + result = './' + while not os.path.isfile(os.path.join(result, path)): + if os.path.realpath(result) == '/': + print('Error: could not find compilation database.') + sys.exit(1) + result += '../' + return os.path.realpath(result) + + +def make_absolute(f, directory): + if os.path.isabs(f): + return f + return os.path.normpath(os.path.join(directory, f)) + + +def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path, + header_filter, allow_enabling_alpha_checkers, + extra_arg, extra_arg_before, quiet, config): + """Gets a command line for clang-tidy.""" + start = [clang_tidy_binary] + if allow_enabling_alpha_checkers: + start.append('-allow-enabling-analyzer-alpha-checkers') + if header_filter is not None: + start.append('-header-filter=' + header_filter) + if checks: + start.append('-checks=' + checks) + if tmpdir is not None: + start.append('-export-fixes') + # Get a temporary file. We immediately close the handle so clang-tidy can + # overwrite it. + (handle, name) = tempfile.mkstemp(suffix='.yaml', dir=tmpdir) + os.close(handle) + start.append(name) + for arg in extra_arg: + start.append('-extra-arg=%s' % arg) + for arg in extra_arg_before: + start.append('-extra-arg-before=%s' % arg) + start.append('-p=' + build_path) + if quiet: + start.append('-quiet') + if config: + start.append('-config=' + config) + start.append(f) + return start + + +def merge_replacement_files(tmpdir, mergefile): + """Merge all replacement files in a directory into a single file""" + # The fixes suggested by clang-tidy >= 4.0.0 are given under + # the top level key 'Diagnostics' in the output yaml files + mergekey = "Diagnostics" + merged=[] + for replacefile in glob.iglob(os.path.join(tmpdir, '*.yaml')): + content = yaml.safe_load(open(replacefile, 'r')) + if not content: + continue # Skip empty files. + merged.extend(content.get(mergekey, [])) + + if merged: + # MainSourceFile: The key is required by the definition inside + # include/clang/Tooling/ReplacementsYaml.h, but the value + # is actually never used inside clang-apply-replacements, + # so we set it to '' here. + output = {'MainSourceFile': '', mergekey: merged} + with open(mergefile, 'w') as out: + yaml.safe_dump(output, out) + else: + # Empty the file: + open(mergefile, 'w').close() + + +def check_clang_apply_replacements_binary(args): + """Checks if invoking supplied clang-apply-replacements binary works.""" + try: + subprocess.check_call([args.clang_apply_replacements_binary, '--version']) + except: + print('Unable to run clang-apply-replacements. Is clang-apply-replacements ' + 'binary correctly specified?', file=sys.stderr) + traceback.print_exc() + sys.exit(1) + + +def apply_fixes(args, tmpdir): + """Calls clang-apply-fixes on a given directory.""" + invocation = [args.clang_apply_replacements_binary] + if args.format: + invocation.append('-format') + if args.style: + invocation.append('-style=' + args.style) + invocation.append(tmpdir) + subprocess.call(invocation) + + +def run_tidy(args, tmpdir, build_path, queue, lock, failed_files): + """Takes filenames out of queue and runs clang-tidy on them.""" + while True: + name = queue.get() + invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks, + tmpdir, build_path, args.header_filter, + args.allow_enabling_alpha_checkers, + args.extra_arg, args.extra_arg_before, + args.quiet, args.config) + + proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output, err = proc.communicate() + if proc.returncode != 0: + failed_files.append(name) + with lock: + sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8')) + if len(err) > 0: + sys.stdout.flush() + sys.stderr.write(err.decode('utf-8')) + queue.task_done() + + +def main(): + parser = argparse.ArgumentParser(description='Runs clang-tidy over all files ' + 'in a compilation database. Requires ' + 'clang-tidy and clang-apply-replacements in ' + '$PATH.') + parser.add_argument('-allow-enabling-alpha-checkers', + action='store_true', help='allow alpha checkers from ' + 'clang-analyzer.') + parser.add_argument('-clang-tidy-binary', metavar='PATH', + default='clang-tidy', + help='path to clang-tidy binary') + parser.add_argument('-clang-apply-replacements-binary', metavar='PATH', + default='clang-apply-replacements', + help='path to clang-apply-replacements binary') + parser.add_argument('-checks', default=None, + help='checks filter, when not specified, use clang-tidy ' + 'default') + parser.add_argument('-config', default=None, + help='Specifies a configuration in YAML/JSON format: ' + ' -config="{Checks: \'*\', ' + ' CheckOptions: [{key: x, ' + ' value: y}]}" ' + 'When the value is empty, clang-tidy will ' + 'attempt to find a file named .clang-tidy for ' + 'each source file in its parent directories.') + parser.add_argument('-header-filter', default=None, + help='regular expression matching the names of the ' + 'headers to output diagnostics from. Diagnostics from ' + 'the main file of each translation unit are always ' + 'displayed.') + if yaml: + parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes', + help='Create a yaml file to store suggested fixes in, ' + 'which can be applied with clang-apply-replacements.') + parser.add_argument('-j', type=int, default=0, + help='number of tidy instances to be run in parallel.') + parser.add_argument('files', nargs='*', default=['.*'], + help='files to be processed (regex on path)') + parser.add_argument('-fix', action='store_true', help='apply fix-its') + parser.add_argument('-format', action='store_true', help='Reformat code ' + 'after applying fixes') + parser.add_argument('-style', default='file', help='The style of reformat ' + 'code after applying fixes') + parser.add_argument('-p', dest='build_path', + help='Path used to read a compile command database.') + parser.add_argument('-extra-arg', dest='extra_arg', + action='append', default=[], + help='Additional argument to append to the compiler ' + 'command line.') + parser.add_argument('-extra-arg-before', dest='extra_arg_before', + action='append', default=[], + help='Additional argument to prepend to the compiler ' + 'command line.') + parser.add_argument('-quiet', action='store_true', + help='Run clang-tidy in quiet mode') + args = parser.parse_args() + + db_path = 'compile_commands.json' + + if args.build_path is not None: + build_path = args.build_path + else: + # Find our database + build_path = find_compilation_database(db_path) + + try: + invocation = [args.clang_tidy_binary, '-list-checks'] + if args.allow_enabling_alpha_checkers: + invocation.append('-allow-enabling-analyzer-alpha-checkers') + invocation.append('-p=' + build_path) + if args.checks: + invocation.append('-checks=' + args.checks) + invocation.append('-') + if args.quiet: + # Even with -quiet we still want to check if we can call clang-tidy. + with open(os.devnull, 'w') as dev_null: + subprocess.check_call(invocation, stdout=dev_null) + else: + subprocess.check_call(invocation) + except: + print("Unable to run clang-tidy.", file=sys.stderr) + sys.exit(1) + + # Load the database and extract all files. + database = json.load(open(os.path.join(build_path, db_path))) + files = [make_absolute(entry['file'], entry['directory']) + for entry in database] + + max_task = args.j + if max_task == 0: + max_task = multiprocessing.cpu_count() + + tmpdir = None + if args.fix or (yaml and args.export_fixes): + check_clang_apply_replacements_binary(args) + tmpdir = tempfile.mkdtemp() + + # Build up a big regexy filter from all command line arguments. + file_name_re = re.compile('|'.join(args.files)) + + return_code = 0 + try: + # Spin up a bunch of tidy-launching threads. + task_queue = queue.Queue(max_task) + # List of files with a non-zero return code. + failed_files = [] + lock = threading.Lock() + for _ in range(max_task): + t = threading.Thread(target=run_tidy, + args=(args, tmpdir, build_path, task_queue, lock, failed_files)) + t.daemon = True + t.start() + + # Fill the queue with files. + for name in files: + if file_name_re.search(name): + task_queue.put(name) + + # Wait for all threads to be done. + task_queue.join() + if len(failed_files): + return_code = 1 + + except KeyboardInterrupt: + # This is a sad hack. Unfortunately subprocess goes + # bonkers with ctrl-c and we start forking merrily. + print('\nCtrl-C detected, goodbye.') + if tmpdir: + shutil.rmtree(tmpdir) + os.kill(0, 9) + + if yaml and args.export_fixes: + print('Writing fixes to ' + args.export_fixes + ' ...') + try: + merge_replacement_files(tmpdir, args.export_fixes) + except: + print('Error exporting fixes.\n', file=sys.stderr) + traceback.print_exc() + return_code=1 + + if args.fix: + print('Applying fixes ...') + try: + apply_fixes(args, tmpdir) + except: + print('Error applying fixes.\n', file=sys.stderr) + traceback.print_exc() + return_code = 1 + + if tmpdir: + shutil.rmtree(tmpdir) + sys.exit(return_code) + + +if __name__ == '__main__': + main() diff --git a/cmake/thirdparty/SetupThirdParty.cmake b/cmake/thirdparty/SetupThirdParty.cmake index ffc92ad3e..461fd8a03 100644 --- a/cmake/thirdparty/SetupThirdParty.cmake +++ b/cmake/thirdparty/SetupThirdParty.cmake @@ -104,9 +104,12 @@ blt_find_executable(NAME Cppcheck #------------------------------------ -# Static analysis via clang-query +# Static analysis via clang-query and clang-tidy #------------------------------------ if(CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja") blt_find_executable(NAME ClangQuery EXECUTABLES clang-query) + + blt_find_executable(NAME ClangTidy + EXECUTABLES clang-tidy) endif() From 869e92cd4f9a4293b9983188cd03dfdf28733bf1 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 3 Sep 2020 14:49:00 -0500 Subject: [PATCH 018/330] feat: updated examples/hostconfigs to show example usage of clang-tidy --- README.md | 1 + cmake/SetupCodeChecks.cmake | 9 +++++-- .../clang@6.0.0-static-analysis.cmake | 4 ++- tests/internal/CMakeLists.txt | 2 +- .../src/static_analysis/CMakeLists.txt | 6 +++++ .../static_analysis/subtle_error_source.cpp | 25 +++++++++++++++++++ 6 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 tests/internal/src/static_analysis/subtle_error_source.cpp diff --git a/README.md b/README.md index 459c02eab..c4e06c397 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ operating systems and technologies: [Uncrustify](http://uncrustify.sourceforge.net) * Code quality [clang-query](http://clang.llvm.org/docs/LibASTMatchers.html), + [clang-tidy](https://clang.llvm.org/extra/clang-tidy), [Cppcheck](http://cppcheck.sourceforge.net) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index deee80e6e..273661b6a 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -304,6 +304,7 @@ endmacro(blt_add_clang_query_target) ## WORKING_DIRECTORY ## COMMENT ## CHECKS +## FIX ## SRC_FILES [FILE1 [FILE2 ...]] ) ## ## Creates a new target with the given NAME for running clang=tidy over the given SRC_FILES @@ -313,7 +314,7 @@ macro(blt_add_clang_tidy_target) ## parse the arguments to the macro set(options) - set(singleValueArgs NAME COMMENT WORKING_DIRECTORY) + set(singleValueArgs NAME COMMENT WORKING_DIRECTORY FIX) set(multiValueArgs SRC_FILES CHECKS) cmake_parse_arguments(arg @@ -338,6 +339,10 @@ macro(blt_add_clang_tidy_target) set(CLANG_TIDY_HELPER_SCRIPT ${BLT_ROOT_DIR}/cmake/run-clang-tidy.py) set(CLANG_TIDY_HELPER_COMMAND ${CLANG_TIDY_HELPER_SCRIPT} -clang-tidy-binary=${CLANGTIDY_EXECUTABLE} -p ${CMAKE_BINARY_DIR}) + if(arg_FIX) + set(CLANG_TIDY_HELPER_COMMAND ${CLANG_TIDY_HELPER_COMMAND} -fix) + endif() + if(DEFINED arg_CHECKS) STRING(REGEX REPLACE " " ":" CHECK_ARG_STRING ${arg_CHECKS}) add_custom_target(${arg_NAME} @@ -346,7 +351,7 @@ macro(blt_add_clang_tidy_target) COMMENT "${arg_COMMENT}Running specified clang-tidy source code static analysis checks.") else() #DEFINED CHECKERS add_custom_target(${arg_NAME} - COMMAND ${CLANG_TIDY_HELPER_COMMAND} -checks=* ${arg_SRC_FILES} + COMMAND ${CLANG_TIDY_HELPER_COMMAND} ${arg_SRC_FILES} WORKING_DIRECTORY ${_wd} COMMENT "${arg_COMMENT}Running default clang-tidy source code static analysis checks.") endif() diff --git a/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake b/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake index 1e4e0164c..7fa73fbed 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake @@ -42,6 +42,9 @@ set(gtest_defines "-DGTEST_HAS_CXXABI_H_=0" CACHE STRING "") set(ClangQuery_DIR ${CLANG_HOME}/bin) set(ENABLE_CLANGQUERY ON CACHE BOOL "") +set(ClangTidy_DIR ${CLANG_HOME}/bin) +set(ENABLE_CLANGTIDY ON CACHE BOOL "") + #------------------------------------------------------------------------------ # MPI Support #------------------------------------------------------------------------------ @@ -54,4 +57,3 @@ set(MPI_Fortran_COMPILER "${MPI_HOME}/bin/mpifort" CACHE PATH "") set(MPIEXEC "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") - diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 321f4caeb..2acb7cec1 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -261,7 +261,7 @@ endforeach() add_subdirectory(src/object_library_test) -if(ENABLE_CLANGQUERY) +if(ENABLE_CLANGQUERY OR ENABLE_CLANGTIDY) add_subdirectory(src/static_analysis) endif() diff --git a/tests/internal/src/static_analysis/CMakeLists.txt b/tests/internal/src/static_analysis/CMakeLists.txt index fc457bb1b..d9337fbb6 100644 --- a/tests/internal/src/static_analysis/CMakeLists.txt +++ b/tests/internal/src/static_analysis/CMakeLists.txt @@ -18,3 +18,9 @@ blt_add_code_checks(PREFIX all blt_add_clang_query_target(NAME filtered CHECKERS "if-stmt" SRC_FILES well_analyzed_source.cpp) +blt_add_executable( NAME subtle_error + SOURCES subtle_error_source.cpp +) +blt_add_clang_tidy_target(NAME check_for_subtle_error + CHECKS "clang-analyzer-*" + SRC_FILES subtle_error_source.cpp) diff --git a/tests/internal/src/static_analysis/subtle_error_source.cpp b/tests/internal/src/static_analysis/subtle_error_source.cpp new file mode 100644 index 000000000..27a3a9851 --- /dev/null +++ b/tests/internal/src/static_analysis/subtle_error_source.cpp @@ -0,0 +1,25 @@ +// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// other BLT Project Developers. See the top-level COPYRIGHT file for details +// +// SPDX-License-Identifier: (BSD-3-Clause) + +/** + * This file contains a subtle C++ error that results in a runtime crash. + * + * The "subtle_error" target ("make subtle_error") should behave incorrectly when run. + * + * The "check_for_subtle_error" target ("make check_for_subtle_error") + * will run the clang-tidy static analyzer and report the error via stdout. + * + * See https://clang.llvm.org/extra/clang-tidy/checks/list.html + * for the full list of available checks + */ + +#include + +int main() +{ + int array[1] = {5}; + int first_element = array[1]; + std::cout << first_element << "\n"; +} From f04770cb46eed4fd5652a197e4e9f79bc4ca5c1c Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 3 Sep 2020 14:53:26 -0500 Subject: [PATCH 019/330] fix: remove clang-query logic not needed for clang-tidy --- cmake/SetupCodeChecks.cmake | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 273661b6a..31c9b0ea9 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -56,13 +56,7 @@ if(CLANGQUERY_FOUND) endif() if(CLANGTIDY_FOUND) - # note: interactive_clang_tidy_check - # is for the use of code developers who - # want to check specific attributes of - # specific targets, and does not make - # sense as a dependency of check add_custom_target(clang_tidy_check) - add_custom_target(interactive_clang-tidy_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} clang_tidy_check) endif() @@ -70,8 +64,7 @@ endif() foreach(target check uncrustify_check astyle_check clangformat_check cppcheck_check style uncrustify_style astyle_style clangformat_style - clang_query_check interactive_clang_query_check - clang_tidy_check interactive_clang_tidy_check) + clang_query_check interactive_clang_query_check clang_tidy_check) if(TARGET ${target}) set_property(TARGET ${target} PROPERTY EXCLUDE_FROM_ALL TRUE) set_property(TARGET ${target} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) @@ -335,7 +328,6 @@ macro(blt_add_clang_tidy_target) set(_wd ${CMAKE_CURRENT_SOURCE_DIR}) endif() - set(interactive_tidy_target_name interactive_tidy_${arg_NAME}) set(CLANG_TIDY_HELPER_SCRIPT ${BLT_ROOT_DIR}/cmake/run-clang-tidy.py) set(CLANG_TIDY_HELPER_COMMAND ${CLANG_TIDY_HELPER_SCRIPT} -clang-tidy-binary=${CLANGTIDY_EXECUTABLE} -p ${CMAKE_BINARY_DIR}) @@ -356,18 +348,10 @@ macro(blt_add_clang_tidy_target) COMMENT "${arg_COMMENT}Running default clang-tidy source code static analysis checks.") endif() - add_custom_target(${interactive_tidy_target_name} - COMMAND ${CLANG_TIDY_HELPER_COMMAND} -i ${arg_SRC_FILES} - WORKING_DIRECTORY ${_wd} - COMMENT "${arg_COMMENT}Running clang-tidy source code static analysis checks.") - # hook our new target into the proper dependency chain add_dependencies(clang_tidy_check ${arg_NAME}) - add_dependencies(interactive_clang-tidy_check ${interactive_tidy_target_name}) # Code check targets should only be run on demand - set_property(TARGET ${interactive_tidy_target_name} PROPERTY EXCLUDE_FROM_ALL TRUE) - set_property(TARGET ${interactive_tidy_target_name} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_ALL TRUE) set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) endif() From 4f613bedc8769a92c89e20597cc3487e59758205 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 3 Sep 2020 15:04:42 -0500 Subject: [PATCH 020/330] docs: update API docs to include new clang tidy macro --- RELEASE-NOTES.md | 1 + cmake/SetupCodeChecks.cmake | 2 +- docs/api/code_check.rst | 46 ++++++++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index dd196511a..6257e589f 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -13,6 +13,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added variable BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE to allow removing implicit link directories added to CUDA executables by CMake. See the following example host-config: host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake +- Added support for clang-tidy static analysis check ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 31c9b0ea9..1c117cb1c 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -296,7 +296,7 @@ endmacro(blt_add_clang_query_target) ## blt_add_clang_tidy_target( NAME ## WORKING_DIRECTORY ## COMMENT -## CHECKS +## CHECKS ## FIX ## SRC_FILES [FILE1 [FILE2 ...]] ) ## diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index dc9e8867f..75516f184 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -91,8 +91,12 @@ This macro supports the following static analysis tools with their requirements: * CLANGQUERY_EXECUTABLE is defined and found prior to calling this macro +- clang-tidy + + * CLANGTIDY_EXECUTABLE is defined and found prior to calling this macro + These are added as children to the `check` build target and produce child build targets -that follow the pattern `__check`. +that follow the pattern `__check`. blt_add_clang_query_target ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -176,6 +180,46 @@ Cppcheck is a static analysis tool for C/C++ code. More information about Cppcheck can be found `here `_. +blt_add_clang_tidy_target +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + blt_add_clang_tidy_target( NAME + WORKING_DIRECTORY + COMMENT + CHECKS + FIX + SRC_FILES [source1 [source2 ...]] ) + +Creates a new build target for running clang-tidy. + +NAME + Name of created build target + +WORKING_DIRECTORY + Directory in which the clang-tidy command is run. Defaults to where macro is called. + +COMMENT + Comment prepended to the build target output + +CHECKS + list of checks to be run on the selected source files, available checks are listed + `here `_. + +FIX + Applies fixes for checks (a subset of clang-tidy checks specify how they should be resolved) + +SRC_FILES + Source list that clang-tidy will be ran on + +Clang-tidy is a tool used for diagnosing and fixing typical programming errors. It is useful for enforcing +coding standards and rules on your source code. Clang-tidy is documented `here `_. + +CHECKS are the static analysis "rules" to specifically run on the target. +If no checks are specified, clang-tidy will run the default available static analysis checks. + + blt_add_astyle_target ~~~~~~~~~~~~~~~~~~~~~ From 2fc60e1844d3c774cd22bed7040bd64043ba8ce2 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 3 Sep 2020 15:10:51 -0500 Subject: [PATCH 021/330] fix: proper delimiter for clang-tidy check list --- cmake/SetupCodeChecks.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 1c117cb1c..b522ed463 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -336,7 +336,7 @@ macro(blt_add_clang_tidy_target) endif() if(DEFINED arg_CHECKS) - STRING(REGEX REPLACE " " ":" CHECK_ARG_STRING ${arg_CHECKS}) + STRING(REGEX REPLACE " " "," CHECK_ARG_STRING ${arg_CHECKS}) add_custom_target(${arg_NAME} COMMAND ${CLANG_TIDY_HELPER_COMMAND} -checks=${CHECK_ARG_STRING} ${arg_SRC_FILES} WORKING_DIRECTORY ${_wd} From 261d18ca66abf1b8b2e0ed73eef31201d2f78ee5 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 10 Sep 2020 12:30:57 -0500 Subject: [PATCH 022/330] fix: underscore/hyphen typos in documentation --- cmake/SetupCodeChecks.cmake | 2 +- docs/api/code_check.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index b522ed463..2f5628565 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -300,7 +300,7 @@ endmacro(blt_add_clang_query_target) ## FIX ## SRC_FILES [FILE1 [FILE2 ...]] ) ## -## Creates a new target with the given NAME for running clang=tidy over the given SRC_FILES +## Creates a new target with the given NAME for running clang-tidy over the given SRC_FILES ##----------------------------------------------------------------------------- macro(blt_add_clang_tidy_target) if(CLANGTIDY_FOUND) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 75516f184..0bdeea6ef 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -96,7 +96,7 @@ This macro supports the following static analysis tools with their requirements: * CLANGTIDY_EXECUTABLE is defined and found prior to calling this macro These are added as children to the `check` build target and produce child build targets -that follow the pattern `__check`. +that follow the pattern `__check`. blt_add_clang_query_target ~~~~~~~~~~~~~~~~~~~~~~~~~~ From 2523e1c245b9106f3f59dea3504e84603a74d04f Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 21 Sep 2020 11:22:42 -0700 Subject: [PATCH 023/330] Add comment about teams chat channel --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c4e06c397..8f9b54943 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,8 @@ For more information, please check our [user documentation and tutorial](https:/ Questions --------- -Any questions can be sent to blt-dev@llnl.gov. +Any questions can be sent to blt-dev@llnl.gov. If you are an LLNL employee or collaborator, we have an +internal Microsoft Teams Group Chat named "BLT" as well. Authors ------- From 6535b715c00aa8875f36a21465d82e9b1570424f Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 21 Sep 2020 15:09:54 -0700 Subject: [PATCH 024/330] Add ability to change output name of executable --- README.md | 2 +- cmake/BLTMacros.cmake | 22 ++++++++++++++-------- docs/api/target.rst | 23 +++++++++++++++-------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 8f9b54943..12d2d3250 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Questions --------- Any questions can be sent to blt-dev@llnl.gov. If you are an LLNL employee or collaborator, we have an -internal Microsoft Teams Group Chat named "BLT" as well. +internal Microsoft Teams group chat named "BLT" as well. Authors ------- diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index e8960b92e..e444caafb 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -547,20 +547,21 @@ endmacro(blt_add_library) ##------------------------------------------------------------------------------ -## blt_add_executable( NAME -## SOURCES [source1 [source2 ...]] -## INCLUDES [dir1 [dir2 ...]] -## DEFINES [define1 [define2 ...]] -## DEPENDS_ON [dep1 [dep2 ...]] -## OUTPUT_DIR [dir] -## FOLDER [name]) +## blt_add_executable( NAME +## SOURCES [source1 [source2 ...]] +## INCLUDES [dir1 [dir2 ...]] +## DEFINES [define1 [define2 ...]] +## DEPENDS_ON [dep1 [dep2 ...]] +## OUTPUT_DIR [dir] +## OUTPUT_NAME [name] +## FOLDER [name]) ## ## Adds an executable target, called , to be built from the given sources. ##------------------------------------------------------------------------------ macro(blt_add_executable) set(options ) - set(singleValueArgs NAME OUTPUT_DIR FOLDER) + set(singleValueArgs NAME OUTPUT_DIR OUTPUT_NAME FOLDER) set(multiValueArgs SOURCES INCLUDES DEFINES DEPENDS_ON) # Parse the arguments to the macro @@ -620,6 +621,11 @@ macro(blt_add_executable) target_compile_definitions(${arg_NAME} PUBLIC ${arg_DEFINES}) endif() + if ( arg_OUTPUT_NAME ) + set_target_properties(${arg_NAME} PROPERTIES + OUTPUT_NAME ${arg_OUTPUT_NAME} ) + endif() + # when using shared libs on windows, all runtime targets # (dlls and exes) must live in the same dir # so we do not set runtime_output_dir in this case diff --git a/docs/api/target.rst b/docs/api/target.rst index 35d89e0b6..35ff86d2e 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -67,13 +67,14 @@ blt_add_executable .. code-block:: cmake - blt_add_executable( NAME - SOURCES [source1 [source2 ...]] - INCLUDES [dir1 [dir2 ...]] - DEFINES [define1 [define2 ...]] - DEPENDS_ON [dep1 [dep2 ...]] - OUTPUT_DIR [dir] - FOLDER [name]) + blt_add_executable( NAME + SOURCES [source1 [source2 ...]] + INCLUDES [dir1 [dir2 ...]] + DEFINES [define1 [define2 ...]] + DEPENDS_ON [dep1 [dep2 ...]] + OUTPUT_DIR [dir] + OUTPUT_NAME [name] + FOLDER [name]) Adds an executable target to the project. @@ -98,6 +99,9 @@ DEPENDS_ON OUTPUT_DIR Directory that this target will built to, defaults to bin +OUTPUT_NAME + Override built file name of the executable (defaults to ) + FOLDER Name of the IDE folder to ease organization @@ -107,6 +111,9 @@ and adds all inherited information from the list given by DEPENDS_ON. This macro creates a true CMake target that can be altered by other CMake commands like normal, such as `set_target_property()`. +OUTPUT_NAME is useful when multiple CMake targets with the same name need to be +created by different targets. + .. note:: If the first entry in SOURCES is a Fortran source file, the fortran linker is used. (via setting the CMake target property LINKER_LANGUAGE to Fortran ) @@ -161,7 +168,7 @@ DEPENDS_ON depends on OUTPUT_NAME - Override built file name of library (defaults to ) + Override built file name of the library (defaults to ) OUTPUT_DIR Directory that this target will built to From 06ff3ae2767612dbd163a92ce76384671c6eca65 Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 21 Sep 2020 19:54:41 -0700 Subject: [PATCH 025/330] Update release notes --- RELEASE-NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 6257e589f..b2c4aae81 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -14,6 +14,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ implicit link directories added to CUDA executables by CMake. See the following example host-config: host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake - Added support for clang-tidy static analysis check +- Added ability to change the output name of an executable via the OUTPUT_NAME + parameter of blt_add_executable ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed From ae3335a6bb07e9f189603bbaadf61670a5329aab Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Thu, 24 Sep 2020 17:57:55 -0700 Subject: [PATCH 026/330] Make HIP_RUNTIME_INCLUDE_DIRS a CACHE variable so it can be overriden --- cmake/thirdparty/SetupHIP.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index cdc917553..b4729bfad 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -22,7 +22,8 @@ if(${HIP_PLATFORM} STREQUAL "hcc") elseif(${HIP_PLATFORM} STREQUAL "nvcc") set(HIP_RUNTIME_DEFINE "__HIP_PLATFORM_NVCC__") endif() -set(HIP_RUNTIME_INCLUDE_DIRS "${HIP_ROOT_DIR}/include;${HIP_ROOT_DIR}/hcc/include") +set(HIP_RUNTIME_INCLUDE_DIRS "${HIP_ROOT_DIR}/include;${HIP_ROOT_DIR}/hcc/include" CACHE STRING "") +message(STATUS "Using HIP_RUNTIME_INCLUDE_DIRS: ${HIP_RUNTIME_INCLUDE_DIRS}") set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFINE};-Wno-unused-parameter") # set(HIP_RUNTIME_LIBRARIES "${HIP_ROOT_DIR}/hcc/lib") # set(HIP_RUNTIME_LIBRARIES "${HIP_ROOT_DIR}/hcc/lib") From 9d1e6f17297649b28519c4efee4a540e3c16db68 Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Thu, 24 Sep 2020 18:02:09 -0700 Subject: [PATCH 027/330] Remove message --- cmake/thirdparty/SetupHIP.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index b4729bfad..62bd283f9 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -23,7 +23,6 @@ elseif(${HIP_PLATFORM} STREQUAL "nvcc") set(HIP_RUNTIME_DEFINE "__HIP_PLATFORM_NVCC__") endif() set(HIP_RUNTIME_INCLUDE_DIRS "${HIP_ROOT_DIR}/include;${HIP_ROOT_DIR}/hcc/include" CACHE STRING "") -message(STATUS "Using HIP_RUNTIME_INCLUDE_DIRS: ${HIP_RUNTIME_INCLUDE_DIRS}") set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFINE};-Wno-unused-parameter") # set(HIP_RUNTIME_LIBRARIES "${HIP_ROOT_DIR}/hcc/lib") # set(HIP_RUNTIME_LIBRARIES "${HIP_ROOT_DIR}/hcc/lib") From d5ddb45bc2140721863e2872cdf382ea2b2fb6fa Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Thu, 1 Oct 2020 17:06:53 -0700 Subject: [PATCH 028/330] Add BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE variable (#405) This is used to filter the implicit link directories for all enabled languages. --- RELEASE-NOTES.md | 4 ++++ cmake/SetupCompilerOptions.cmake | 19 +++++++++++++++++++ cmake/thirdparty/SetupCUDA.cmake | 12 +----------- .../clang@upstream_nvcc_c++17.cmake | 2 +- ...ang@upstream_nvcc_c++17_no_separable.cmake | 2 +- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index b2c4aae81..befd84ffd 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -16,6 +16,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added support for clang-tidy static analysis check - Added ability to change the output name of an executable via the OUTPUT_NAME parameter of blt_add_executable +- Added variable BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE that will be used to filter + implicit link directories for all languages ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed @@ -29,6 +31,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Turn off system includes for registered libraries when using the PGI compiler - Removed unneeded INTERFACE system includes added by googletest that was causing problems in PGI builds (BLT was adding them already to the register library calls) +- Removed variable BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE, functionality now + provided for all languages using BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE variable ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/SetupCompilerOptions.cmake b/cmake/SetupCompilerOptions.cmake index 7cf71173a..dd4f89dee 100644 --- a/cmake/SetupCompilerOptions.cmake +++ b/cmake/SetupCompilerOptions.cmake @@ -418,3 +418,22 @@ endif() foreach(flagVar ${langFlags} "CMAKE_EXE_LINKER_FLAGS" ) message(STATUS "${flagVar} flags are: ${${flagVar}}") endforeach() + +################################## +# Remove implicit link directories +################################## +if(BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE) + message(STATUS "Removing implicit link directories: ${BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}") + list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES ${BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) + message(STATUS "Updated CXX implicit Link Directories: ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}") + list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_DIRECTORIES ${BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) + message(STATUS "Updated C implicit Link Directories: ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") + if (ENABLE_FORTRAN) + list(REMOVE_ITEM CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES ${BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) + message(STATUS "Updated Fortran implicit Link Directories: ${CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES}") + endif () + if (ENABLE_CUDA) + list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES ${BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) + message(STATUS "Updated CUDA implicit Link Directories: ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") + endif () +endif() diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index ce79afcf0..ca80cda5a 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -158,14 +158,4 @@ blt_register_library(NAME cuda # macros blt_register_library(NAME cuda_runtime INCLUDES ${CUDA_INCLUDE_DIRS} - LIBRARIES ${CUDA_LIBRARIES}) - -# Allow the removal of implicitly found link directories -# Note: This is a very specific fix for working around CMake adding implicit link -# directories returned by the BlueOS compilers to link CUDA executables -# They are added by logic found in the CMake source: Modules/CMakeTestCUDACompiler.cmake -if(BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE) - message(STATUS "Removing implicit CUDA link directories: ${BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}") - list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES ${BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) - message(STATUS "Updated CUDA Implicit Link Directories: ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") -endif() + LIBRARIES ${CUDA_LIBRARIES}) \ No newline at end of file diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake index c30785580..a0567d8ed 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake @@ -65,4 +65,4 @@ set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") # Very specific fix for working around CMake adding implicit link directories returned by the BlueOS # compilers to link CUDA executables -set(BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE "/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/powerpc64le-unknown-linux-gnu/4.9.3;/usr/tce/packages/gcc/gcc-4.9.3/lib64" CACHE STRING "") +set(BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE "/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/powerpc64le-unknown-linux-gnu/4.9.3;/usr/tce/packages/gcc/gcc-4.9.3/lib64" CACHE STRING "") diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake index c6f94d049..1fc18cdeb 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake @@ -63,4 +63,4 @@ set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") # Very specific fix for working around CMake adding implicit link directories returned by the BlueOS # compilers to link CUDA executables -set(BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE "/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/powerpc64le-unknown-linux-gnu/4.9.3;/usr/tce/packages/gcc/gcc-4.9.3/lib64" CACHE STRING "") +set(BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE "/usr/tce/packages/gcc/gcc-4.9.3/lib64/gcc/powerpc64le-unknown-linux-gnu/4.9.3;/usr/tce/packages/gcc/gcc-4.9.3/lib64" CACHE STRING "") From a1f6138d9680d3781514d3705a39c5620a1b49d4 Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Fri, 2 Oct 2020 11:33:58 -0700 Subject: [PATCH 029/330] Only set CMAKE_CXX_EXTENSIONS to Off if undefined (#406) --- cmake/SetupCompilerOptions.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/SetupCompilerOptions.cmake b/cmake/SetupCompilerOptions.cmake index dd4f89dee..2463b0ba1 100644 --- a/cmake/SetupCompilerOptions.cmake +++ b/cmake/SetupCompilerOptions.cmake @@ -236,8 +236,10 @@ endif() ################################ # C++ Standard ################################ - -SET( CMAKE_CXX_EXTENSIONS OFF ) +if (NOT DEFINED CMAKE_CXX_EXTENSIONS) + message(STATUS "Setting CMAKE_CXX_EXTENSIONS to Off") + set( CMAKE_CXX_EXTENSIONS OFF ) +endif () SET( CMAKE_CXX_STANDARD_REQUIRED ON ) set(BLT_CXX_STD "" CACHE STRING "Version of C++ standard") From 338fe21e790cc1bdd17029630c2717a5d50b8081 Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Wed, 7 Oct 2020 15:04:13 -0700 Subject: [PATCH 030/330] Restore gmock/gtest interface includes --- .../googlemock/CMakeLists.txt | 16 ++++++++-------- .../googletest/CMakeLists.txt | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt index 3409d3044..17ca62f5a 100644 --- a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt +++ b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt @@ -106,14 +106,14 @@ endif() # If the CMake version supports it, attach header directory information # to the targets for when we are part of a parent build (ie being pulled # in via add_subdirectory() rather than being a standalone build). -#if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") -# target_include_directories(gmock SYSTEM INTERFACE -# "$" -# "$/${CMAKE_INSTALL_INCLUDEDIR}>") -# target_include_directories(gmock_main SYSTEM INTERFACE -# "$" -# "$/${CMAKE_INSTALL_INCLUDEDIR}>") -#endif() +if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") + target_include_directories(gmock INTERFACE + "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}>") + target_include_directories(gmock_main INTERFACE + "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}>") +endif() ######################################################################## # diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt index b67c13a2d..ae080855c 100644 --- a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt +++ b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt @@ -130,14 +130,14 @@ cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc) # If the CMake version supports it, attach header directory information # to the targets for when we are part of a parent build (ie being pulled # in via add_subdirectory() rather than being a standalone build). -#if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") -# target_include_directories(gtest SYSTEM INTERFACE -# "$" -# "$/${CMAKE_INSTALL_INCLUDEDIR}>") -# target_include_directories(gtest_main SYSTEM INTERFACE -# "$" -# "$/${CMAKE_INSTALL_INCLUDEDIR}>") -#endif() +if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") + target_include_directories(gtest INTERFACE + "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}>") + target_include_directories(gtest_main INTERFACE + "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}>") +endif() target_link_libraries(gtest_main PUBLIC gtest) ######################################################################## From ea3d4f25af312a98a59e06ce5d7c87d8c5d48da7 Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Wed, 7 Oct 2020 15:45:52 -0700 Subject: [PATCH 031/330] Add patch file --- .../gtest-2020-10-07-interface-includes.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 thirdparty_builtin/patches/gtest-2020-10-07-interface-includes.patch diff --git a/thirdparty_builtin/patches/gtest-2020-10-07-interface-includes.patch b/thirdparty_builtin/patches/gtest-2020-10-07-interface-includes.patch new file mode 100644 index 000000000..1c8cd2918 --- /dev/null +++ b/thirdparty_builtin/patches/gtest-2020-10-07-interface-includes.patch @@ -0,0 +1,34 @@ +diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt +index 17ca62f..d32b70b 100644 +--- a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt ++++ b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt +@@ -107,10 +107,10 @@ endif() + # to the targets for when we are part of a parent build (ie being pulled + # in via add_subdirectory() rather than being a standalone build). + if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") +- target_include_directories(gmock INTERFACE ++ target_include_directories(gmock SYSTEM INTERFACE + "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}>") +- target_include_directories(gmock_main INTERFACE ++ target_include_directories(gmock_main SYSTEM INTERFACE + "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}>") + endif() +diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt +index ae08085..4fd7b52 100644 +--- a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt ++++ b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt +@@ -131,10 +131,10 @@ cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc) + # to the targets for when we are part of a parent build (ie being pulled + # in via add_subdirectory() rather than being a standalone build). + if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") +- target_include_directories(gtest INTERFACE ++ target_include_directories(gtest SYSTEM INTERFACE + "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}>") +- target_include_directories(gtest_main INTERFACE ++ target_include_directories(gtest_main SYSTEM INTERFACE + "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}>") + endif() From 9dd120e3d68c587321cbb7304e45ff269ff5605a Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Wed, 7 Oct 2020 16:01:28 -0700 Subject: [PATCH 032/330] Update release notes --- RELEASE-NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index befd84ffd..3b6595aeb 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -29,7 +29,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Prefixed blt_register_library() internal variables with ``_`` to avoid collision with input parameters. - Turn off system includes for registered libraries when using the PGI compiler -- Removed unneeded INTERFACE system includes added by googletest that was causing problems +- Removed unneeded SYSTEM includes added by googletest that was causing problems in PGI builds (BLT was adding them already to the register library calls) - Removed variable BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE, functionality now provided for all languages using BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE variable From daa789462eebdf1f2e6214f12f23a00eef33495e Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 14 Oct 2020 12:48:32 -0700 Subject: [PATCH 033/330] Guard against clang-query turning itself on w/o explicit directories given --- RELEASE-NOTES.md | 4 +++ cmake/SetupCodeChecks.cmake | 64 +++++++++++++++++++++++++++---------- docs/api/code_check.rst | 26 +++++++++++---- 3 files changed, 70 insertions(+), 24 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3b6595aeb..7903eaa62 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -33,6 +33,10 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ in PGI builds (BLT was adding them already to the register library calls) - Removed variable BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE, functionality now provided for all languages using BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE variable +- ClangQuery was being auto-enabled in cases where no checker directories where defined. + This caused a crash. blt_add_clang_query_target learned parameter CHECKER_DIRECTORIES + and blt_add_code_checks learned parameter CLANGQUERY_CHECKER_DIRECTORIES. Both still + respect BLT_CLANGQUERY_CHECKER_DIRECTORIES. ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 2f5628565..e701df2f5 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -78,7 +78,8 @@ endforeach() ## ASTYLE_CFG_FILE ## CLANGFORMAT_CFG_FILE ## UNCRUSTIFY_CFG_FILE -## CPPCHECK_FLAGS ) +## CPPCHECK_FLAGS +## CLANGQUERY_CHECKER_DIRECTORIES [dir1 [dir2]]) ## ## This macro adds all enabled code check targets for the given SOURCES. It ## filters checks based on file extensions. @@ -88,7 +89,7 @@ macro(blt_add_code_checks) set(options ) set(singleValueArgs PREFIX ASTYLE_CFG_FILE CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE) - set(multiValueArgs SOURCES CPPCHECK_FLAGS) + set(multiValueArgs SOURCES CPPCHECK_FLAGS CLANGQUERY_CHECKER_DIRECTORIES) cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -200,31 +201,44 @@ macro(blt_add_code_checks) PREPEND_FLAGS ${arg_CPPCHECK_FLAGS}) endif() - if (CLANGQUERY_FOUND) + # Append possible checker directories and only enable clang-query if at least one is provided + set(_clangquery_checker_directories) + if (DEFINED arg_CLANGQUERY_CHECKER_DIRECTORIES) + list(APPEND _clangquery_checker_directories ${arg_CLANGQUERY_CHECKER_DIRECTORIES}) + endif() + if (DEFINED BLT_CLANG_QUERY_CHECKER_DIRECTORIES) + list(APPEND _clangquery_checker_directories ${BLT_CLANG_QUERY_CHECKER_DIRECTORIES}) + endif() + blt_list_remove_duplicates(TO _clangquery_checker_directories) + list(LENGTH _clangquery_checker_directories _len) + + if (CLANGQUERY_FOUND AND (_len GREATER 0)) set(_clang_query_target_name ${arg_PREFIX}_clang_query_check) blt_error_if_target_exists(${_clang_query_target_name} ${_error_msg}) - blt_add_clang_query_target( NAME ${_clang_query_target_name} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - SRC_FILES ${_c_sources}) + blt_add_clang_query_target( NAME ${_clang_query_target_name} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + SRC_FILES ${_c_sources} + CHECKER_DIRECTORIES ${_clangquery_checker_directories}) endif() if (CLANGTIDY_FOUND) set(_clang_tidy_target_name ${arg_PREFIX}_clang_tidy_check) blt_error_if_target_exists(${_clang_tidy_target_name} ${_error_msg}) blt_add_clang_tidy_target( NAME ${_clang_tidy_target_name} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - SRC_FILES ${_c_sources}) + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + SRC_FILES ${_c_sources}) endif() endmacro(blt_add_code_checks) ##----------------------------------------------------------------------------- -## blt_add_clang_query_target( NAME -## WORKING_DIRECTORY -## COMMENT -## CHECKERS -## DIE_ON_MATCH -## SRC_FILES [FILE1 [FILE2 ...]] ) +## blt_add_clang_query_target( NAME +## WORKING_DIRECTORY +## COMMENT +## CHECKERS +## DIE_ON_MATCH +## SRC_FILES [FILE1 [FILE2 ...]] +## CHECKER_DIRECTORIES [dir1 [dir2]]) ## ## Creates a new target with the given NAME for running clang_query over the given SRC_FILES ##----------------------------------------------------------------------------- @@ -234,7 +248,7 @@ macro(blt_add_clang_query_target) ## parse the arguments to the macro set(options) set(singleValueArgs NAME COMMENT WORKING_DIRECTORY DIE_ON_MATCH) - set(multiValueArgs SRC_FILES CHECKERS) + set(multiValueArgs SRC_FILES CHECKERS CHECKER_DIRECTORIES) cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) @@ -253,10 +267,26 @@ macro(blt_add_clang_query_target) else() set(_wd ${CMAKE_CURRENT_SOURCE_DIR}) endif() - + + # Append possible checker directories and only enable clang-query if at least one is provided + set(_checker_directories) + if (DEFINED arg_CHECKER_DIRECTORIES) + list(APPEND _checker_directories ${arg_CHECKER_DIRECTORIES}) + endif() + if (DEFINED BLT_CLANG_QUERY_CHECKER_DIRECTORIES) + list(APPEND _checker_directories ${BLT_CLANG_QUERY_CHECKER_DIRECTORIES}) + endif() + blt_list_remove_duplicates(TO _checker_directories) + list(LENGTH _checker_directories _len) + + if (_len EQUAL 0) + message(FATAL_ERROR "blt_add_clang_query_target requires either CLANGQUERY_CHECKER_DIRECTORIES parameter" + "or variable BLT_CLANG_QUERY_CHECKER_DIRECTORIES defined.") + endif() + set(interactive_target_name interactive_${arg_NAME}) set(CLANG_QUERY_HELPER_SCRIPT ${BLT_ROOT_DIR}/cmake/clang-query-wrapper.py) - set(CLANG_QUERY_HELPER_COMMAND python ${CLANG_QUERY_HELPER_SCRIPT} --clang-query ${CLANGQUERY_EXECUTABLE} --checker-directories ${BLT_CLANG_QUERY_CHECKER_DIRECTORIES} --compilation-database-path ${CMAKE_BINARY_DIR}) + set(CLANG_QUERY_HELPER_COMMAND python ${CLANG_QUERY_HELPER_SCRIPT} --clang-query ${CLANGQUERY_EXECUTABLE} --checker-directories ${_checker_directories} --compilation-database-path ${CMAKE_BINARY_DIR}) if(arg_DIE_ON_MATCH) set(CLANG_QUERY_HELPER_COMMAND ${CLANG_QUERY_HELPER_COMMAND} --die-on-match) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 0bdeea6ef..958141eb9 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -16,7 +16,8 @@ blt_add_code_checks ASTYLE_CFG_FILE CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE - CPPCHECK_FLAGS ) + CPPCHECK_FLAGS + CLANGQUERY_CHECKER_DIRECTORIES [dir1 [dir2]]) This macro adds all enabled code check targets for the given SOURCES. @@ -39,6 +40,9 @@ UNCRUSTIFY_CFG_FILE CPPCHECK_FLAGS List of flags added to Cppcheck +CLANGQUERY_CHECKER_DIRECTORIES + List of directories where clang-query's checkers are located + The purpose of this macro is to enable all code checks in the default manner. It runs all code checks from the working directory `CMAKE_BINARY_DIR`. If you need more specific functionality you will need to call the individual code check macros yourself. @@ -90,6 +94,7 @@ This macro supports the following static analysis tools with their requirements: - Clang-Query * CLANGQUERY_EXECUTABLE is defined and found prior to calling this macro + * CLANGQUERY_CHECKER_DIRECTORIES parameter given or BLT_CLANGQUERY_CHECKER_DIRECTORIES is defined - clang-tidy @@ -103,12 +108,13 @@ blt_add_clang_query_target .. code-block:: cmake - blt_add_clang_query_target( NAME - WORKING_DIRECTORY - COMMENT - CHECKERS - DIE_ON_MATCH - SRC_FILES [source1 [source2 ...]]) + blt_add_clang_query_target( NAME + WORKING_DIRECTORY + COMMENT + CHECKERS + DIE_ON_MATCH + SRC_FILES [source1 [source2 ...]] + CHECKER_DIRECTORIES [dir1 [dir2]]) Creates a new build target for running clang-query. @@ -130,10 +136,16 @@ DIE_ON_MATCH SRC_FILES Source list that clang-query will be ran on +CHECKER_DIRECTORIES + List of directories where clang-query's checkers are located + Clang-query is a tool used for examining and matching the Clang AST. It is useful for enforcing coding standards and rules on your source code. A good primer on how to use clang-query can be found `here `_. +A list of checker directories is required for clang-query, this can be defined either by +the parameter CHECKER_DIRECTORIES or the variable BLT_CLANGQUERY_CHECKER_DIRECTORIES. + Turning on DIE_ON_MATCH is useful if you're using this in CI to enforce rules about your code. CHECKERS are the static analysis passes to specifically run on the target. The following checker options From 03a11e43818c0a38d91afe4588fe2cc59dcccf4b Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 5 Oct 2020 10:10:49 -0500 Subject: [PATCH 034/330] feat: add user-specified required autoformatter versions --- cmake/SetupCodeChecks.cmake | 36 ++++++++++++++++++++++++++++++++++- docs/api/code_check.rst | 11 +++++++++++ tests/internal/CMakeLists.txt | 3 +++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index e701df2f5..78e5b01d6 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -505,6 +505,15 @@ macro(blt_add_astyle_target) " Current AStyle executable: '${ASTYLE_EXECUTABLE}' " " Current AStyle version is: ${_astyle_version}." ) endif() + + if(BLT_REQD_ASTYLE_VER) + # The user may only specify a part of the version (e.g. just the maj ver) + # so check for substring + string(FIND ${_astyle_version} ${BLT_REQD_ASTYLE_VER} VERSION_MATCHES) + if (VERSION_MATCHES EQUAL -1) + message(FATAL_ERROR "blt_add_astyle_target: astyle ${BLT_REQD_ASTYLE_VER} is required, found ${_astyle_version}") + endif() + endif() endif() if(_generate_target) @@ -582,6 +591,21 @@ macro(blt_add_clangformat_target) set(_wd ${CMAKE_CURRENT_SOURCE_DIR}) endif() + # If a required version was set, check it + if(BLT_REQD_CLANGFORMAT_VER) + execute_process(COMMAND ${CLANGFORMAT_EXECUTABLE} --version + OUTPUT_VARIABLE _version_str + OUTPUT_STRIP_TRAILING_WHITESPACE) + # The version number is the last token - can contain non-numeric + string(REGEX MATCH "([0-9a-zA-Z\\-]+(\\.)?)+$" _clangformat_version ${_version_str}) + # The user may only specify a part of the version (e.g. just the maj ver) + # so check for substring + string(FIND ${_clangformat_version} ${BLT_REQD_CLANGFORMAT_VER} VERSION_MATCHES) + if (VERSION_MATCHES EQUAL -1) + message(FATAL_ERROR "blt_add_clangformat_target: clang-format ${BLT_REQD_CLANGFORMAT_VER} is required, found ${_clangformat_version}") + endif() + endif() + set(_generate_target TRUE) # Copy config file to given working directory since ClangFormat doesn't support pointing to one @@ -684,7 +708,17 @@ macro(blt_add_uncrustify_target) " for style check targets. " " Current uncrustify executable: '${UNCRUSTIFY_EXECUTABLE}' " " Current uncrustify version is: ${_uncrustify_version}." ) - endif() + endif() + + if(BLT_REQD_UNCRUSTIFY_VER) + # The user may only specify a part of the version (e.g. just the maj ver) + # so check for substring + string(FIND ${_uncrustify_version} ${BLT_REQD_UNCRUSTIFY_VER} VERSION_MATCHES) + if (VERSION_MATCHES EQUAL -1) + message(FATAL_ERROR "blt_add_uncrustify_target: uncrustify ${BLT_REQD_UNCRUSTIFY_VER} is required, found ${_uncrustify_version}") + endif() + endif() + endif() endif() if(_generate_target) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 958141eb9..816d38116 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -84,6 +84,17 @@ are out of compliance with your code formatting and a `style` build target that modify your source files. It also creates smaller child build targets that follow the pattern `__`. +If a particular version of a code formatting tool is required, you can configure BLT to enforce +that version by setting ``BLT_REQD__VER`` to as much of the version +as you need. For example: + +.. code-block:: cmake + + # If astyle major version 3 is required (3.0, 3.1, etc are acceptable) + set(BLT_REQD_ASTYLE_VER "3") + # Or, if exactly 3.1 is needed + set(BLT_REQD_ASTYLE_VER "3.1") + This macro supports the following static analysis tools with their requirements: - CppCheck diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 2acb7cec1..785fa9602 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -327,6 +327,9 @@ if(CLANGFORMAT_FOUND) src/test_cuda_device_call_from_kernel/Parent.hpp ) + # Specify the major version for astyle + set(BLT_REQD_ASTYLE_VER "3") + blt_add_code_checks( PREFIX smoke_tests SOURCES ${smoke_tests_srcs} From 0cacfad45675f14024d6b95b7fdd7c1e6d895075 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 5 Oct 2020 10:19:41 -0500 Subject: [PATCH 035/330] organization: initialize reqd versions as options, update changelog --- RELEASE-NOTES.md | 1 + cmake/SetupCodeChecks.cmake | 3 +++ 2 files changed, 4 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7903eaa62..df3e45661 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -18,6 +18,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ parameter of blt_add_executable - Added variable BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE that will be used to filter implicit link directories for all languages +- Added user option for enforcing specific versions of autoformatters ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 78e5b01d6..cd54b402b 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -10,6 +10,7 @@ add_custom_target(${BLT_CODE_CHECK_TARGET_NAME}) add_custom_target(${BLT_CODE_STYLE_TARGET_NAME}) if(ASTYLE_FOUND) + set(BLT_REQD_ASTYLE_VER "" CACHE STRING "Required version of astyle") # targets for verifying formatting add_custom_target(astyle_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} astyle_check) @@ -20,6 +21,7 @@ if(ASTYLE_FOUND) endif() if(CLANGFORMAT_FOUND) + set(BLT_REQD_CLANGFORMAT_VER "" CACHE STRING "Required version of clang-format") # targets for verifying formatting add_custom_target(clangformat_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} clangformat_check) @@ -30,6 +32,7 @@ if(CLANGFORMAT_FOUND) endif() if(UNCRUSTIFY_FOUND) + set(BLT_REQD_UNCRUSTIFY_VER "" CACHE STRING "Required version of uncrustify") # targets for verifying formatting add_custom_target(uncrustify_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} uncrustify_check) From a65572e25d95fe30cd846b0e0788a1dad9c5b390 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 5 Oct 2020 12:52:19 -0500 Subject: [PATCH 036/330] fix: unconditionally check version --- cmake/SetupCodeChecks.cmake | 68 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index cd54b402b..c46ea72b0 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -487,19 +487,27 @@ macro(blt_add_astyle_target) set(_generate_target TRUE) + # Check the version -- output is of the form "Artistic Style Version X.Y.Z" + execute_process( + COMMAND ${ASTYLE_EXECUTABLE} --version + OUTPUT_VARIABLE _version_str + ERROR_VARIABLE _version_str + OUTPUT_STRIP_TRAILING_WHITESPACE ) + string(REGEX MATCH "([0-9]+(\\.)?)+$" _astyle_version ${_version_str}) + + if(BLT_REQD_ASTYLE_VER) + # The user may only specify a part of the version (e.g. just the maj ver) + # so check for substring + string(FIND ${_astyle_version} ${BLT_REQD_ASTYLE_VER} VERSION_MATCHES) + if (VERSION_MATCHES EQUAL -1) + message(FATAL_ERROR "blt_add_astyle_target: astyle ${BLT_REQD_ASTYLE_VER} is required, found ${_astyle_version}") + endif() + endif() + if(${arg_MODIFY_FILES}) set(MODIFY_FILES_FLAG --suffix=none) else() set(MODIFY_FILES_FLAG --dry-run) - - # Check the version -- output is of the form "Artistic Style Version X.Y.Z" - execute_process( - COMMAND ${ASTYLE_EXECUTABLE} --version - OUTPUT_VARIABLE _version_str - ERROR_VARIABLE _version_str - OUTPUT_STRIP_TRAILING_WHITESPACE ) - string(REGEX MATCH "([0-9]+(\\.)?)+$" _astyle_version ${_version_str}) - # Skip 'check' target if version is not high enough if(_astyle_version VERSION_LESS 2.05) set(_generate_target FALSE) @@ -508,15 +516,6 @@ macro(blt_add_astyle_target) " Current AStyle executable: '${ASTYLE_EXECUTABLE}' " " Current AStyle version is: ${_astyle_version}." ) endif() - - if(BLT_REQD_ASTYLE_VER) - # The user may only specify a part of the version (e.g. just the maj ver) - # so check for substring - string(FIND ${_astyle_version} ${BLT_REQD_ASTYLE_VER} VERSION_MATCHES) - if (VERSION_MATCHES EQUAL -1) - message(FATAL_ERROR "blt_add_astyle_target: astyle ${BLT_REQD_ASTYLE_VER} is required, found ${_astyle_version}") - endif() - endif() endif() if(_generate_target) @@ -692,18 +691,27 @@ macro(blt_add_uncrustify_target) set(_generate_target TRUE) + # Check the version -- output is of the form "uncrustify X.Y.Z" + execute_process( + COMMAND ${UNCRUSTIFY_EXECUTABLE} --version + OUTPUT_VARIABLE _version_str + OUTPUT_STRIP_TRAILING_WHITESPACE ) + string(REGEX MATCH "([0-9]+(\\.)?)+(_[a-zA-Z])?" _uncrustify_version ${_version_str}) + + if(BLT_REQD_UNCRUSTIFY_VER) + # The user may only specify a part of the version (e.g. just the maj ver) + # so check for substring + string(FIND ${_uncrustify_version} ${BLT_REQD_UNCRUSTIFY_VER} VERSION_MATCHES) + if (VERSION_MATCHES EQUAL -1) + message(FATAL_ERROR "blt_add_uncrustify_target: uncrustify ${BLT_REQD_UNCRUSTIFY_VER} is required, found ${_uncrustify_version}") + endif() + endif() + if(${arg_MODIFY_FILES}) set(MODIFY_FILES_FLAG --replace;--no-backup) else() set(MODIFY_FILES_FLAG "--check") - # Check the version -- output is of the form "uncrustify X.Y.Z" - execute_process( - COMMAND ${UNCRUSTIFY_EXECUTABLE} --version - OUTPUT_VARIABLE _version_str - OUTPUT_STRIP_TRAILING_WHITESPACE ) - string(REGEX MATCH "([0-9]+(\\.)?)+(_[a-zA-Z])?" _uncrustify_version ${_version_str}) - # Skip 'check' target if version is not high enough if(_uncrustify_version VERSION_LESS 0.61) set(_generate_target FALSE) @@ -712,16 +720,6 @@ macro(blt_add_uncrustify_target) " Current uncrustify executable: '${UNCRUSTIFY_EXECUTABLE}' " " Current uncrustify version is: ${_uncrustify_version}." ) endif() - - if(BLT_REQD_UNCRUSTIFY_VER) - # The user may only specify a part of the version (e.g. just the maj ver) - # so check for substring - string(FIND ${_uncrustify_version} ${BLT_REQD_UNCRUSTIFY_VER} VERSION_MATCHES) - if (VERSION_MATCHES EQUAL -1) - message(FATAL_ERROR "blt_add_uncrustify_target: uncrustify ${BLT_REQD_UNCRUSTIFY_VER} is required, found ${_uncrustify_version}") - endif() - endif() - endif() endif() if(_generate_target) From 21d1e85b00e5561c9812d5cf53534185adaff2db Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 5 Oct 2020 13:59:28 -0500 Subject: [PATCH 037/330] fix: rename options for consistency, check that desired version is at the beginning --- RELEASE-NOTES.md | 3 ++- cmake/SetupCodeChecks.cmake | 30 +++++++++++++++--------------- docs/api/code_check.rst | 6 +++--- tests/internal/CMakeLists.txt | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index df3e45661..aecab0c52 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -18,7 +18,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ parameter of blt_add_executable - Added variable BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE that will be used to filter implicit link directories for all languages -- Added user option for enforcing specific versions of autoformatters +- Added user option for enforcing specific versions of autoformatters - the new options are + ``BLT_REQUIRED_ASTYLE_VER``, ``BLT_REQUIRED_CLANGFORMAT_VER``, and ``BLT_REQUIRED_UNCRUSTIFY_VER`` ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index c46ea72b0..37aadc4f6 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -10,7 +10,7 @@ add_custom_target(${BLT_CODE_CHECK_TARGET_NAME}) add_custom_target(${BLT_CODE_STYLE_TARGET_NAME}) if(ASTYLE_FOUND) - set(BLT_REQD_ASTYLE_VER "" CACHE STRING "Required version of astyle") + set(BLT_REQUIRED_ASTYLE_VER "" CACHE STRING "Required version of astyle") # targets for verifying formatting add_custom_target(astyle_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} astyle_check) @@ -21,7 +21,7 @@ if(ASTYLE_FOUND) endif() if(CLANGFORMAT_FOUND) - set(BLT_REQD_CLANGFORMAT_VER "" CACHE STRING "Required version of clang-format") + set(BLT_REQUIRED_CLANGFORMAT_VER "" CACHE STRING "Required version of clang-format") # targets for verifying formatting add_custom_target(clangformat_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} clangformat_check) @@ -32,7 +32,7 @@ if(CLANGFORMAT_FOUND) endif() if(UNCRUSTIFY_FOUND) - set(BLT_REQD_UNCRUSTIFY_VER "" CACHE STRING "Required version of uncrustify") + set(BLT_REQUIRED_UNCRUSTIFY_VER "" CACHE STRING "Required version of uncrustify") # targets for verifying formatting add_custom_target(uncrustify_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} uncrustify_check) @@ -495,12 +495,12 @@ macro(blt_add_astyle_target) OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX MATCH "([0-9]+(\\.)?)+$" _astyle_version ${_version_str}) - if(BLT_REQD_ASTYLE_VER) + if(BLT_REQUIRED_ASTYLE_VER) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_astyle_version} ${BLT_REQD_ASTYLE_VER} VERSION_MATCHES) - if (VERSION_MATCHES EQUAL -1) - message(FATAL_ERROR "blt_add_astyle_target: astyle ${BLT_REQD_ASTYLE_VER} is required, found ${_astyle_version}") + string(FIND ${_astyle_version} ${BLT_REQUIRED_ASTYLE_VER} VERSION_POS) + if (NOT VERSION_POS EQUAL 0) + message(FATAL_ERROR "blt_add_astyle_target: astyle ${BLT_REQUIRED_ASTYLE_VER} is required, found ${_astyle_version}") endif() endif() @@ -594,7 +594,7 @@ macro(blt_add_clangformat_target) endif() # If a required version was set, check it - if(BLT_REQD_CLANGFORMAT_VER) + if(BLT_REQUIRED_CLANGFORMAT_VER) execute_process(COMMAND ${CLANGFORMAT_EXECUTABLE} --version OUTPUT_VARIABLE _version_str OUTPUT_STRIP_TRAILING_WHITESPACE) @@ -602,9 +602,9 @@ macro(blt_add_clangformat_target) string(REGEX MATCH "([0-9a-zA-Z\\-]+(\\.)?)+$" _clangformat_version ${_version_str}) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_clangformat_version} ${BLT_REQD_CLANGFORMAT_VER} VERSION_MATCHES) - if (VERSION_MATCHES EQUAL -1) - message(FATAL_ERROR "blt_add_clangformat_target: clang-format ${BLT_REQD_CLANGFORMAT_VER} is required, found ${_clangformat_version}") + string(FIND ${_clangformat_version} ${BLT_REQUIRED_CLANGFORMAT_VER} VERSION_POS) + if (NOT VERSION_POS EQUAL 0) + message(FATAL_ERROR "blt_add_clangformat_target: clang-format ${BLT_REQUIRED_CLANGFORMAT_VER} is required, found ${_clangformat_version}") endif() endif() @@ -698,12 +698,12 @@ macro(blt_add_uncrustify_target) OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX MATCH "([0-9]+(\\.)?)+(_[a-zA-Z])?" _uncrustify_version ${_version_str}) - if(BLT_REQD_UNCRUSTIFY_VER) + if(BLT_REQUIRED_UNCRUSTIFY_VER) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_uncrustify_version} ${BLT_REQD_UNCRUSTIFY_VER} VERSION_MATCHES) - if (VERSION_MATCHES EQUAL -1) - message(FATAL_ERROR "blt_add_uncrustify_target: uncrustify ${BLT_REQD_UNCRUSTIFY_VER} is required, found ${_uncrustify_version}") + string(FIND ${_uncrustify_version} ${BLT_REQUIRED_UNCRUSTIFY_VER} VERSION_POS) + if (NOT VERSION_POS EQUAL 0) + message(FATAL_ERROR "blt_add_uncrustify_target: uncrustify ${BLT_REQUIRED_UNCRUSTIFY_VER} is required, found ${_uncrustify_version}") endif() endif() diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 816d38116..4b1f75560 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -85,15 +85,15 @@ modify your source files. It also creates smaller child build targets that foll `__`. If a particular version of a code formatting tool is required, you can configure BLT to enforce -that version by setting ``BLT_REQD__VER`` to as much of the version +that version by setting ``BLT_REQUIRED__VER`` to as much of the version as you need. For example: .. code-block:: cmake # If astyle major version 3 is required (3.0, 3.1, etc are acceptable) - set(BLT_REQD_ASTYLE_VER "3") + set(BLT_REQUIRED_ASTYLE_VER "3") # Or, if exactly 3.1 is needed - set(BLT_REQD_ASTYLE_VER "3.1") + set(BLT_REQUIRED_ASTYLE_VER "3.1") This macro supports the following static analysis tools with their requirements: diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 785fa9602..f75124a1f 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -328,7 +328,7 @@ if(CLANGFORMAT_FOUND) ) # Specify the major version for astyle - set(BLT_REQD_ASTYLE_VER "3") + set(BLT_REQUIRED_ASTYLE_VER "3") blt_add_code_checks( PREFIX smoke_tests From 955053303b3859256726faecd4eebc3316ae8d1b Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 14 Oct 2020 15:17:06 -0700 Subject: [PATCH 038/330] VER to VERSION --- RELEASE-NOTES.md | 2 +- cmake/SetupCodeChecks.cmake | 24 +++++++++---------- docs/api/code_check.rst | 6 ++--- .../clang@upstream_nvcc_c++17.cmake | 6 ++--- ...ang@upstream_nvcc_c++17_no_separable.cmake | 6 ++--- tests/internal/CMakeLists.txt | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index aecab0c52..05e19ea1b 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -19,7 +19,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added variable BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE that will be used to filter implicit link directories for all languages - Added user option for enforcing specific versions of autoformatters - the new options are - ``BLT_REQUIRED_ASTYLE_VER``, ``BLT_REQUIRED_CLANGFORMAT_VER``, and ``BLT_REQUIRED_UNCRUSTIFY_VER`` + ``BLT_REQUIRED_ASTYLE_VERSION``, ``BLT_REQUIRED_CLANGFORMAT_VERSION``, and ``BLT_REQUIRED_UNCRUSTIFY_VERSION`` ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 37aadc4f6..f8348e05d 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -10,7 +10,7 @@ add_custom_target(${BLT_CODE_CHECK_TARGET_NAME}) add_custom_target(${BLT_CODE_STYLE_TARGET_NAME}) if(ASTYLE_FOUND) - set(BLT_REQUIRED_ASTYLE_VER "" CACHE STRING "Required version of astyle") + set(BLT_REQUIRED_ASTYLE_VERSION "" CACHE STRING "Required version of astyle") # targets for verifying formatting add_custom_target(astyle_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} astyle_check) @@ -21,7 +21,7 @@ if(ASTYLE_FOUND) endif() if(CLANGFORMAT_FOUND) - set(BLT_REQUIRED_CLANGFORMAT_VER "" CACHE STRING "Required version of clang-format") + set(BLT_REQUIRED_CLANGFORMAT_VERSION "" CACHE STRING "Required version of clang-format") # targets for verifying formatting add_custom_target(clangformat_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} clangformat_check) @@ -32,7 +32,7 @@ if(CLANGFORMAT_FOUND) endif() if(UNCRUSTIFY_FOUND) - set(BLT_REQUIRED_UNCRUSTIFY_VER "" CACHE STRING "Required version of uncrustify") + set(BLT_REQUIRED_UNCRUSTIFY_VERSION "" CACHE STRING "Required version of uncrustify") # targets for verifying formatting add_custom_target(uncrustify_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} uncrustify_check) @@ -495,12 +495,12 @@ macro(blt_add_astyle_target) OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX MATCH "([0-9]+(\\.)?)+$" _astyle_version ${_version_str}) - if(BLT_REQUIRED_ASTYLE_VER) + if(BLT_REQUIRED_ASTYLE_VERSION) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_astyle_version} ${BLT_REQUIRED_ASTYLE_VER} VERSION_POS) + string(FIND ${_astyle_version} ${BLT_REQUIRED_ASTYLE_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) - message(FATAL_ERROR "blt_add_astyle_target: astyle ${BLT_REQUIRED_ASTYLE_VER} is required, found ${_astyle_version}") + message(FATAL_ERROR "blt_add_astyle_target: astyle ${BLT_REQUIRED_ASTYLE_VERSION} is required, found ${_astyle_version}") endif() endif() @@ -594,7 +594,7 @@ macro(blt_add_clangformat_target) endif() # If a required version was set, check it - if(BLT_REQUIRED_CLANGFORMAT_VER) + if(BLT_REQUIRED_CLANGFORMAT_VERSION) execute_process(COMMAND ${CLANGFORMAT_EXECUTABLE} --version OUTPUT_VARIABLE _version_str OUTPUT_STRIP_TRAILING_WHITESPACE) @@ -602,9 +602,9 @@ macro(blt_add_clangformat_target) string(REGEX MATCH "([0-9a-zA-Z\\-]+(\\.)?)+$" _clangformat_version ${_version_str}) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_clangformat_version} ${BLT_REQUIRED_CLANGFORMAT_VER} VERSION_POS) + string(FIND ${_clangformat_version} ${BLT_REQUIRED_CLANGFORMAT_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) - message(FATAL_ERROR "blt_add_clangformat_target: clang-format ${BLT_REQUIRED_CLANGFORMAT_VER} is required, found ${_clangformat_version}") + message(FATAL_ERROR "blt_add_clangformat_target: clang-format ${BLT_REQUIRED_CLANGFORMAT_VERSION} is required, found ${_clangformat_version}") endif() endif() @@ -698,12 +698,12 @@ macro(blt_add_uncrustify_target) OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX MATCH "([0-9]+(\\.)?)+(_[a-zA-Z])?" _uncrustify_version ${_version_str}) - if(BLT_REQUIRED_UNCRUSTIFY_VER) + if(BLT_REQUIRED_UNCRUSTIFY_VERSION) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_uncrustify_version} ${BLT_REQUIRED_UNCRUSTIFY_VER} VERSION_POS) + string(FIND ${_uncrustify_version} ${BLT_REQUIRED_UNCRUSTIFY_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) - message(FATAL_ERROR "blt_add_uncrustify_target: uncrustify ${BLT_REQUIRED_UNCRUSTIFY_VER} is required, found ${_uncrustify_version}") + message(FATAL_ERROR "blt_add_uncrustify_target: uncrustify ${BLT_REQUIRED_UNCRUSTIFY_VERSION} is required, found ${_uncrustify_version}") endif() endif() diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 4b1f75560..990b61dc0 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -85,15 +85,15 @@ modify your source files. It also creates smaller child build targets that foll `__`. If a particular version of a code formatting tool is required, you can configure BLT to enforce -that version by setting ``BLT_REQUIRED__VER`` to as much of the version +that version by setting ``BLT_REQUIRED__VERSION`` to as much of the version as you need. For example: .. code-block:: cmake # If astyle major version 3 is required (3.0, 3.1, etc are acceptable) - set(BLT_REQUIRED_ASTYLE_VER "3") + set(BLT_REQUIRED_ASTYLE_VERSION "3") # Or, if exactly 3.1 is needed - set(BLT_REQUIRED_ASTYLE_VER "3.1") + set(BLT_REQUIRED_ASTYLE_VERSION "3.1") This macro supports the following static analysis tools with their requirements: diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake index a0567d8ed..3acf91548 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake @@ -18,8 +18,8 @@ # Compilers #--------------------------------------- -set(_CLANG_VER "clang-upstream-2019.08.15") -set(_CLANG_DIR "/usr/tce/packages/clang/${_CLANG_VER}") +set(_CLANG_VERSION "clang-upstream-2019.08.15") +set(_CLANG_DIR "/usr/tce/packages/clang/${_CLANG_VERSION}") set(_GCC_DIR "/usr/tce/packages/gcc/gcc-8.3.1") set(CMAKE_C_COMPILER "${_CLANG_DIR}/bin/clang" CACHE PATH "") @@ -37,7 +37,7 @@ set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,${_GCC_DIR}/lib" CACHE PATH "Adds a missin #--------------------------------------- set(ENABLE_MPI ON CACHE BOOL "") -set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VER}") +set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VERSION}") set(MPI_C_COMPILER "${_MPI_BASE_DIR}/bin/mpicc" CACHE PATH "") set(MPI_CXX_COMPILER "${_MPI_BASE_DIR}/bin/mpicxx" CACHE PATH "") diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake index 1fc18cdeb..a4774cf7a 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake @@ -18,8 +18,8 @@ # Compilers #--------------------------------------- -set(_CLANG_VER "clang-upstream-2019.08.15") -set(_CLANG_DIR "/usr/tce/packages/clang/${_CLANG_VER}") +set(_CLANG_VERSION "clang-upstream-2019.08.15") +set(_CLANG_DIR "/usr/tce/packages/clang/${_CLANG_VERSION}") set(_GCC_DIR "/usr/tce/packages/gcc/gcc-8.3.1") set(CMAKE_C_COMPILER "${_CLANG_DIR}/bin/clang" CACHE PATH "") @@ -37,7 +37,7 @@ set(BLT_EXE_LINKER_FLAGS " -Wl,-rpath,${_GCC_DIR}/lib" CACHE PATH "Adds a missin #--------------------------------------- set(ENABLE_MPI ON CACHE BOOL "") -set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VER}") +set(_MPI_BASE_DIR "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-${_CLANG_VERSION}") set(MPI_C_COMPILER "${_MPI_BASE_DIR}/bin/mpicc" CACHE PATH "") set(MPI_CXX_COMPILER "${_MPI_BASE_DIR}/bin/mpicxx" CACHE PATH "") diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index f75124a1f..971850178 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -328,7 +328,7 @@ if(CLANGFORMAT_FOUND) ) # Specify the major version for astyle - set(BLT_REQUIRED_ASTYLE_VER "3") + set(BLT_REQUIRED_ASTYLE_VERSION "3") blt_add_code_checks( PREFIX smoke_tests From e8cfebb9e3eb27f72db1f92f20756f92b599ac82 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 12:52:09 -0700 Subject: [PATCH 039/330] feat: check for multiple C format cfgs incl clang This commit checks to see if a user has supplied more than one C-style language formatter configuration file in blt_add_code_checks, including CLANGFORMAT_CFG_FILE, which was previously excluded from this check. Prior to this commit, BLT returned a fatal error only if ASTYLE_CFG_FILE and UNCRUSTIFY_CFG_FILE were supplied to blt_add_code_checks. However, invocations supplying one of these arguments plus CLANGFORMAT_CFG_FILE also seem undesirable, and the documentation seems to imply that a check should be done to disallow these combinations as well. Both of these observations motivate the change in this commit. --- RELEASE-NOTES.md | 11 ++++++++--- cmake/SetupCodeChecks.cmake | 23 +++++++++++++++++------ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 05e19ea1b..451350d69 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -39,6 +39,11 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ This caused a crash. blt_add_clang_query_target learned parameter CHECKER_DIRECTORIES and blt_add_code_checks learned parameter CLANGQUERY_CHECKER_DIRECTORIES. Both still respect BLT_CLANGQUERY_CHECKER_DIRECTORIES. +- It is now a fatal error to supply CLANGFORMAT_CFG_FILE plus + ASTYLE_CFG_FILE or UNCRUSTIFY_CFG_FILE arguments to + blt_add_code_checks; previously, these combinations were implied to + be errors in BLT documentation, but BLT would not return an error in + those cases. ## [Version 0.3.6] - Release date 2020-07-27 @@ -50,8 +55,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ### Added - Added blt_assert_exists() utility macro. -- Additional link flags for CUDA may now be specified by setting - ``CMAKE_CUDA_LINK_FLAGS`` when configuring CMake either in a host-config +- Additional link flags for CUDA may now be specified by setting + ``CMAKE_CUDA_LINK_FLAGS`` when configuring CMake either in a host-config or at the command-line. - Added support for ClangFormat. @@ -119,7 +124,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Handle FindMPI variable MPIEXEC changed to MPIEXEC_EXECUTABLE in CMake 3.10+. This now works regardless of which the user defines or what CMake returns. - Handle CMake target property LINK_FLAGS changed to LINK_OPTIONS in CMake 3.13+. - blt_add_target_link_flags() handles this under the covers and converts the + blt_add_target_link_flags() handles this under the covers and converts the users strings to a list (3.13+) or list to a string (<3.13). New property supports generator expressions so thats a plus. - Improved how all BLT MPI information is being merged together and reported to users. diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index f8348e05d..b30070136 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -126,12 +126,23 @@ macro(blt_add_code_checks) C_LIST _c_sources Fortran_LIST _f_sources) - # Check that at most one formatting config file was supplied - if (DEFINED arg_UNCRUSTIFY_CFG_FILE AND DEFINED arg_ASTYLE_CFG_FILE) - message(FATAL_ERROR - "blt_add_code_checks macro does not support multiple " - "style config parameters within the same invocation. " - "Both UNCRUSTIFY_CFG_FILE and ASTYLE_CFG_FILE were supplied.") + # Check that no more than one formatting config file was supplied + # for C-style languages. + set(_c_formatter_cfgs_supplied) + foreach (_c_formatter ASTYLE UNCRUSTIFY CLANGFORMAT) + if (DEFINED arg_${_c_formatter}_CFG_FILE) + list(APPEND _c_formatter_cfgs_supplied ${_c_formatter}_CFG_FILE) + endif() + endforeach() + list(LENGTH _c_formatter_cfgs_supplied _num_c_formatter_cfgs_supplied) + if (_num_c_formatter_cfgs_supplied GREATER 1) + message(FATAL_ERROR + "blt_add_code_checks macro does not support multiple " + "style config parameters within the same invocation. " + "At most one of ASTYLE_CFG_FILE, CLANGFORMAT_CFG_FILE, " + "and UNCRUSTIFY_CFG_FILE may be supplied. " + "The following style config parameters were supplied: " + ${_c_formatter_cfgs_supplied}) endif() # Add code checks From 41fef783aae6c66ab782e8f5d30298c2089d4e7b Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 29 Oct 2020 10:21:07 -0700 Subject: [PATCH 040/330] Guard against emptry strings in version checks and autodetected clang-formats --- cmake/SetupCodeChecks.cmake | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index b30070136..dd68e2259 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -509,9 +509,10 @@ macro(blt_add_astyle_target) if(BLT_REQUIRED_ASTYLE_VERSION) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_astyle_version} ${BLT_REQUIRED_ASTYLE_VERSION} VERSION_POS) + string(FIND "${_astyle_version}" ${BLT_REQUIRED_ASTYLE_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) - message(FATAL_ERROR "blt_add_astyle_target: astyle ${BLT_REQUIRED_ASTYLE_VERSION} is required, found ${_astyle_version}") + set(_generate_target FALSE) + message(WARNING "blt_add_astyle_target: astyle '${BLT_REQUIRED_ASTYLE_VERSION}' is required, found '${_astyle_version}'. Disabling 'style' build target.") endif() endif() @@ -604,6 +605,8 @@ macro(blt_add_clangformat_target) set(_wd ${CMAKE_CURRENT_SOURCE_DIR}) endif() + set(_generate_target TRUE) + # If a required version was set, check it if(BLT_REQUIRED_CLANGFORMAT_VERSION) execute_process(COMMAND ${CLANGFORMAT_EXECUTABLE} --version @@ -613,18 +616,17 @@ macro(blt_add_clangformat_target) string(REGEX MATCH "([0-9a-zA-Z\\-]+(\\.)?)+$" _clangformat_version ${_version_str}) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_clangformat_version} ${BLT_REQUIRED_CLANGFORMAT_VERSION} VERSION_POS) + string(FIND "${_clangformat_version}" ${BLT_REQUIRED_CLANGFORMAT_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) - message(FATAL_ERROR "blt_add_clangformat_target: clang-format ${BLT_REQUIRED_CLANGFORMAT_VERSION} is required, found ${_clangformat_version}") + set(_generate_target FALSE) + message(WARNING "blt_add_clangformat_target: clang-format '${BLT_REQUIRED_CLANGFORMAT_VERSION}'' is required, found '${_clangformat_version}'. Disabling 'style' build target.") endif() endif() - set(_generate_target TRUE) - - # Copy config file to given working directory since ClangFormat doesn't support pointing to one - configure_file(${arg_CFG_FILE} ${arg_WORKING_DIRECTORY}/.clang-format COPYONLY) - if(_generate_target) + # Copy config file to given working directory since ClangFormat doesn't support pointing to one + configure_file(${arg_CFG_FILE} ${arg_WORKING_DIRECTORY}/.clang-format COPYONLY) + # ClangFormat does not support --dry-run until version 10 which isn't on many machines. # For now, use run-clang-format for dry running purposes. if(${arg_MODIFY_FILES}) @@ -712,9 +714,10 @@ macro(blt_add_uncrustify_target) if(BLT_REQUIRED_UNCRUSTIFY_VERSION) # The user may only specify a part of the version (e.g. just the maj ver) # so check for substring - string(FIND ${_uncrustify_version} ${BLT_REQUIRED_UNCRUSTIFY_VERSION} VERSION_POS) + string(FIND "${_uncrustify_version}" ${BLT_REQUIRED_UNCRUSTIFY_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) - message(FATAL_ERROR "blt_add_uncrustify_target: uncrustify ${BLT_REQUIRED_UNCRUSTIFY_VERSION} is required, found ${_uncrustify_version}") + set(_generate_target FALSE) + message(WARNING "blt_add_uncrustify_target: uncrustify '${BLT_REQUIRED_UNCRUSTIFY_VERSION}' is required, found '${_uncrustify_version}'. Disabling 'style' build target.") endif() endif() From 9c977b566b8b513cebe56b9592c323549644dcca Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 29 Oct 2020 11:45:24 -0700 Subject: [PATCH 041/330] Limit warning messages to one --- cmake/SetupCodeChecks.cmake | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index dd68e2259..df4d79632 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -9,6 +9,8 @@ add_custom_target(${BLT_CODE_CHECK_TARGET_NAME}) add_custom_target(${BLT_CODE_STYLE_TARGET_NAME}) +set(_BLT_STYLE_VERSION_WARNING_ISSUED FALSE CACHE BOOL "Limits BLT issuing more than one warning for style version") + if(ASTYLE_FOUND) set(BLT_REQUIRED_ASTYLE_VERSION "" CACHE STRING "Required version of astyle") # targets for verifying formatting @@ -512,7 +514,10 @@ macro(blt_add_astyle_target) string(FIND "${_astyle_version}" ${BLT_REQUIRED_ASTYLE_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) set(_generate_target FALSE) - message(WARNING "blt_add_astyle_target: astyle '${BLT_REQUIRED_ASTYLE_VERSION}' is required, found '${_astyle_version}'. Disabling 'style' build target.") + if(NOT _BLT_STYLE_VERSION_WARNING_ISSUED) + message(WARNING "blt_add_astyle_target: astyle '${BLT_REQUIRED_ASTYLE_VERSION}' is required, found '${_astyle_version}'. Disabling 'style' build target.") + set(_BLT_STYLE_VERSION_WARNING_ISSUED TRUE CACHE BOOL "Limits BLT issuing more than one warning for style version" FORCE) + endif() endif() endif() @@ -619,7 +624,10 @@ macro(blt_add_clangformat_target) string(FIND "${_clangformat_version}" ${BLT_REQUIRED_CLANGFORMAT_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) set(_generate_target FALSE) - message(WARNING "blt_add_clangformat_target: clang-format '${BLT_REQUIRED_CLANGFORMAT_VERSION}'' is required, found '${_clangformat_version}'. Disabling 'style' build target.") + if (NOT _BLT_STYLE_VERSION_WARNING_ISSUED) + message(WARNING "blt_add_clangformat_target: clang-format '${BLT_REQUIRED_CLANGFORMAT_VERSION}'' is required, found '${_clangformat_version}'. Disabling 'style' build target.") + set(_BLT_STYLE_VERSION_WARNING_ISSUED TRUE CACHE BOOL "Limits BLT issuing more than one warning for style version" FORCE) + endif() endif() endif() @@ -717,7 +725,10 @@ macro(blt_add_uncrustify_target) string(FIND "${_uncrustify_version}" ${BLT_REQUIRED_UNCRUSTIFY_VERSION} VERSION_POS) if (NOT VERSION_POS EQUAL 0) set(_generate_target FALSE) - message(WARNING "blt_add_uncrustify_target: uncrustify '${BLT_REQUIRED_UNCRUSTIFY_VERSION}' is required, found '${_uncrustify_version}'. Disabling 'style' build target.") + if (NOT _BLT_STYLE_VERSION_WARNING_ISSUED) + message(WARNING "blt_add_uncrustify_target: uncrustify '${BLT_REQUIRED_UNCRUSTIFY_VERSION}' is required, found '${_uncrustify_version}'. Disabling 'style' build target.") + set(_BLT_STYLE_VERSION_WARNING_ISSUED TRUE CACHE BOOL "Limits BLT issuing more than one warning for style version" FORCE) + endif() endif() endif() From 7833cf99f1777fae91b90617b591597a9f590a0e Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Tue, 27 Oct 2020 17:08:30 -0700 Subject: [PATCH 042/330] feat: yapf: expose ENABLE_YAPF variable This commit adds an ENABLE_YAPF variable intended for eventual use in supporting Python source beautification via [YAPF](https://github.com/google/yapf) -- Yet Another Python Formatter. YAPF was chosen over Autopep8 and Black because YAPF is more configurable than both and Spack uses it. For the purposes of this branch, adding Autopep8 or Black support is considered out of scope. --- cmake/BLTOptions.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index 18cdd9dc4..f414bee5b 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -36,6 +36,7 @@ option(ENABLE_VALGRIND "Enables Valgrind support" ON) option(ENABLE_ASTYLE "Enables AStyle support" ON) option(ENABLE_CLANGFORMAT "Enables ClangFormat support" ON) option(ENABLE_UNCRUSTIFY "Enables Uncrustify support" ON) +option(ENABLE_YAPF "Enables Yapf support" OFF) #------------------------------------------------------------------------------ # Build Options From 46f11d04f6f6d34ef2b3e308d617c8b6526fa1b9 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 10:56:34 -0700 Subject: [PATCH 043/330] feat: yapf: find executable This commit adds code to find the Yapf executable as part of adding Python formatter infrastructure to BLT. --- cmake/thirdparty/SetupThirdParty.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/thirdparty/SetupThirdParty.cmake b/cmake/thirdparty/SetupThirdParty.cmake index 461fd8a03..1280eb6e8 100644 --- a/cmake/thirdparty/SetupThirdParty.cmake +++ b/cmake/thirdparty/SetupThirdParty.cmake @@ -95,6 +95,8 @@ blt_find_executable(NAME ClangFormat blt_find_executable(NAME Uncrustify EXECUTABLES uncrustify) +blt_find_executable(NAME Yapf + EXECUTABLES yapf) #------------------------------------ # Static analysis via Cppcheck From 7e321033fe48cb98ec0e66d156cb5bc8ae0e3387 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 11:21:53 -0700 Subject: [PATCH 044/330] feat: add yapf_style and yapf_check targets This commit adds custom yapf_style and yapf_check targets to BLT's code style and code check targets in preparation for supporting Python code beautification using yapf. --- cmake/SetupCodeChecks.cmake | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index df4d79632..5909c9e1e 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -44,6 +44,17 @@ if(UNCRUSTIFY_FOUND) add_dependencies(${BLT_CODE_STYLE_TARGET_NAME} uncrustify_style) endif() +if(YAPF_FOUND) + set(BLT_REQUIRED_YAPF_VERSION "" CACHE STRING "Required version of yapf") + # targets for verifying formatting + add_custom_target(yapf_check) + add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} yapf_check) + + # targets for modifying formatting + add_custom_target(yapf_style) + add_dependencies(${BLT_CODE_STYLE_TARGET_NAME} yapf_style) +endif() + if(CPPCHECK_FOUND) add_custom_target(cppcheck_check) add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} cppcheck_check) @@ -67,8 +78,8 @@ endif() # Code check targets should only be run on demand foreach(target - check uncrustify_check astyle_check clangformat_check cppcheck_check - style uncrustify_style astyle_style clangformat_style + check yapf_check uncrustify_check astyle_check clangformat_check cppcheck_check + style yapf_style uncrustify_style astyle_style clangformat_style clang_query_check interactive_clang_query_check clang_tidy_check) if(TARGET ${target}) set_property(TARGET ${target} PROPERTY EXCLUDE_FROM_ALL TRUE) From ab90840f76667088f0ade3a0a4a00177b60811c8 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 11:47:22 -0700 Subject: [PATCH 045/330] feat: expose blt_python_file_exts setting This commit exposes a BLT variable named BLT_Python_FILE_EXTS that holds a list of wildcarded file extensions for Python source files as part of implementing Python code beautification support using yapf. --- SetupBLT.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SetupBLT.cmake b/SetupBLT.cmake index 9f0559a73..bfe1553cf 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -176,7 +176,8 @@ if (NOT BLT_LOADED) CACHE STRING "List of known file extensions used for C/CXX sources") set(BLT_Fortran_FILE_EXTS ".F" ".f" ".f90" ".F90" CACHE STRING "List of known file extensions used for Fortran sources") - + set(BLT_Python_FILE_EXTS ".py" + CACHE STRING "List of known file extensions used for Python sources") ################################ # Setup compiler options From ae0f2551343a0746cb91b965c989569e1ebe11f7 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 11:58:35 -0700 Subject: [PATCH 046/330] feat: blt split src list by lang: add python This commit adds a Python_LIST output to the blt_split_source_list_by_language CMake macro as part of adding Python code beautifier support to BLT using yapf. Checks for HIP or CUDA code do not filter for Python sources because the blt_add_cuda_target, blt_add_hip_library, and blt_add_hip_executable targets are intended for compiling non-Python sources. --- cmake/BLTPrivateMacros.cmake | 23 +++++++++++++++-------- cmake/SetupCodeChecks.cmake | 4 +++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 6badf07f1..44011bdc1 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -552,17 +552,20 @@ endmacro(blt_add_hip_executable) ##------------------------------------------------------------------------------ ## blt_split_source_list_by_language( SOURCES ## C_LIST -## Fortran_LIST ) +## Fortran_LIST +## Python_LIST ) ## -## Filters source list by file extension into C/C++ and Fortran source lists -## based on BLT_C_FILE_EXTS and BLT_Fortran_FILE_EXTS (global BLT variables). -## Files with no extension or generator expressions that are not object libraries -## (of the form "$") will throw fatal errors. -##------------------------------------------------------------------------------ +## Filters source list by file extension into C/C++, Fortran, and +## Python source lists based on the global BLT variables +## BLT_C_FILE_EXTS, BLT_Fortran_FILE_EXTS, and BLT_Python_FILE_EXTS, +## respectively. Files with no extension or generator expressions +## that are not object libraries (of the form +## "$") will throw fatal errors. +## ------------------------------------------------------------------------------ macro(blt_split_source_list_by_language) set(options) - set(singleValueArgs C_LIST Fortran_LIST) + set(singleValueArgs C_LIST Fortran_LIST Python_LIST) set(multiValueArgs SOURCES) # Parse the arguments @@ -599,8 +602,12 @@ macro(blt_split_source_list_by_language) if (DEFINED arg_Fortran_LIST) list(APPEND ${arg_Fortran_LIST} ${_file}) endif() + elseif(${_ext_lower} IN_LIST BLT_Python_FILE_EXTS) + if (DEFINED arg_Python_LIST) + list(APPEND ${arg_Python_LIST} ${_file}) + endif() else() - message(FATAL_ERROR "blt_split_source_list_by_language given source file with unknown file extension. Add the missing extension to the corresponding list (BLT_C_FILE_EXTS or BLT_Fortran_FILE_EXTS).\n Unknown file: ${_file}") + message(FATAL_ERROR "blt_split_source_list_by_language given source file with unknown file extension. Add the missing extension to the corresponding list (BLT_C_FILE_EXTS, BLT_Fortran_FILE_EXTS, or BLT_Python_FILE_EXTS).\n Unknown file: ${_file}") endif() endforeach() diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 5909c9e1e..96b3f859b 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -135,9 +135,11 @@ macro(blt_add_code_checks) # Generate source lists based on language set(_c_sources) set(_f_sources) + set(_py_sources) blt_split_source_list_by_language(SOURCES ${_rel_sources} C_LIST _c_sources - Fortran_LIST _f_sources) + Fortran_LIST _f_sources + Python_LIST _py_sources) # Check that no more than one formatting config file was supplied # for C-style languages. From dea10a35b51385c501b17b8f97f6fde5022885e6 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 16:33:14 -0700 Subject: [PATCH 047/330] feat: add blt_add_yapf_target CMake macro This commit adds a blt_add_yapf_target CMake macro as part of adding Python beautification support using the Yapf Python source code beautifier. This macro is written by analogy to the blt_add_astyle_target, blt_add_clangformat_target, and blt_add_uncrustify target macros, and exposes a means to invoke yapf on a collection of (Python) source files. --- cmake/SetupCodeChecks.cmake | 96 +++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 96b3f859b..fc28b96b7 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -780,3 +780,99 @@ macro(blt_add_uncrustify_target) endif() endmacro(blt_add_uncrustify_target) + + +##------------------------------------------------------------------------------ +## blt_add_yapf_target( NAME +## MODIFY_FILES [TRUE | FALSE (default)] +## CFG_FILE +## PREPEND_FLAGS +## APPEND_FLAGS +## COMMENT +## WORKING_DIRECTORY +## SRC_FILES [FILE1 [FILE2 ...]] ) +## +## Creates a new target with the given NAME for running yapf over the given SRC_FILES. +##------------------------------------------------------------------------------ +macro(blt_add_yapf_target) + + ## parse the arguments to the macro + set(options) + set(singleValueArgs NAME MODIFY_FILES CFG_FILE COMMENT WORKING_DIRECTORY) + set(multiValueArgs SRC_FILES PREPEND_FLAGS APPEND_FLAGS) + + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # Check/Set required parameters + if(NOT DEFINED arg_NAME) + message(FATAL_ERROR "blt_add_yapf_target requires a NAME parameter") + endif() + + if(NOT DEFINED arg_CFG_FILE) + message(FATAL_ERROR "blt_add_yapf_target requires a CFG_FILE parameter") + endif() + + if(NOT DEFINED arg_SRC_FILES) + message(FATAL_ERROR "blt_add_yapf_target requires a SRC_FILES parameter") + endif() + + if(NOT DEFINED arg_MODIFY_FILES) + set(arg_MODIFY_FILES FALSE) + endif() + + if(DEFINED arg_WORKING_DIRECTORY) + set(_wd ${arg_WORKING_DIRECTORY}) + else() + set(_wd ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + set(_generate_target TRUE) + + # Check the version -- output is of the form "yapf X.Y.Z" + execute_process( + COMMAND ${YAPF_EXECUTABLE} --version + OUTPUT_VARIABLE _version_str + ERROR_VARIABLE _version_str + OUTPUT_STRIP_TRAILING_WHITESPACE ) + string(REGEX MATCH "([0-9]+(\\.)?)+$" _yapf_version ${_version_str}) + + if(BLT_REQUIRED_YAPF_VERSION) + # The user may only specify a part of the version (e.g. just the maj ver) + # so check for substring + string(FIND "${_yapf_version}" ${BLT_REQUIRED_YAPF_VERSION} VERSION_POS) + if (NOT VERSION_POS EQUAL 0) + set(_generate_target FALSE) + if (NOT _BLT_STYLE_VERSION_WARNING_ISSUED) + message(WARNING "blt_add_yapf_target: yapf ${BLT_REQUIRED_YAPF_VERSION} is required, found ${_yapf_version}. Disabling 'style' build target.") + set(_BLT_STYLE_VERSION_WARNING_ISSUED TRUE CACHE BOOL "Limits BLT issuing more than one warning for style version" FORCE) + endif() + endif() + endif() + + if(${arg_MODIFY_FILES}) + set(MODIFY_FILES_FLAG --in-place) + else() + set(MODIFY_FILES_FLAG --diff) + endif() + + if(_generate_target) + add_custom_target( + ${arg_NAME} + COMMAND ${YAPF_EXECUTABLE} ${arg_PREPEND_FLAGS} + --style ${arg_CFG_FILE} ${MODIFY_FILES_FLAG} ${arg_SRC_FILES} ${arg_APPEND_FLAGS} + WORKING_DIRECTORY ${_wd} + COMMENT "${arg_COMMENT}Running Yapf source code formatting checks.") + + # Hook our new target into the proper dependency chain + if(${arg_MODIFY_FILES}) + add_dependencies(yapf_style ${arg_NAME}) + else() + add_dependencies(yapf_check ${arg_NAME}) + endif() + + # Code formatting targets should only be run on demand + set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_ALL TRUE) + set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) + endif() +endmacro(blt_add_yapf_target) From 431fac7766a5cda5e96112c02d7b6bdf8c3c3d40 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 17:26:33 -0700 Subject: [PATCH 048/330] feat: add yapf calls to blt_add_code_checks macro This commit adds conditional invocations of the blt_add_yapf_target CMake macro to the blt_add_code_checks CMake macro in order to call Yapf on Python source files. These changes are made as part of adding support to configure Python code styling using Yapf. --- cmake/SetupCodeChecks.cmake | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index fc28b96b7..8a973ed68 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -94,6 +94,7 @@ endforeach() ## ASTYLE_CFG_FILE ## CLANGFORMAT_CFG_FILE ## UNCRUSTIFY_CFG_FILE +## YAPF_CFG_FILE ## CPPCHECK_FLAGS ## CLANGQUERY_CHECKER_DIRECTORIES [dir1 [dir2]]) ## @@ -104,7 +105,7 @@ endforeach() macro(blt_add_code_checks) set(options ) - set(singleValueArgs PREFIX ASTYLE_CFG_FILE CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE) + set(singleValueArgs PREFIX ASTYLE_CFG_FILE CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE YAPF_CFG_FILE) set(multiValueArgs SOURCES CPPCHECK_FLAGS CLANGQUERY_CHECKER_DIRECTORIES) cmake_parse_arguments(arg @@ -220,6 +221,25 @@ macro(blt_add_code_checks) SRC_FILES ${_c_sources} ) endif() + if (YAPF_FOUND AND DEFINED arg_YAPF_CFG_FILE) + set(_check_target_name ${arg_PREFIX}_yapf_check) + blt_error_if_target_exists(${_check_target_name} ${_error_msg}) + set(_style_target_name ${arg_PREFIX}_yapf_style) + blt_error_if_target_exists(${_style_target_name} ${_error_msg}) + + blt_add_yapf_target( NAME ${_check_target_name} + MODIFY_FILES FALSE + CFG_FILE ${arg_YAPF_CFG_FILE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + SRC_FILES ${_py_sources} ) + + blt_add_yapf_target( NAME ${_style_target_name} + MODIFY_FILES TRUE + CFG_FILE ${arg_YAPF_CFG_FILE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + SRC_FILES ${_py_sources} ) + endif() + if (CPPCHECK_FOUND) set(_cppcheck_target_name ${arg_PREFIX}_cppcheck_check) blt_error_if_target_exists(${_cppcheck_target_name} ${_error_msg}) From 22aa5b23b3deac4c25862628485be29dc7f798f5 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 17:50:30 -0700 Subject: [PATCH 049/330] feat: add blt_add_yapf_target to api documentation This commit adds documentation on the blt_add_yapf_target CMake macro to the BLT API documentation as part of providing support for Python source code beautification using Yapf. --- docs/api/code_check.rst | 81 +++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 11 deletions(-) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 990b61dc0..73878058a 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -1,6 +1,6 @@ .. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details -.. # +.. # .. # SPDX-License-Identifier: (BSD-3-Clause) Code Check Macros @@ -16,6 +16,7 @@ blt_add_code_checks ASTYLE_CFG_FILE CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE + YAPF_CFG_FILE CPPCHECK_FLAGS CLANGQUERY_CHECKER_DIRECTORIES [dir1 [dir2]]) @@ -37,6 +38,9 @@ CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE Path to Uncrustify config file +YAPF_CFG_FILE + Path to Yapf config file + CPPCHECK_FLAGS List of flags added to Cppcheck @@ -54,10 +58,11 @@ functionality you will need to call the individual code check macros yourself. will stop your code checks from running unless you are the main CMake project. Sources are filtered based on file extensions for use in these code checks. If you need -additional file extensions defined add them to BLT_C_FILE_EXTS and BLT_Fortran_FILE_EXTS. -Currently this macro only has code checks for C/C++ and simply filters out the Fortran files. +additional file extensions defined add them to BLT_C_FILE_EXTS, BLT_Python_FILE_EXTS, and +BLT_Fortran_FILE_EXTS. Currently this macro only has code checks for C/C++ and Python; it +simply filters out the Fortran files. -This macro supports code formatting with either AStyle, ClangFormat, or Uncrustify +This macro supports C/C++ code formatting with either AStyle, ClangFormat, or Uncrustify (but not all at the same time) only if the following requirements are met: - AStyle @@ -79,13 +84,19 @@ This macro supports code formatting with either AStyle, ClangFormat, or Uncrusti ClangFormat does not support a command line option for config files. To work around this, we copy the given config file to the build directory where this macro runs from. +This macro also supports Python code formatting with Yapf only if the following requirements +are met: + +* YAPF_CFG_FILE is given +* YAPF_EXECUTABLE is defined and found prior to calling this macro + Enabled code formatting checks produce a `check` build target that will test to see if you are out of compliance with your code formatting and a `style` build target that will actually modify your source files. It also creates smaller child build targets that follow the pattern `__`. If a particular version of a code formatting tool is required, you can configure BLT to enforce -that version by setting ``BLT_REQUIRED__VERSION`` to as much of the version +that version by setting ``BLT_REQUIRED__VERSION`` to as much of the version as you need. For example: .. code-block:: cmake @@ -105,7 +116,7 @@ This macro supports the following static analysis tools with their requirements: - Clang-Query * CLANGQUERY_EXECUTABLE is defined and found prior to calling this macro - * CLANGQUERY_CHECKER_DIRECTORIES parameter given or BLT_CLANGQUERY_CHECKER_DIRECTORIES is defined + * CLANGQUERY_CHECKER_DIRECTORIES parameter given or BLT_CLANGQUERY_CHECKER_DIRECTORIES is defined - clang-tidy @@ -239,7 +250,7 @@ SRC_FILES Clang-tidy is a tool used for diagnosing and fixing typical programming errors. It is useful for enforcing coding standards and rules on your source code. Clang-tidy is documented `here `_. -CHECKS are the static analysis "rules" to specifically run on the target. +CHECKS are the static analysis "rules" to specifically run on the target. If no checks are specified, clang-tidy will run the default available static analysis checks. @@ -250,7 +261,7 @@ blt_add_astyle_target blt_add_astyle_target( NAME MODIFY_FILES [TRUE | FALSE (default)] - CFG_FILE + CFG_FILE PREPEND_FLAGS APPEND_FLAGS COMMENT @@ -302,7 +313,7 @@ blt_add_clangformat_target blt_add_clangformat_target( NAME MODIFY_FILES [TRUE | FALSE (default)] - CFG_FILE + CFG_FILE PREPEND_FLAGS APPEND_FLAGS COMMENT @@ -352,7 +363,7 @@ which files do not conform to your style guide. .. note:: ClangFormat does not support a command line option for check (--dry-run) until version 10. - This version is not widely used or available at this time. To work around this, we use an + This version is not widely used or available at this time. To work around this, we use an included script called run-clang-format.py that does not use PREPEND_FLAGS or APPEND_FLAGS in the `check` build target because the script does not support command line flags passed to `clang-format`. This script is not used in the `style` build target. @@ -364,7 +375,7 @@ blt_add_uncrustify_target blt_add_uncrustify_target( NAME MODIFY_FILES [TRUE | FALSE (default)] - CFG_FILE + CFG_FILE PREPEND_FLAGS APPEND_FLAGS COMMENT @@ -406,3 +417,51 @@ created target is added to the parent `check` build target. This target will not which files do not conform to your style guide. .. Note:: Setting MODIFY_FILES to FALSE is only supported in Uncrustify v0.61 or greater. + +blt_add_yapf_target +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + blt_add_yapf_target( NAME + MODIFY_FILES [TRUE | FALSE (default)] + CFG_FILE + PREPEND_FLAGS + APPEND_FLAGS + COMMENT + WORKING_DIRECTORY + SRC_FILES [source1 [source2 ...]] ) + +Creates a new build target for running Yapf + +NAME + Name of created build target + +MODIFY_FILES + Modify the files in place. Defaults to FALSE. + +CFG_FILE + Path to Yapf config file + +PREPEND_FLAGS + Additional flags added to the front of the Yapf flags + +APPEND_FLAGS + Additional flags added to the end of the Yapf flags + +COMMENT + Comment prepended to the build target output + +WORKING_DIRECTORY + Directory in which the Yapf command is run. Defaults to where macro is called. + +SRC_FILES + Source list that Yapf will be ran on + +Yapf is a Source Code Beautifier for Python code. More information about +Yapf can be found `here `_. + +When MODIFY_FILES is set to TRUE, modifies the files in place and adds the created build +target to the parent `style` build target. Otherwise the files are not modified and the +created target is added to the parent `check` build target. This target will notify you +which files do not conform to your style guide. From 2ec19f732b1393e31b15ed4ade420423a29dac85 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 17:56:06 -0700 Subject: [PATCH 050/330] feat: add yapf support to release notes This commit adds to the release notes the just-implemented support for formatting Python source code using Yapf. --- RELEASE-NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 451350d69..7a4580a42 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -20,6 +20,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ implicit link directories for all languages - Added user option for enforcing specific versions of autoformatters - the new options are ``BLT_REQUIRED_ASTYLE_VERSION``, ``BLT_REQUIRED_CLANGFORMAT_VERSION``, and ``BLT_REQUIRED_UNCRUSTIFY_VERSION`` +- Added support for formatting Python code using YAPF. ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed From ea6f3f63d10f161597088e478001a726d8ae801d Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 28 Oct 2020 17:58:20 -0700 Subject: [PATCH 051/330] feat: set ENABLE_YAPF to ON by default This commit sets the ENABLE_YAPF CMake variable to ON to enable support for Python source code formatting using Yapf by default. --- cmake/BLTOptions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index f414bee5b..2f6822aa5 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -36,7 +36,7 @@ option(ENABLE_VALGRIND "Enables Valgrind support" ON) option(ENABLE_ASTYLE "Enables AStyle support" ON) option(ENABLE_CLANGFORMAT "Enables ClangFormat support" ON) option(ENABLE_UNCRUSTIFY "Enables Uncrustify support" ON) -option(ENABLE_YAPF "Enables Yapf support" OFF) +option(ENABLE_YAPF "Enables Yapf support" ON) #------------------------------------------------------------------------------ # Build Options From edbc43fb7fa9b9015cc588c3390eb00180381137 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 14:05:05 -0700 Subject: [PATCH 052/330] feat: add internal tests of yapf styling/checking This commit adds some internal tests of Yapf styling and checking using examples from the google/yapf GitHub repository. * tests/internal/yapf.cfg is a Yapf configuration in TOML format taken from the google/yapf repo * tests/internal/src/test_yapf_conformant.py is a Python source file that should not change if Yapf is run on it using the Yapf configuration above * tests/internal/src/test_yapf_nonconformant.py is a Python source file that should change if Yapf is run on it using the Yapf configuration above; after running Yapf on it, its contents should match those of test_yapf_conformant.py --- tests/internal/CMakeLists.txt | 27 +++++++++++++++++++ tests/internal/src/test_yapf_conformant.py | 18 +++++++++++++ tests/internal/src/test_yapf_nonconformant.py | 15 +++++++++++ tests/internal/yapf.cfg | 6 +++++ 4 files changed, 66 insertions(+) create mode 100644 tests/internal/src/test_yapf_conformant.py create mode 100644 tests/internal/src/test_yapf_nonconformant.py create mode 100644 tests/internal/yapf.cfg diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 971850178..42d397265 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -342,6 +342,33 @@ if(CLANGFORMAT_FOUND) endif() +if(YAPF_FOUND) + # Test case where a style target running yapf should do nothing, and + # a corresponding check target should return 0 + set(internal_conformant_python_srcs + src/test_yapf_conformant.py) + + blt_add_code_checks( + PREFIX yapf_conformant_tests + SOURCES ${internal_conformant_python_srcs} + YAPF_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yapf.cfg ) + + # Test case where a style target running yapf should reformat the source file, + # and a corresponding check target should return a nonzero code + # + # After styling, test_yapf_conformant.py and + # test_yapf_nonconformant.py should have the same contents + set(internal_nonconformant_python_srcs + src/test_yapf_nonconformant.py) + + blt_add_code_checks( + PREFIX yapf_nonconformant_tests + SOURCES ${internal_nonconformant_python_srcs + YAPF_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yapf.cfg) +endif() # end if(YAPF_FOUND) + + + # Check blt_add_test with a command that is not a target if(WIN32) configure_file(return_true_win32.in tests/return_true.bat COPYONLY) diff --git a/tests/internal/src/test_yapf_conformant.py b/tests/internal/src/test_yapf_conformant.py new file mode 100644 index 000000000..c90908f57 --- /dev/null +++ b/tests/internal/src/test_yapf_conformant.py @@ -0,0 +1,18 @@ +# Example from google/yapf repo +x = {'a': 37, 'b': 42, 'c': 927} + +y = 'hello ' 'world' +z = 'hello ' + 'world' +a = 'hello {}'.format('world') + + +class foo(object): + def f(self): + return 37 * -+2 + + def g(self, x, y=42): + return y + + +def f(a): + return 37 + -+a[42 - x:y**3] diff --git a/tests/internal/src/test_yapf_nonconformant.py b/tests/internal/src/test_yapf_nonconformant.py new file mode 100644 index 000000000..58a75e381 --- /dev/null +++ b/tests/internal/src/test_yapf_nonconformant.py @@ -0,0 +1,15 @@ +# Example from google/yapf repo +x = { 'a':37,'b':42, + +'c':927} + +y = 'hello ''world' +z = 'hello '+'world' +a = 'hello {}'.format('world') +class foo ( object ): + def f (self ): + return 37*-+2 + def g(self, x,y=42): + return y +def f ( a ) : + return 37+-+a[42-x : y**3] diff --git a/tests/internal/yapf.cfg b/tests/internal/yapf.cfg new file mode 100644 index 000000000..2631b0990 --- /dev/null +++ b/tests/internal/yapf.cfg @@ -0,0 +1,6 @@ +# Style settings example shown in +# https://github.com/google/yapf/blob/master/README.rst +[style] +based_on_style = pep8 +spaces_before_comment = 4 +split_before_logical_operator = true From 049cc4828f8a7f29e9972122539283fe2c037f9c Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 2 Nov 2020 15:53:02 -0800 Subject: [PATCH 053/330] split HEADERS from SOURCES on blt_add_executable --- cmake/BLTMacros.cmake | 8 +++++--- cmake/BLTPrivateMacros.cmake | 5 +++-- docs/api/target.rst | 4 ++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index e444caafb..0940f812b 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -549,6 +549,7 @@ endmacro(blt_add_library) ##------------------------------------------------------------------------------ ## blt_add_executable( NAME ## SOURCES [source1 [source2 ...]] +## HEADERS [header1 [header2 ...]] ## INCLUDES [dir1 [dir2 ...]] ## DEFINES [define1 [define2 ...]] ## DEPENDS_ON [dep1 [dep2 ...]] @@ -562,7 +563,7 @@ macro(blt_add_executable) set(options ) set(singleValueArgs NAME OUTPUT_DIR OUTPUT_NAME FOLDER) - set(multiValueArgs SOURCES INCLUDES DEFINES DEPENDS_ON) + set(multiValueArgs HEADERS SOURCES INCLUDES DEFINES DEPENDS_ON) # Parse the arguments to the macro cmake_parse_arguments(arg @@ -580,9 +581,10 @@ macro(blt_add_executable) if (ENABLE_HIP) blt_add_hip_executable(NAME ${arg_NAME} SOURCES ${arg_SOURCES} + HEADERS ${arg_HEADERS} DEPENDS_ON ${arg_DEPENDS_ON}) else() - add_executable( ${arg_NAME} ${arg_SOURCES} ) + add_executable( ${arg_NAME} ${arg_SOURCES} ${arg_HEADERS}) if (ENABLE_CUDA AND NOT ENABLE_CLANG_CUDA) blt_setup_cuda_target( @@ -639,7 +641,7 @@ macro(blt_add_executable) blt_set_target_folder(TARGET ${arg_NAME} FOLDER "${arg_FOLDER}") endif() - blt_update_project_sources( TARGET_SOURCES ${arg_SOURCES} ) + blt_update_project_sources( TARGET_SOURCES ${arg_SOURCES} ${arg_HEADERS} ) blt_clean_target(TARGET ${arg_NAME}) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 6badf07f1..5db9712e2 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -495,13 +495,14 @@ endmacro(blt_add_hip_library) ##------------------------------------------------------------------------------ ## blt_add_hip_executable(NAME ## SOURCES [source1 [source2 ...]] +## HEADERS [header1 [header2 ...]] ## DEPENDS_ON [dep1 ...] ##------------------------------------------------------------------------------ macro(blt_add_hip_executable) set(options) set(singleValueArgs NAME) - set(multiValueArgs SOURCES DEPENDS_ON) + set(multiValueArgs HEADERS SOURCES DEPENDS_ON) # Parse the arguments cmake_parse_arguments(arg "${options}" "${singleValueArgs}" @@ -544,7 +545,7 @@ macro(blt_add_hip_executable) hip_add_executable( ${arg_NAME} ${arg_SOURCES} ) else() - add_executable( ${arg_NAME} ${arg_SOURCES} ) + add_executable( ${arg_NAME} ${arg_SOURCES} ${arg_HEADERS}) endif() endmacro(blt_add_hip_executable) diff --git a/docs/api/target.rst b/docs/api/target.rst index 35ff86d2e..9175af461 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -69,6 +69,7 @@ blt_add_executable blt_add_executable( NAME SOURCES [source1 [source2 ...]] + HEADERS [header1 [header2 ...]] INCLUDES [dir1 [dir2 ...]] DEFINES [define1 [define2 ...]] DEPENDS_ON [dep1 [dep2 ...]] @@ -84,6 +85,9 @@ NAME SOURCES List of all sources to be added +HEADERS + List of all headers to be added + INCLUDES List of include directories both used by this target and inherited by dependent targets From cba9c458b16faebb1774c8ae634f5cfa356b2186 Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 2 Nov 2020 16:47:09 -0800 Subject: [PATCH 054/330] Add docs explaining why HEADERS is important --- RELEASE-NOTES.md | 2 ++ docs/api/target.rst | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 451350d69..a34d0f1ec 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -20,6 +20,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ implicit link directories for all languages - Added user option for enforcing specific versions of autoformatters - the new options are ``BLT_REQUIRED_ASTYLE_VERSION``, ``BLT_REQUIRED_CLANGFORMAT_VERSION``, and ``BLT_REQUIRED_UNCRUSTIFY_VERSION`` +- Added ``HEADERS`` to ``blt_add_executable``. This is important for build system dependency tracking + and IDE folder support. ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/docs/api/target.rst b/docs/api/target.rst index 9175af461..1927292a4 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -113,7 +113,8 @@ Adds an executable target, called , to be built from the given sources. It also adds the given INCLUDES and DEFINES from the parameters to this macro and adds all inherited information from the list given by DEPENDS_ON. This macro creates a true CMake target that can be altered by other CMake commands -like normal, such as `set_target_property()`. +like normal, such as `set_target_property()`. It also adds SOURCES and HEADERS +to the library for build system dependency tracking and IDE folder support. OUTPUT_NAME is useful when multiple CMake targets with the same name need to be created by different targets. @@ -190,7 +191,8 @@ FOLDER Name of the IDE folder to ease organization This macro creates a true CMake target that can be altered by other CMake commands -like normal, such as `set_target_property()`. +like normal, such as `set_target_property()`. It also adds SOURCES and HEADERS +to the library for build system dependency tracking and IDE folder support. This macro supports three types of libraries automatically: normal, header-only, or object. From 01d9dadd1469cf1f7e86967a04bac5e60930f611 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 3 Nov 2020 13:13:02 -0600 Subject: [PATCH 055/330] feat: initial draft of blt_import_library --- cmake/BLTMacros.cmake | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 0940f812b..33515c1d2 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -380,6 +380,81 @@ macro(blt_register_library) endmacro(blt_register_library) +##------------------------------------------------------------------------------ +## blt_import_library( NAME +## PATH +## DEPENDS_ON [dep1 [dep2 ...]] +## INCLUDES [include1 [include2 ...]] +## TREAT_INCLUDES_AS_SYSTEM [ON|OFF] +## FORTRAN_MODULES [ path1 [ path2 ..]] +## COMPILE_FLAGS [ flag1 [ flag2 ..]] +## LINK_FLAGS [ flag1 [ flag2 ..]] +## DEFINES [def1 [def2 ...]] ) +## +## Imports a library as a CMake target +##------------------------------------------------------------------------------ +macro(blt_import_library) + # TODO: Do we want to be able to bundle multiple library files into a single target + # If so PATH needs to be multivalued - also IMPORTED_LOCATION doesn't quite work for multiple + set(singleValueArgs PATH TREAT_INCLUDES_AS_SYSTEM) + set(multiValueArgs INCLUDES + DEPENDS_ON + # FIXME: FORTRAN_MODULES + COMPILE_FLAGS + LINK_FLAGS + DEFINES ) + + ## parse the arguments + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # Input checks + if( "${arg_NAME}" STREQUAL "" ) + message(FATAL_ERROR "blt_import_library() must be called with argument NAME ") + endif() + if( "${arg_PATH}" STREQUAL "" ) + message(FATAL_ERROR "blt_import_library() must be called with argument PATH ") + endif() + + get_filename_component(lib_ext "${arg_PATH}" EXT) + string(TOLOWER ${lib_ext} lowercase_ext) + + # Check for static or dynamic library + if (lowercase_ext MATCHES "\.(lib|a)$") + add_library("${arg_NAME}" STATIC IMPORTED GLOBAL) + else() + add_library("${arg_NAME}" SHARED IMPORTED GLOBAL) + endif() + set_target_properties("${arg_NAME}" PROPERTIES IMPORTED_LOCATION "${arg_PATH}") + + # TODO: This won't expand BLT-registered libraries + if( arg_DEPENDS_ON ) + target_link_libraries("${arg_NAME}" INTERFACE "${arg_DEPENDS_ON}") + endif() + + if( arg_INCLUDES ) + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) + target_include_directories("${arg_NAME}" SYSTEM INTERFACE "${arg_INCLUDES}") + else() + target_include_directories("${arg_NAME}" INTERFACE "${arg_INCLUDES}") + endif() + endif() + + if( arg_COMPILE_FLAGS ) + target_compile_options("${arg_NAME}" INTERFACE "${arg_COMPILE_FLAGS}") + endif() + + if( arg_LINK_FLAGS ) + target_link_options("${arg_NAME}" INTERFACE "${arg_LINK_FLAGS}") + endif() + + if( arg_DEFINES ) + target_compile_definitions("${arg_NAME}" INTERFACE "${arg_DEFINES}") + endif() + +endmacro(blt_import_library) + ##------------------------------------------------------------------------------ ## blt_add_library( NAME From f642bc60d5186c9842266f0097908e81b9f6afb5 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Tue, 3 Nov 2020 13:39:18 -0800 Subject: [PATCH 056/330] fix: s/preprend/prepend/g; in astyle wrapper This commit replaces all instances of "preprend" with "prepend" in the astyle wrapper script. Without this change, ASTYLE_PREPEND_FLAGS will always be unset. --- cmake/WrapAstyle.cmake.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/WrapAstyle.cmake.in b/cmake/WrapAstyle.cmake.in index 1ea3dea30..90671ff03 100644 --- a/cmake/WrapAstyle.cmake.in +++ b/cmake/WrapAstyle.cmake.in @@ -16,11 +16,11 @@ # Set up required variables set(ASTYLE_TARGET @arg_NAME@) set(ASTYLE_EXECUTABLE @ASTYLE_EXECUTABLE@) -set(ASTYLE_PREPEND_FLAGS @arg_PREPREND_FLAGS@) +set(ASTYLE_PREPEND_FLAGS @arg_PREPEND_FLAGS@) set(ASTYLE_CFG_FILE @arg_CFG_FILE@) set(ASTYLE_MODIFY_FILES_FLAGS @MODIFY_FILES_FLAG@) set(ASTYLE_SOURCE_FILES @arg_SRC_FILES@) -set(ASTYLE_APPEND_FLAGS @arg_PREPREND_FLAGS@) +set(ASTYLE_APPEND_FLAGS @arg_PREPEND_FLAGS@) set(ASTYLE_WORKING_DIRECTORY @_wd@) # Invoke AStyle @@ -58,4 +58,4 @@ if(NOT ${_astyle_output_var} STREQUAL "") if(NOT ${len} EQUAL 0) message(FATAL_ERROR "AStyle found ${len} improperly formatted files.") endif() -endif() \ No newline at end of file +endif() From 4815008ddafd690ed072c43604ec976203d85aa7 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Tue, 3 Nov 2020 13:42:41 -0800 Subject: [PATCH 057/330] fix: astyle wrapper: fix append_flags arg This commit changes the 2nd instance of @arg_PREPEND_FLAGS@ to @arg_APPEND_FLAGS@ so that append flags are properly set in the astyle wrapper script. --- cmake/WrapAstyle.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/WrapAstyle.cmake.in b/cmake/WrapAstyle.cmake.in index 90671ff03..1e2ac8f3b 100644 --- a/cmake/WrapAstyle.cmake.in +++ b/cmake/WrapAstyle.cmake.in @@ -20,7 +20,7 @@ set(ASTYLE_PREPEND_FLAGS @arg_PREPEND_FLAGS@) set(ASTYLE_CFG_FILE @arg_CFG_FILE@) set(ASTYLE_MODIFY_FILES_FLAGS @MODIFY_FILES_FLAG@) set(ASTYLE_SOURCE_FILES @arg_SRC_FILES@) -set(ASTYLE_APPEND_FLAGS @arg_PREPEND_FLAGS@) +set(ASTYLE_APPEND_FLAGS @arg_APPEND_FLAGS@) set(ASTYLE_WORKING_DIRECTORY @_wd@) # Invoke AStyle From bd140fe74a92ab8d5f1fc5af2be0a790d5d49f91 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 4 Nov 2020 08:28:05 -0600 Subject: [PATCH 058/330] feat: moved patching into separate macro, added support for combining multi-archive libraries --- cmake/BLTMacros.cmake | 127 +++++++++++++++++++++++------- cmake/thirdparty/SetupMPI.cmake | 13 ++- thirdparty_builtin/CMakeLists.txt | 6 +- 3 files changed, 108 insertions(+), 38 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 33515c1d2..edae12944 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -381,24 +381,23 @@ macro(blt_register_library) endmacro(blt_register_library) ##------------------------------------------------------------------------------ -## blt_import_library( NAME -## PATH +## blt_patch_target( NAME ## DEPENDS_ON [dep1 [dep2 ...]] ## INCLUDES [include1 [include2 ...]] +## LIBRARIES [lib1 [lib2 ...]] ## TREAT_INCLUDES_AS_SYSTEM [ON|OFF] ## FORTRAN_MODULES [ path1 [ path2 ..]] ## COMPILE_FLAGS [ flag1 [ flag2 ..]] ## LINK_FLAGS [ flag1 [ flag2 ..]] ## DEFINES [def1 [def2 ...]] ) ## -## Imports a library as a CMake target +## Modifies an existing CMake target ##------------------------------------------------------------------------------ -macro(blt_import_library) - # TODO: Do we want to be able to bundle multiple library files into a single target - # If so PATH needs to be multivalued - also IMPORTED_LOCATION doesn't quite work for multiple - set(singleValueArgs PATH TREAT_INCLUDES_AS_SYSTEM) +macro(blt_patch_target) + set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) set(multiValueArgs INCLUDES DEPENDS_ON + LIBRARIES # FIXME: FORTRAN_MODULES COMPILE_FLAGS LINK_FLAGS @@ -412,47 +411,121 @@ macro(blt_import_library) if( "${arg_NAME}" STREQUAL "" ) message(FATAL_ERROR "blt_import_library() must be called with argument NAME ") endif() - if( "${arg_PATH}" STREQUAL "" ) - message(FATAL_ERROR "blt_import_library() must be called with argument PATH ") - endif() - get_filename_component(lib_ext "${arg_PATH}" EXT) - string(TOLOWER ${lib_ext} lowercase_ext) + # Things that need to go into target_link_libraries + set(libs_to_link "") - # Check for static or dynamic library - if (lowercase_ext MATCHES "\.(lib|a)$") - add_library("${arg_NAME}" STATIC IMPORTED GLOBAL) - else() - add_library("${arg_NAME}" SHARED IMPORTED GLOBAL) + if( arg_LIBRARIES ) + message(STATUS "adding libs ${arg_LIBRARIES}") + list(APPEND libs_to_link ${arg_LIBRARIES}) endif() - set_target_properties("${arg_NAME}" PROPERTIES IMPORTED_LOCATION "${arg_PATH}") # TODO: This won't expand BLT-registered libraries if( arg_DEPENDS_ON ) - target_link_libraries("${arg_NAME}" INTERFACE "${arg_DEPENDS_ON}") + message(STATUS "adding depends ${arg_DEPENDS_ON}") + list(APPEND libs_to_link ${arg_DEPENDS_ON}) endif() + target_link_libraries(${arg_NAME} INTERFACE ${libs_to_link}) + if( arg_INCLUDES ) + target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - target_include_directories("${arg_NAME}" SYSTEM INTERFACE "${arg_INCLUDES}") - else() - target_include_directories("${arg_NAME}" INTERFACE "${arg_INCLUDES}") + get_target_property(all_include_dirs ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(${arg_NAME} SYSTEM INTERFACE ${all_include_dirs}) endif() endif() if( arg_COMPILE_FLAGS ) - target_compile_options("${arg_NAME}" INTERFACE "${arg_COMPILE_FLAGS}") + blt_add_target_compile_flags(TO ${arg_NAME} + SCOPE INTERFACE + FLAGS ${arg_COMPILE_FLAGS}) endif() - + if( arg_LINK_FLAGS ) - target_link_options("${arg_NAME}" INTERFACE "${arg_LINK_FLAGS}") + blt_add_target_link_flags(TO ${arg_NAME} + SCOPE INTERFACE + FLAGS ${arg_LINK_FLAGS}) endif() - + if( arg_DEFINES ) - target_compile_definitions("${arg_NAME}" INTERFACE "${arg_DEFINES}") + blt_add_target_definitions(TO ${arg_NAME} + SCOPE INTERFACE + TARGET_DEFINITIONS ${arg_DEFINES}) + endif() + +endmacro(blt_patch_target) + +##------------------------------------------------------------------------------ +## blt_import_library( NAME +## LIBRARIES [lib1 [lib2 ...]] +## DEPENDS_ON [dep1 [dep2 ...]] +## INCLUDES [include1 [include2 ...]] +## TREAT_INCLUDES_AS_SYSTEM [ON|OFF] +## FORTRAN_MODULES [ path1 [ path2 ..]] +## COMPILE_FLAGS [ flag1 [ flag2 ..]] +## LINK_FLAGS [ flag1 [ flag2 ..]] +## DEFINES [def1 [def2 ...]] ) +## +## Imports a library as a CMake target +##------------------------------------------------------------------------------ +macro(blt_import_library) + set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) + set(multiValueArgs LIBRARIES + INCLUDES + DEPENDS_ON + # FIXME: FORTRAN_MODULES + COMPILE_FLAGS + LINK_FLAGS + DEFINES ) + + ## parse the arguments + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # Input checks + if( "${arg_NAME}" STREQUAL "" ) + message(FATAL_ERROR "blt_import_library() must be called with argument NAME ") + endif() + if( "${arg_LIBRARIES}" STREQUAL "" ) + message(FATAL_ERROR "blt_import_library() must be called with argument LIBRARIES [lib1 [lib2 ...]]") endif() + set(imported_subtargets "") + + # For each library (shared or static), build an imported target + foreach(lib_file ${arg_LIBRARIES}) + get_filename_component(lib_ext "${lib_file}" EXT) + string(TOLOWER ${lib_ext} lowercase_ext) + + get_filename_component(lib_name "${lib_file}" NAME_WE) + set(subtarget_name "${arg_NAME}_${lib_name}_subtarget") + + # Check for static or dynamic library + if (lowercase_ext MATCHES "\.(lib|a)$") + add_library(${subtarget_name} STATIC IMPORTED GLOBAL) + else() + add_library(${subtarget_name} SHARED IMPORTED GLOBAL) + endif() + set_target_properties(${subtarget_name} PROPERTIES IMPORTED_LOCATION "${lib_file}") + list(APPEND imported_subtargets ${subtarget_name}) + endforeach() + + # Add all imported targets to a single interface target + add_library(${arg_NAME} INTERFACE) + target_link_libraries(${arg_NAME} INTERFACE ${imported_subtargets}) + + blt_patch_target( + NAME ${arg_NAME} + DEPENDS_ON ${arg_DEPENDS_ON} + INCLUDES ${arg_INCLUDES} + DEFINES ${arg_DEFINES} + TREAT_INCLUDES_AS_SYSTEM ${arg_TREAT_INCLUDES_AS_SYSTEM} + COMPILE_FLAGS ${arg_COMPILE_FLAGS} + LINK_FLAGS ${arg_LINK_FLAGS} + DEFINES ${arg_DEFINES} + ) endmacro(blt_import_library) diff --git a/cmake/thirdparty/SetupMPI.cmake b/cmake/thirdparty/SetupMPI.cmake index 1cb2cddc1..7bd65f5ec 100644 --- a/cmake/thirdparty/SetupMPI.cmake +++ b/cmake/thirdparty/SetupMPI.cmake @@ -177,10 +177,9 @@ if (ENABLE_FORTRAN) endif() endif() -# Create the registered library -blt_register_library(NAME mpi - INCLUDES ${_mpi_includes} - TREAT_INCLUDES_AS_SYSTEM ON - LIBRARIES ${_mpi_libraries} - COMPILE_FLAGS ${_mpi_compile_flags} - LINK_FLAGS ${_mpi_link_flags} ) +blt_import_library(NAME mpi + INCLUDES ${_mpi_includes} + TREAT_INCLUDES_AS_SYSTEM ON + LIBRARIES ${_mpi_libraries} + COMPILE_FLAGS ${_mpi_compile_flags} + LINK_FLAGS ${_mpi_link_flags} ) diff --git a/thirdparty_builtin/CMakeLists.txt b/thirdparty_builtin/CMakeLists.txt index 125874287..ce38ab0a2 100644 --- a/thirdparty_builtin/CMakeLists.txt +++ b/thirdparty_builtin/CMakeLists.txt @@ -82,7 +82,7 @@ if(ENABLE_TESTS) set (INSTALL_GMOCK OFF CACHE BOOL "") set (INSTALL_GTEST OFF CACHE BOOL "") - + # Enable builtin google test add_subdirectory(googletest-master-2020-01-07 ${BLT_BUILD_DIR}/thirdparty_builtin/googletest-master-2020-01-07) @@ -99,7 +99,7 @@ if(ENABLE_TESTS) DEFINES ${gtest_defines} ${gtest_export_defines} TREAT_INCLUDES_AS_SYSTEM ON ) - + blt_add_target_definitions(TO gtest TARGET_DEFINITIONS ${gtest_defines}) list(APPEND _blt_tpl_targets gtest gtest_main) @@ -168,5 +168,3 @@ if(ENABLE_FOLDERS) blt_set_target_folder(TARGET ${tpl} FOLDER blt/thirdparty) endforeach() endif() - - From 5ef19db8a3d086b3f4d07f947dd247eac2d2ebc8 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 4 Nov 2020 07:11:59 -0800 Subject: [PATCH 059/330] feat: use import_library for CUDA --- cmake/BLTMacros.cmake | 32 +++++++++++++++++++------------- cmake/thirdparty/SetupCUDA.cmake | 6 +++--- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index edae12944..c742af3f0 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -495,21 +495,27 @@ macro(blt_import_library) set(imported_subtargets "") # For each library (shared or static), build an imported target - foreach(lib_file ${arg_LIBRARIES}) - get_filename_component(lib_ext "${lib_file}" EXT) - string(TOLOWER ${lib_ext} lowercase_ext) - - get_filename_component(lib_name "${lib_file}" NAME_WE) - set(subtarget_name "${arg_NAME}_${lib_name}_subtarget") - - # Check for static or dynamic library - if (lowercase_ext MATCHES "\.(lib|a)$") - add_library(${subtarget_name} STATIC IMPORTED GLOBAL) + foreach(lib_name ${arg_LIBRARIES}) + # Check if it's a file + if (EXISTS "${lib_name}") + get_filename_component(lib_ext "${lib_name}" EXT) + string(TOLOWER ${lib_ext} lowercase_ext) + + get_filename_component(lib_file_name "${lib_name}" NAME_WE) + set(subtarget_name "${arg_NAME}_${lib_file_name}_subtarget") + + # Check for static or dynamic library + if (lowercase_ext MATCHES "\.(lib|a)$") + add_library(${subtarget_name} STATIC IMPORTED) + else() + add_library(${subtarget_name} SHARED IMPORTED) + endif() + set_target_properties(${subtarget_name} PROPERTIES IMPORTED_LOCATION "${lib_name}") + list(APPEND imported_subtargets ${subtarget_name}) else() - add_library(${subtarget_name} SHARED IMPORTED GLOBAL) + # Otherwise it's a target or linker flag + list(APPEND imported_subtargets ${lib_name}) endif() - set_target_properties(${subtarget_name} PROPERTIES IMPORTED_LOCATION "${lib_file}") - list(APPEND imported_subtargets ${subtarget_name}) endforeach() # Add all imported targets to a single interface target diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index ca80cda5a..4a86a398e 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -143,7 +143,7 @@ endif() # leaving it to the default source file language. # This logic is handled in the blt_add_library/executable # macros -blt_register_library(NAME cuda +blt_import_library(NAME cuda COMPILE_FLAGS ${_cuda_compile_flags} INCLUDES ${CUDA_INCLUDE_DIRS} LIBRARIES ${CUDA_LIBRARIES} @@ -156,6 +156,6 @@ blt_register_library(NAME cuda # linking with nvcc. # This logic is handled in the blt_add_library/executable # macros -blt_register_library(NAME cuda_runtime +blt_import_library(NAME cuda_runtime INCLUDES ${CUDA_INCLUDE_DIRS} - LIBRARIES ${CUDA_LIBRARIES}) \ No newline at end of file + LIBRARIES ${CUDA_LIBRARIES}) From b6bb531cd477c5000e50b670a7efd8a9fd187593 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 4 Nov 2020 09:54:30 -0600 Subject: [PATCH 060/330] fix: attempt to handle adding of link flags to interface library before CMake 3.13 --- cmake/BLTMacros.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index c742af3f0..331034faa 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -278,8 +278,15 @@ macro(blt_add_target_link_flags) # Convert from a CMake ;-list to a string string (REPLACE ";" " " _link_flags_str "${_link_flags}") - set_target_properties(${arg_TO} - PROPERTIES LINK_FLAGS "${_link_flags_str}") + + # If it's an interface library, the best we can do is add the flags to link_libraries + get_target_property(target_type ${arg_TO} TYPE) + if (${target_type} STREQUAL "INTERFACE_LIBRARY") + target_link_libraries(${arg_TO} "${_link_flags_str}") + else() + set_target_properties(${arg_TO} + PROPERTIES LINK_FLAGS "${_link_flags_str}") + endif() endif() endif() @@ -409,7 +416,7 @@ macro(blt_patch_target) # Input checks if( "${arg_NAME}" STREQUAL "" ) - message(FATAL_ERROR "blt_import_library() must be called with argument NAME ") + message(FATAL_ERROR "blt_patch_target() must be called with argument NAME ") endif() # Things that need to go into target_link_libraries From 14865b538f0c41452832e9cdaa82d44ac93ab91a Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 4 Nov 2020 10:10:11 -0600 Subject: [PATCH 061/330] fix: set through link_libraries if interface --- cmake/BLTMacros.cmake | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 331034faa..07933254e 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -270,7 +270,15 @@ macro(blt_add_target_link_flags) endif() else() # In CMake <= 3.12, there is no target_link_flags or target_link_options command - get_target_property(_link_flags ${arg_TO} LINK_FLAGS) + get_target_property(target_type ${arg_TO} TYPE) + if (${target_type} STREQUAL "INTERFACE_LIBRARY") + # If it's an interface library, we add the flag via link_libraries + get_target_property(_link_flags ${arg_TO} LINK_LIBRARIES) + else() + get_target_property(_link_flags ${arg_TO} LINK_FLAGS) + endif() + + # Append to existing flags if(NOT _link_flags) set(_link_flags "") endif() @@ -279,13 +287,11 @@ macro(blt_add_target_link_flags) # Convert from a CMake ;-list to a string string (REPLACE ";" " " _link_flags_str "${_link_flags}") - # If it's an interface library, the best we can do is add the flags to link_libraries - get_target_property(target_type ${arg_TO} TYPE) if (${target_type} STREQUAL "INTERFACE_LIBRARY") target_link_libraries(${arg_TO} "${_link_flags_str}") else() set_target_properties(${arg_TO} - PROPERTIES LINK_FLAGS "${_link_flags_str}") + PROPERTIES LINK_FLAGS "${_link_flags_str}") endif() endif() endif() From 019a326abeeeb9f33da15855a7945b743dab290b Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 4 Nov 2020 10:17:50 -0600 Subject: [PATCH 062/330] fix: use interface link libraries --- cmake/BLTMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 07933254e..553663444 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -273,7 +273,7 @@ macro(blt_add_target_link_flags) get_target_property(target_type ${arg_TO} TYPE) if (${target_type} STREQUAL "INTERFACE_LIBRARY") # If it's an interface library, we add the flag via link_libraries - get_target_property(_link_flags ${arg_TO} LINK_LIBRARIES) + get_target_property(_link_flags ${arg_TO} INTERFACE_LINK_LIBRARIES) else() get_target_property(_link_flags ${arg_TO} LINK_FLAGS) endif() From 657b90c5ff1a4e42da4931df4a060a89bd1c78cc Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 4 Nov 2020 10:26:52 -0600 Subject: [PATCH 063/330] fix: link as interface --- cmake/BLTMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 553663444..4f2683084 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -288,7 +288,7 @@ macro(blt_add_target_link_flags) string (REPLACE ";" " " _link_flags_str "${_link_flags}") if (${target_type} STREQUAL "INTERFACE_LIBRARY") - target_link_libraries(${arg_TO} "${_link_flags_str}") + target_link_libraries(${arg_TO} INTERFACE "${_link_flags_str}") else() set_target_properties(${arg_TO} PROPERTIES LINK_FLAGS "${_link_flags_str}") From 3de25fbee9c4bdbf794fbc9516be12b462bf1ecd Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 4 Nov 2020 09:28:23 -0800 Subject: [PATCH 064/330] fix: set import_target result as global, fix link flags for interface targets --- cmake/BLTMacros.cmake | 49 +++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 4f2683084..8ffda138b 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -273,26 +273,22 @@ macro(blt_add_target_link_flags) get_target_property(target_type ${arg_TO} TYPE) if (${target_type} STREQUAL "INTERFACE_LIBRARY") # If it's an interface library, we add the flag via link_libraries - get_target_property(_link_flags ${arg_TO} INTERFACE_LINK_LIBRARIES) + target_link_libraries(${arg_TO} INTERFACE ${_flags}) else() get_target_property(_link_flags ${arg_TO} LINK_FLAGS) - endif() - - # Append to existing flags - if(NOT _link_flags) - set(_link_flags "") - endif() - set(_link_flags "${_flags} ${_link_flags}") + # Append to existing flags + if(NOT _link_flags) + set(_link_flags "") + endif() + set(_link_flags "${_flags} ${_link_flags}") - # Convert from a CMake ;-list to a string - string (REPLACE ";" " " _link_flags_str "${_link_flags}") + # Convert from a CMake ;-list to a string + string (REPLACE ";" " " _link_flags_str "${_link_flags}") - if (${target_type} STREQUAL "INTERFACE_LIBRARY") - target_link_libraries(${arg_TO} INTERFACE "${_link_flags_str}") - else() set_target_properties(${arg_TO} PROPERTIES LINK_FLAGS "${_link_flags_str}") endif() + endif() endif() @@ -442,11 +438,24 @@ macro(blt_patch_target) target_link_libraries(${arg_NAME} INTERFACE ${libs_to_link}) if( arg_INCLUDES ) - target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) - # PGI does not support -isystem - if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - get_target_property(all_include_dirs ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(${arg_NAME} SYSTEM INTERFACE ${all_include_dirs}) + if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) + target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) + get_target_property(all_include_dirs ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(${arg_NAME} SYSTEM INTERFACE ${all_include_dirs}) + endif() + else() + # Interface include directories need to be set manually + SET_PROPERTY(TARGET ${arg_NAME} + APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) + SET_PROPERTY(TARGET ${arg_NAME} + APPEND PROPERTY + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + endif() endif() endif() @@ -515,7 +524,7 @@ macro(blt_import_library) string(TOLOWER ${lib_ext} lowercase_ext) get_filename_component(lib_file_name "${lib_name}" NAME_WE) - set(subtarget_name "${arg_NAME}_${lib_file_name}_subtarget") + set(subtarget_name "_${arg_NAME}_${lib_file_name}_subtarget") # Check for static or dynamic library if (lowercase_ext MATCHES "\.(lib|a)$") @@ -532,7 +541,7 @@ macro(blt_import_library) endforeach() # Add all imported targets to a single interface target - add_library(${arg_NAME} INTERFACE) + add_library(${arg_NAME} INTERFACE IMPORTED GLOBAL) target_link_libraries(${arg_NAME} INTERFACE ${imported_subtargets}) blt_patch_target( From ea70bf8793486d104eee20463c7d9dbf2a555bd3 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 4 Nov 2020 11:57:59 -0600 Subject: [PATCH 065/330] fix: remove required library parameter to allow for openMP --- cmake/BLTMacros.cmake | 3 --- cmake/thirdparty/SetupOpenMP.cmake | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 8ffda138b..31cbffa6f 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -510,9 +510,6 @@ macro(blt_import_library) if( "${arg_NAME}" STREQUAL "" ) message(FATAL_ERROR "blt_import_library() must be called with argument NAME ") endif() - if( "${arg_LIBRARIES}" STREQUAL "" ) - message(FATAL_ERROR "blt_import_library() must be called with argument LIBRARIES [lib1 [lib2 ...]]") - endif() set(imported_subtargets "") diff --git a/cmake/thirdparty/SetupOpenMP.cmake b/cmake/thirdparty/SetupOpenMP.cmake index 1d7b617e8..d0f0603a6 100644 --- a/cmake/thirdparty/SetupOpenMP.cmake +++ b/cmake/thirdparty/SetupOpenMP.cmake @@ -52,6 +52,6 @@ endif() message(STATUS "OpenMP Compile Flags: ${_compile_flags}") message(STATUS "OpenMP Link Flags: ${_link_flags}") -blt_register_library(NAME openmp - COMPILE_FLAGS ${_compile_flags} - LINK_FLAGS ${_link_flags}) +blt_import_library(NAME openmp + COMPILE_FLAGS ${_compile_flags} + LINK_FLAGS ${_link_flags}) From 01842090cd9b291d0a48d5faa3673f81a5fd4134 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 08:39:17 -0600 Subject: [PATCH 066/330] docs: first cut of documentation for import_library --- cmake/BLTMacros.cmake | 122 +----------------------- cmake/BLTPrivateMacros.cmake | 94 ++++++++++++++++++ docs/api/target.rst | 33 +++++++ docs/tutorial/external_dependencies.rst | 10 +- 4 files changed, 139 insertions(+), 120 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 31cbffa6f..f62abc190 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -389,96 +389,6 @@ macro(blt_register_library) endmacro(blt_register_library) -##------------------------------------------------------------------------------ -## blt_patch_target( NAME -## DEPENDS_ON [dep1 [dep2 ...]] -## INCLUDES [include1 [include2 ...]] -## LIBRARIES [lib1 [lib2 ...]] -## TREAT_INCLUDES_AS_SYSTEM [ON|OFF] -## FORTRAN_MODULES [ path1 [ path2 ..]] -## COMPILE_FLAGS [ flag1 [ flag2 ..]] -## LINK_FLAGS [ flag1 [ flag2 ..]] -## DEFINES [def1 [def2 ...]] ) -## -## Modifies an existing CMake target -##------------------------------------------------------------------------------ -macro(blt_patch_target) - set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) - set(multiValueArgs INCLUDES - DEPENDS_ON - LIBRARIES - # FIXME: FORTRAN_MODULES - COMPILE_FLAGS - LINK_FLAGS - DEFINES ) - - ## parse the arguments - cmake_parse_arguments(arg - "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) - - # Input checks - if( "${arg_NAME}" STREQUAL "" ) - message(FATAL_ERROR "blt_patch_target() must be called with argument NAME ") - endif() - - # Things that need to go into target_link_libraries - set(libs_to_link "") - - if( arg_LIBRARIES ) - message(STATUS "adding libs ${arg_LIBRARIES}") - list(APPEND libs_to_link ${arg_LIBRARIES}) - endif() - - # TODO: This won't expand BLT-registered libraries - if( arg_DEPENDS_ON ) - message(STATUS "adding depends ${arg_DEPENDS_ON}") - list(APPEND libs_to_link ${arg_DEPENDS_ON}) - endif() - - target_link_libraries(${arg_NAME} INTERFACE ${libs_to_link}) - - if( arg_INCLUDES ) - if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) - target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) - # PGI does not support -isystem - if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - get_target_property(all_include_dirs ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(${arg_NAME} SYSTEM INTERFACE ${all_include_dirs}) - endif() - else() - # Interface include directories need to be set manually - SET_PROPERTY(TARGET ${arg_NAME} - APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) - # PGI does not support -isystem - if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - SET_PROPERTY(TARGET ${arg_NAME} - APPEND PROPERTY - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) - endif() - endif() - endif() - - if( arg_COMPILE_FLAGS ) - blt_add_target_compile_flags(TO ${arg_NAME} - SCOPE INTERFACE - FLAGS ${arg_COMPILE_FLAGS}) - endif() - - if( arg_LINK_FLAGS ) - blt_add_target_link_flags(TO ${arg_NAME} - SCOPE INTERFACE - FLAGS ${arg_LINK_FLAGS}) - endif() - - if( arg_DEFINES ) - blt_add_target_definitions(TO ${arg_NAME} - SCOPE INTERFACE - TARGET_DEFINITIONS ${arg_DEFINES}) - endif() - -endmacro(blt_patch_target) - ##------------------------------------------------------------------------------ ## blt_import_library( NAME ## LIBRARIES [lib1 [lib2 ...]] @@ -511,38 +421,14 @@ macro(blt_import_library) message(FATAL_ERROR "blt_import_library() must be called with argument NAME ") endif() - set(imported_subtargets "") - - # For each library (shared or static), build an imported target - foreach(lib_name ${arg_LIBRARIES}) - # Check if it's a file - if (EXISTS "${lib_name}") - get_filename_component(lib_ext "${lib_name}" EXT) - string(TOLOWER ${lib_ext} lowercase_ext) - - get_filename_component(lib_file_name "${lib_name}" NAME_WE) - set(subtarget_name "_${arg_NAME}_${lib_file_name}_subtarget") - - # Check for static or dynamic library - if (lowercase_ext MATCHES "\.(lib|a)$") - add_library(${subtarget_name} STATIC IMPORTED) - else() - add_library(${subtarget_name} SHARED IMPORTED) - endif() - set_target_properties(${subtarget_name} PROPERTIES IMPORTED_LOCATION "${lib_name}") - list(APPEND imported_subtargets ${subtarget_name}) - else() - # Otherwise it's a target or linker flag - list(APPEND imported_subtargets ${lib_name}) - endif() - endforeach() - # Add all imported targets to a single interface target - add_library(${arg_NAME} INTERFACE IMPORTED GLOBAL) - target_link_libraries(${arg_NAME} INTERFACE ${imported_subtargets}) + add_library(${arg_NAME} INTERFACE) + # This is a separate function as patching a target may later be useful in other contexts + # in which case it should be converted to a public macro blt_patch_target( NAME ${arg_NAME} + LIBRARIES ${arg_LIBRARIES} DEPENDS_ON ${arg_DEPENDS_ON} INCLUDES ${arg_INCLUDES} DEFINES ${arg_DEFINES} diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 5db9712e2..786e50b4d 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -433,6 +433,100 @@ macro(blt_setup_cuda_target) endif() endmacro(blt_setup_cuda_target) +##------------------------------------------------------------------------------ +## blt_patch_target( NAME +## DEPENDS_ON [dep1 [dep2 ...]] +## INCLUDES [include1 [include2 ...]] +## LIBRARIES [lib1 [lib2 ...]] +## TREAT_INCLUDES_AS_SYSTEM [ON|OFF] +## FORTRAN_MODULES [ path1 [ path2 ..]] +## COMPILE_FLAGS [ flag1 [ flag2 ..]] +## LINK_FLAGS [ flag1 [ flag2 ..]] +## DEFINES [def1 [def2 ...]] ) +## +## Modifies an existing CMake target +##------------------------------------------------------------------------------ +macro(blt_patch_target) + set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) + set(multiValueArgs INCLUDES + DEPENDS_ON + LIBRARIES + # FIXME: FORTRAN_MODULES + COMPILE_FLAGS + LINK_FLAGS + DEFINES ) + + ## parse the arguments + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # Input checks + if( "${arg_NAME}" STREQUAL "" ) + message(FATAL_ERROR "blt_patch_target() must be called with argument NAME ") + endif() + + if (NOT TARGET ${arg_NAME}) + message(FATAL_ERROR "blt_patch_target() NAME argument must be a native CMake target") + endif() + + # Things that need to go into target_link_libraries + set(libs_to_link "") + + if( arg_LIBRARIES ) + message(STATUS "adding libs ${arg_LIBRARIES}") + list(APPEND libs_to_link ${arg_LIBRARIES}) + endif() + + # TODO: This won't expand BLT-registered libraries + if( arg_DEPENDS_ON ) + message(STATUS "adding depends ${arg_DEPENDS_ON}") + list(APPEND libs_to_link ${arg_DEPENDS_ON}) + endif() + + target_link_libraries(${arg_NAME} INTERFACE ${libs_to_link}) + + if( arg_INCLUDES ) + if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) + target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) + get_target_property(all_include_dirs ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(${arg_NAME} SYSTEM INTERFACE ${all_include_dirs}) + endif() + else() + # Interface include directories need to be set manually + SET_PROPERTY(TARGET ${arg_NAME} + APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) + SET_PROPERTY(TARGET ${arg_NAME} + APPEND PROPERTY + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + endif() + endif() + endif() + + if( arg_COMPILE_FLAGS ) + blt_add_target_compile_flags(TO ${arg_NAME} + SCOPE INTERFACE + FLAGS ${arg_COMPILE_FLAGS}) + endif() + + if( arg_LINK_FLAGS ) + blt_add_target_link_flags(TO ${arg_NAME} + SCOPE INTERFACE + FLAGS ${arg_LINK_FLAGS}) + endif() + + if( arg_DEFINES ) + blt_add_target_definitions(TO ${arg_NAME} + SCOPE INTERFACE + TARGET_DEFINITIONS ${arg_DEFINES}) + endif() + +endmacro(blt_patch_target) + ##------------------------------------------------------------------------------ ## blt_add_hip_library(NAME ## SOURCES [source1 [source2 ...]] diff --git a/docs/api/target.rst b/docs/api/target.rst index 1927292a4..ddf274735 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -355,3 +355,36 @@ Internally created variables (NAME = "foo"): Internal variable names are prefixed with ``_`` to avoid collision with input parameters. +.. _blt_import_library: + +blt_import_library +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + blt_import_library( NAME + DEPENDS_ON [dep1 [dep2 ...]] + INCLUDES [include1 [include2 ...]] + TREAT_INCLUDES_AS_SYSTEM [ON|OFF] + FORTRAN_MODULES [path1 [path2 ..]] + LIBRARIES [lib1 [lib2 ...]] + COMPILE_FLAGS [flag1 [flag2 ..]] + LINK_FLAGS [flag1 [flag2 ..]] + DEFINES [def1 [def2 ...]] ) + +Creates a CMake library target from a list of existing library files or targets. + +This behaves similarly to :ref:`blt_register_library`, but because it defines +a native CMake target, no internal variable names are defined. This means that it +is usable in contexts other than those that specifically accept BLT-registered +libraries. + +As with BLT-registered libraries, it can be added to the DEPENDS_ON parameter +when building another target or to ``target_link_libraries`` to transitively add in +all includes, libraries, flags, and definitions associated with the imported library. + +See :ref:`blt_register_library` and :ref:`_blt_add_library` for a full description +of this macro's parameters. + +This does not actually build a library. This is strictly to ease use after +discovering it on your system or building it yourself inside your project. diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 9f3d30c3d..a8aea71ab 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -36,9 +36,15 @@ Then *axom* is available to be used in the DEPENDS_ON list in the following This is especially helpful for external libraries that are not built with CMake and don't provide CMake-friendly imported targets. Our ultimate goal is to use ``blt_register_library()`` -to import all external dependencies as first-class imported CMake targets to take full advanced of CMake's dependency lattice. +to import all external dependencies as first-class imported CMake targets to take full advantage of CMake's dependency lattice. -MPI, CUDA, and OpenMP are all registered via ``blt_register_library()``. +This first-class importing functionality is provided by ``blt_import_library()``, but ``blt_register_library()`` is +still available for compatibility. It is generally usable as a drop-in replacement, though it does not currently support +the FORTRAN_MODULES option. Because CMake targets are only accessible from within the directory they were defined (including +subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files +that create imported library targets needed in other directories. + +MPI, CUDA, and OpenMP are all registered via ``blt_import_library()``. You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. BLT also supports using ``blt_register_library()`` to provide additional options for existing CMake targets. From 83c2498ae9c0ff0bcf8d4f0404d42bfa28062d98 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 08:41:13 -0600 Subject: [PATCH 067/330] docs: note on OBJECT libraries --- cmake/BLTMacros.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index f62abc190..d474212ff 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -422,6 +422,8 @@ macro(blt_import_library) endif() # Add all imported targets to a single interface target + # Introducing OBJECT targets for each library file causes issues when exporting as + # dependencies are not transitively included in exports add_library(${arg_NAME} INTERFACE) # This is a separate function as patching a target may later be useful in other contexts From 851b027b1cf34a3fe5863c55c30d8807c8dd14d1 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 08:50:00 -0600 Subject: [PATCH 068/330] feat: tentative support for FORTRAN_MODULES parameter --- cmake/BLTMacros.cmake | 3 ++- cmake/BLTPrivateMacros.cmake | 7 ++++++- docs/api/target.rst | 2 +- docs/tutorial/external_dependencies.rst | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index d474212ff..841b6ca85 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -407,7 +407,7 @@ macro(blt_import_library) set(multiValueArgs LIBRARIES INCLUDES DEPENDS_ON - # FIXME: FORTRAN_MODULES + FORTRAN_MODULES COMPILE_FLAGS LINK_FLAGS DEFINES ) @@ -435,6 +435,7 @@ macro(blt_import_library) INCLUDES ${arg_INCLUDES} DEFINES ${arg_DEFINES} TREAT_INCLUDES_AS_SYSTEM ${arg_TREAT_INCLUDES_AS_SYSTEM} + FORTRAN_MODULES ${arg_FORTRAN_MODULES} COMPILE_FLAGS ${arg_COMPILE_FLAGS} LINK_FLAGS ${arg_LINK_FLAGS} DEFINES ${arg_DEFINES} diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 786e50b4d..0aa0e25a0 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -451,7 +451,7 @@ macro(blt_patch_target) set(multiValueArgs INCLUDES DEPENDS_ON LIBRARIES - # FIXME: FORTRAN_MODULES + FORTRAN_MODULES COMPILE_FLAGS LINK_FLAGS DEFINES ) @@ -507,6 +507,11 @@ macro(blt_patch_target) endif() endif() + # FIXME: Is this all that's needed? + if( arg_FORTRAN_MODULES ) + target_include_directories(${arg_NAME} INTERFACE ${arg_FORTRAN_MODULES}) + endif() + if( arg_COMPILE_FLAGS ) blt_add_target_compile_flags(TO ${arg_NAME} SCOPE INTERFACE diff --git a/docs/api/target.rst b/docs/api/target.rst index ddf274735..4e93029ed 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -377,7 +377,7 @@ Creates a CMake library target from a list of existing library files or targets. This behaves similarly to :ref:`blt_register_library`, but because it defines a native CMake target, no internal variable names are defined. This means that it is usable in contexts other than those that specifically accept BLT-registered -libraries. +libraries, and can take full advantage of CMake's transitive dependency resolution. As with BLT-registered libraries, it can be added to the DEPENDS_ON parameter when building another target or to ``target_link_libraries`` to transitively add in diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index a8aea71ab..a3e86aa14 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -39,9 +39,9 @@ and don't provide CMake-friendly imported targets. Our ultimate goal is to use ` to import all external dependencies as first-class imported CMake targets to take full advantage of CMake's dependency lattice. This first-class importing functionality is provided by ``blt_import_library()``, but ``blt_register_library()`` is -still available for compatibility. It is generally usable as a drop-in replacement, though it does not currently support -the FORTRAN_MODULES option. Because CMake targets are only accessible from within the directory they were defined (including -subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files +still available for compatibility. It is generally usable as a drop-in replacement. +Because CMake targets are only accessible from within the directory they were defined (including subdirectories), +the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files that create imported library targets needed in other directories. MPI, CUDA, and OpenMP are all registered via ``blt_import_library()``. From 0110d193b93c08569c3dcf93690bcdc1241c2653 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 08:55:18 -0600 Subject: [PATCH 069/330] fix: only change one of interface include dirs/interface system include dirs --- cmake/BLTPrivateMacros.cmake | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 0aa0e25a0..768fc600f 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -487,22 +487,23 @@ macro(blt_patch_target) if( arg_INCLUDES ) if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) - target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - get_target_property(all_include_dirs ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(${arg_NAME} SYSTEM INTERFACE ${all_include_dirs}) + target_include_directories(${arg_NAME} SYSTEM INTERFACE ${arg_INCLUDES}) + else() + target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) endif() else() - # Interface include directories need to be set manually - SET_PROPERTY(TARGET ${arg_NAME} - APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + # Interface include directories need to be set manually in CMake < 3.11 # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) SET_PROPERTY(TARGET ${arg_NAME} - APPEND PROPERTY - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + APPEND PROPERTY + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + else() + SET_PROPERTY(TARGET ${arg_NAME} + APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) endif() endif() endif() From 553361dcfbe65d603edca208ceff7f1f0d361d44 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 09:23:02 -0600 Subject: [PATCH 070/330] fix: interface include directories must always be set --- cmake/BLTPrivateMacros.cmake | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 768fc600f..138db7008 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -487,23 +487,21 @@ macro(blt_patch_target) if( arg_INCLUDES ) if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) + target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) target_include_directories(${arg_NAME} SYSTEM INTERFACE ${arg_INCLUDES}) - else() - target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) endif() else() - # Interface include directories need to be set manually in CMake < 3.11 + # Interface include directories need to be set manually + SET_PROPERTY(TARGET ${arg_NAME} + APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) SET_PROPERTY(TARGET ${arg_NAME} - APPEND PROPERTY - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) - else() - SET_PROPERTY(TARGET ${arg_NAME} - APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + APPEND PROPERTY + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) endif() endif() endif() From d476263193a796c352320829cd236346a99d9d7e Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 09:52:57 -0600 Subject: [PATCH 071/330] fix: link dependencies when possible --- cmake/BLTPrivateMacros.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 138db7008..62b2a26b9 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -353,6 +353,12 @@ macro(blt_setup_target) FLAGS ${_BLT_${uppercase_dependency}_LINK_FLAGS} ) endif() + # If the expanded dependency is a real target, link it + # TODO: Won't need to skip BLT object libraries once 3.12 changes pulled in + if (TARGET ${dependency} AND NOT _BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY) + target_link_libraries(${arg_NAME} PUBLIC ${dependency}) + endif() + endforeach() endmacro(blt_setup_target) @@ -473,13 +479,11 @@ macro(blt_patch_target) set(libs_to_link "") if( arg_LIBRARIES ) - message(STATUS "adding libs ${arg_LIBRARIES}") list(APPEND libs_to_link ${arg_LIBRARIES}) endif() # TODO: This won't expand BLT-registered libraries if( arg_DEPENDS_ON ) - message(STATUS "adding depends ${arg_DEPENDS_ON}") list(APPEND libs_to_link ${arg_DEPENDS_ON}) endif() From de0e1cffbc42b8a907ca8c21698cf79517ebcb33 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 10:14:03 -0600 Subject: [PATCH 072/330] fix: also propagate compile/link flags --- cmake/BLTPrivateMacros.cmake | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 62b2a26b9..6f22f239f 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -228,6 +228,20 @@ macro(blt_inherit_target_info) target_compile_definitions( ${arg_TO} PUBLIC ${_interface_defines}) endif() + if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) + get_target_property(_interface_link_options + ${arg_FROM} INTERFACE_LINK_OPTIONS) + if ( _interface_link_options ) + target_link_options( ${arg_TO} PUBLIC ${_interface_link_options}) + endif() + endif() + + get_target_property(_interface_compile_options + ${arg_FROM} INTERFACE_COMPILE_OPTIONS) + if ( _interface_compile_options ) + target_compile_options( ${arg_TO} PUBLIC ${_interface_compile_options}) + endif() + if ( NOT arg_OBJECT ) get_target_property(_interface_link_directories ${arg_FROM} INTERFACE_LINK_DIRECTORIES) @@ -352,13 +366,6 @@ macro(blt_setup_target) blt_add_target_link_flags(TO ${arg_NAME} FLAGS ${_BLT_${uppercase_dependency}_LINK_FLAGS} ) endif() - - # If the expanded dependency is a real target, link it - # TODO: Won't need to skip BLT object libraries once 3.12 changes pulled in - if (TARGET ${dependency} AND NOT _BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY) - target_link_libraries(${arg_NAME} PUBLIC ${dependency}) - endif() - endforeach() endmacro(blt_setup_target) From aeeb635e53ab00ed9f120ffb4c4bb65bd5dd2333 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 10:52:49 -0600 Subject: [PATCH 073/330] fix: cmake < 3.13 doesn't have LINK_FLAGS for interface libraries --- cmake/BLTPrivateMacros.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 6f22f239f..2043961eb 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -92,8 +92,9 @@ endfunction() function(blt_fix_fortran_openmp_flags target_name) if (ENABLE_FORTRAN AND ENABLE_OPENMP AND BLT_OPENMP_FLAGS_DIFFER) - - set(_property_name LINK_FLAGS) + # OpenMP is an interface library which doesn't have a LINK_FLAGS property + # in versions < 3.13 + set(_property_name INTERFACE_LINK_LIBRARIES) if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) # In CMake 3.13+, LINK_FLAGS was converted to LINK_OPTIONS. set(_property_name LINK_OPTIONS) From 725cdbba6ef6616e51cfd638749ec81a115f2fe1 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 5 Nov 2020 11:07:27 -0600 Subject: [PATCH 074/330] debug: add prints --- cmake/BLTPrivateMacros.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 2043961eb..88acb5709 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -104,12 +104,14 @@ function(blt_fix_fortran_openmp_flags target_name) if ( target_link_flags ) message(STATUS "Fixing OpenMP Flags for target[${target_name}]") + message(STATUS "Detected link flags are: ${target_link_flags}") + message(STATUS "Replacing ${OpenMP_CXX_FLAGS} with ${OpenMP_Fortran_FLAGS}") string( REPLACE "${OpenMP_CXX_FLAGS}" "${OpenMP_Fortran_FLAGS}" correct_link_flags "${target_link_flags}" ) - + message(STATUS "Fixed link flags are: ${correct_link_flags}") set_target_properties( ${target_name} PROPERTIES ${_property_name} "${correct_link_flags}" ) endif() From 489ab84113c27738784e68fbb65d04f5f2f86a43 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Fri, 6 Nov 2020 08:20:51 -0600 Subject: [PATCH 075/330] fix: attempt to patch blt_fix_fortran_openmp_flags --- cmake/BLTPrivateMacros.cmake | 41 ++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 88acb5709..f3878c34d 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -102,18 +102,37 @@ function(blt_fix_fortran_openmp_flags target_name) get_target_property(target_link_flags ${target_name} ${_property_name}) if ( target_link_flags ) + # Since this is only called on executable targets we can safely convert + # from a "real" target back to a "fake" one as this is a sink vertex in + # the DAG. Only the link flags need to be modified. + list(FIND target_link_flags "openmp" _omp_index) + if(${_omp_index} GREATER -1) + message(STATUS "Fixing OpenMP Flags for target[${target_name}]") + message(STATUS "Detected link flags are: ${target_link_flags}") + message(STATUS "Replacing ${OpenMP_CXX_FLAGS} with ${OpenMP_Fortran_FLAGS}") + list(REMOVE_ITEM target_link_flags "openmp") + # Copy the compile flags verbatim + get_target_property(omp_compile_flags openmp INTERFACE_COMPILE_OPTIONS) + target_compile_options(${target_name} ${omp_compile_flags}) + + # These are set through blt_add_target_link_flags which needs to use + # the link_options for interface libraries in CMake < 3.13 + if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) + get_target_property(omp_link_flags openmp INTERFACE_LINK_OPTIONS) + else() + get_target_property(omp_link_flags openmp INTERFACE_LINK_LIBRARIES) + endif() + + string( REPLACE "${OpenMP_CXX_FLAGS}" "${OpenMP_Fortran_FLAGS}" + correct_omp_link_flags + "${omp_link_flags}" + ) + list(APPEND target_link_flags "${correct_omp_link_flags}") + message(STATUS "Fixed link flags are: ${target_link_flags}") + set_target_properties( ${target_name} PROPERTIES ${_property_name} + "${target_link_flags}" ) + endif() - message(STATUS "Fixing OpenMP Flags for target[${target_name}]") - message(STATUS "Detected link flags are: ${target_link_flags}") - message(STATUS "Replacing ${OpenMP_CXX_FLAGS} with ${OpenMP_Fortran_FLAGS}") - - string( REPLACE "${OpenMP_CXX_FLAGS}" "${OpenMP_Fortran_FLAGS}" - correct_link_flags - "${target_link_flags}" - ) - message(STATUS "Fixed link flags are: ${correct_link_flags}") - set_target_properties( ${target_name} PROPERTIES ${_property_name} - "${correct_link_flags}" ) endif() endif() From bc2d0028b2db5c471a36fe75eb70a690497a2cfb Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Fri, 6 Nov 2020 09:19:05 -0600 Subject: [PATCH 076/330] fix: proper compile options call --- cmake/BLTPrivateMacros.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index f3878c34d..cd955b0f2 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -111,9 +111,10 @@ function(blt_fix_fortran_openmp_flags target_name) message(STATUS "Detected link flags are: ${target_link_flags}") message(STATUS "Replacing ${OpenMP_CXX_FLAGS} with ${OpenMP_Fortran_FLAGS}") list(REMOVE_ITEM target_link_flags "openmp") + # Copy the compile flags verbatim get_target_property(omp_compile_flags openmp INTERFACE_COMPILE_OPTIONS) - target_compile_options(${target_name} ${omp_compile_flags}) + target_compile_options(${target_name} PUBLIC ${omp_compile_flags}) # These are set through blt_add_target_link_flags which needs to use # the link_options for interface libraries in CMake < 3.13 From 6c4be673eafe9dd13104ce4a71402524cbfbb7ff Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 9 Nov 2020 08:04:26 -0600 Subject: [PATCH 077/330] debug: print compile flags as well --- cmake/BLTPrivateMacros.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index cd955b0f2..35b10f40a 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -114,6 +114,7 @@ function(blt_fix_fortran_openmp_flags target_name) # Copy the compile flags verbatim get_target_property(omp_compile_flags openmp INTERFACE_COMPILE_OPTIONS) + message(STATUS "Setting compile flags to (verbatim): ${omp_compile_flags}") target_compile_options(${target_name} PUBLIC ${omp_compile_flags}) # These are set through blt_add_target_link_flags which needs to use From fde058e4d4878ec8ecaa86a59a3565c52304c9cc Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 9 Nov 2020 16:16:49 -0600 Subject: [PATCH 078/330] fix: use full LINK_LIBRARIES as property to set --- cmake/BLTPrivateMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 35b10f40a..afa999a62 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -94,7 +94,7 @@ function(blt_fix_fortran_openmp_flags target_name) if (ENABLE_FORTRAN AND ENABLE_OPENMP AND BLT_OPENMP_FLAGS_DIFFER) # OpenMP is an interface library which doesn't have a LINK_FLAGS property # in versions < 3.13 - set(_property_name INTERFACE_LINK_LIBRARIES) + set(_property_name LINK_LIBRARIES) if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) # In CMake 3.13+, LINK_FLAGS was converted to LINK_OPTIONS. set(_property_name LINK_OPTIONS) From af8a3086086ee7ba28a7e88e34d5b63bdad7c4c7 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 9 Nov 2020 16:30:03 -0600 Subject: [PATCH 079/330] debug: remove debug messages --- cmake/BLTPrivateMacros.cmake | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index afa999a62..0f7a9b230 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -92,33 +92,23 @@ endfunction() function(blt_fix_fortran_openmp_flags target_name) if (ENABLE_FORTRAN AND ENABLE_OPENMP AND BLT_OPENMP_FLAGS_DIFFER) - # OpenMP is an interface library which doesn't have a LINK_FLAGS property - # in versions < 3.13 - set(_property_name LINK_LIBRARIES) - if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) - # In CMake 3.13+, LINK_FLAGS was converted to LINK_OPTIONS. - set(_property_name LINK_OPTIONS) - endif() - - get_target_property(target_link_flags ${target_name} ${_property_name}) - if ( target_link_flags ) + # The OpenMP interface library will have been added as a direct + # link dependency instead of via flags + get_target_property(target_link_libs ${target_name} LINK_LIBRARIES) + if ( target_link_libs ) # Since this is only called on executable targets we can safely convert # from a "real" target back to a "fake" one as this is a sink vertex in # the DAG. Only the link flags need to be modified. - list(FIND target_link_flags "openmp" _omp_index) + list(FIND target_link_libs "openmp" _omp_index) if(${_omp_index} GREATER -1) - message(STATUS "Fixing OpenMP Flags for target[${target_name}]") - message(STATUS "Detected link flags are: ${target_link_flags}") - message(STATUS "Replacing ${OpenMP_CXX_FLAGS} with ${OpenMP_Fortran_FLAGS}") - list(REMOVE_ITEM target_link_flags "openmp") + list(REMOVE_ITEM target_link_libs "openmp") # Copy the compile flags verbatim get_target_property(omp_compile_flags openmp INTERFACE_COMPILE_OPTIONS) - message(STATUS "Setting compile flags to (verbatim): ${omp_compile_flags}") target_compile_options(${target_name} PUBLIC ${omp_compile_flags}) # These are set through blt_add_target_link_flags which needs to use - # the link_options for interface libraries in CMake < 3.13 + # the link_libraries for interface libraries in CMake < 3.13 if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) get_target_property(omp_link_flags openmp INTERFACE_LINK_OPTIONS) else() @@ -129,10 +119,9 @@ function(blt_fix_fortran_openmp_flags target_name) correct_omp_link_flags "${omp_link_flags}" ) - list(APPEND target_link_flags "${correct_omp_link_flags}") - message(STATUS "Fixed link flags are: ${target_link_flags}") - set_target_properties( ${target_name} PROPERTIES ${_property_name} - "${target_link_flags}" ) + list(APPEND target_link_libs "${correct_omp_link_flags}") + set_target_properties( ${target_name} PROPERTIES + LINK_LIBRARIES "${target_link_libs}" ) endif() endif() From 3d882bfcaf088741878e66e85a0ccec5d377420a Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 10 Nov 2020 08:37:02 -0600 Subject: [PATCH 080/330] fix: lowercase CMake commands --- cmake/BLTPrivateMacros.cmake | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 0f7a9b230..fbc77e131 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -470,7 +470,7 @@ endmacro(blt_setup_cuda_target) ## LINK_FLAGS [ flag1 [ flag2 ..]] ## DEFINES [def1 [def2 ...]] ) ## -## Modifies an existing CMake target +## Modifies an existing CMake target - currently only sets INTERFACE visibility ##------------------------------------------------------------------------------ macro(blt_patch_target) set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) @@ -495,20 +495,17 @@ macro(blt_patch_target) message(FATAL_ERROR "blt_patch_target() NAME argument must be a native CMake target") endif() - # Things that need to go into target_link_libraries - set(libs_to_link "") - + # LIBRARIES and DEPENDS_ON are kept separate in case different logic is needed for + # the library itself versus its dependencies if( arg_LIBRARIES ) - list(APPEND libs_to_link ${arg_LIBRARIES}) + target_link_libraries(${arg_NAME} INTERFACE ${arg_LIBRARIES}) endif() # TODO: This won't expand BLT-registered libraries if( arg_DEPENDS_ON ) - list(APPEND libs_to_link ${arg_DEPENDS_ON}) + target_link_libraries(${arg_NAME} INTERFACE ${arg_DEPENDS_ON}) endif() - target_link_libraries(${arg_NAME} INTERFACE ${libs_to_link}) - if( arg_INCLUDES ) if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) @@ -518,12 +515,12 @@ macro(blt_patch_target) endif() else() # Interface include directories need to be set manually - SET_PROPERTY(TARGET ${arg_NAME} + set_property(TARGET ${arg_NAME} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - SET_PROPERTY(TARGET ${arg_NAME} + set_property(TARGET ${arg_NAME} APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) endif() From 526cd65025d7e43e3eeccf47783a18b539eb11c1 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 08:42:18 -0600 Subject: [PATCH 081/330] docs: cleanup section on blt_register --- docs/api/target.rst | 32 ++++++++++++++++++++++--- docs/tutorial/external_dependencies.rst | 31 +++++++++++++----------- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/docs/api/target.rst b/docs/api/target.rst index ddf274735..47db3553c 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -374,6 +374,35 @@ blt_import_library Creates a CMake library target from a list of existing library files or targets. +NAME + Name of the created CMake target + +DEPENDS_ON + List of CMake targets that this library depends on + +INCLUDES + List of include directories to be inherited by dependent targets + +TREAT_INCLUDES_AS_SYSTEM + Whether to inform the compiler to treat this library's include paths + as system headers + +FORTRAN_MODULES + FORTRAN module directories to be inherited by dependent targets + +LIBRARIES + List of CMake targets and library files (.a/.so/.lib/.dll) that make up + this library + +COMPILE_FLAGS + List of compiler flags to be inherited by dependent targets + +LINK_FLAGS + List of linker flags to be inherited by dependent targets + +DEFINES + List of compiler defines to be inherited by dependent targets + This behaves similarly to :ref:`blt_register_library`, but because it defines a native CMake target, no internal variable names are defined. This means that it is usable in contexts other than those that specifically accept BLT-registered @@ -383,8 +412,5 @@ As with BLT-registered libraries, it can be added to the DEPENDS_ON parameter when building another target or to ``target_link_libraries`` to transitively add in all includes, libraries, flags, and definitions associated with the imported library. -See :ref:`blt_register_library` and :ref:`_blt_add_library` for a full description -of this macro's parameters. - This does not actually build a library. This is strictly to ease use after discovering it on your system or building it yourself inside your project. diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index a8aea71ab..cf15cf73b 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -12,35 +12,38 @@ To accomplish this BLT provides a ``DEPENDS_ON`` option for the ``blt_add_library()`` and ``blt_add_executable()`` macros that supports both CMake targets and external dependencies registered using the ``blt_register_library()`` macro. -The ``blt_register_library()`` macro allows you to reuse all information needed +The ``blt_import_library()`` macro allows you to reuse all information needed for an external dependency under a single name. This includes any include directories, libraries, compile flags, link flags, defines, etc. You can also hide any warnings created by their headers by setting the ``TREAT_INCLUDES_AS_SYSTEM`` argument. -For example, to find and register the external dependency *axom* as a BLT registered library, you can simply use: +For example, to find and register the external dependency *axom* as a CMake target, you can simply use: .. code-block:: cmake # FindAxom.cmake takes in AXOM_DIR, which is a installed Axom build and # sets variables AXOM_INCLUDES, AXOM_LIBRARIES include(FindAxom.cmake) - blt_register_library(NAME axom - TREAT_INCLUDES_AS_SYSTEM ON - DEFINES HAVE_AXOM=1 - INCLUDES ${AXOM_INCLUDES} - LIBRARIES ${AXOM_LIBRARIES}) + blt_import_library(NAME axom + TREAT_INCLUDES_AS_SYSTEM ON + DEFINES HAVE_AXOM=1 + INCLUDES ${AXOM_INCLUDES} + LIBRARIES ${AXOM_LIBRARIES}) Then *axom* is available to be used in the DEPENDS_ON list in the following -``blt_add_executable()`` or ``blt_add_library()`` calls. +``blt_add_executable()`` or ``blt_add_library()`` calls, or in any CMake command that accepts a target. +CMake targets created by ``blt_import_library()`` are ``INTERFACE`` libraries that can be installed +and exported. -This is especially helpful for external libraries that are not built with CMake -and don't provide CMake-friendly imported targets. Our ultimate goal is to use ``blt_register_library()`` -to import all external dependencies as first-class imported CMake targets to take full advantage of CMake's dependency lattice. +This is especially helpful for "converting" external libraries that are not built with CMake +into CMake-friendly imported targets. -This first-class importing functionality is provided by ``blt_import_library()``, but ``blt_register_library()`` is -still available for compatibility. It is generally usable as a drop-in replacement, though it does not currently support -the FORTRAN_MODULES option. Because CMake targets are only accessible from within the directory they were defined (including +This first-class importing functionality provided by ``blt_import_library()`` should be preferred, but ``blt_register_library()`` is +still available for compatibility. It is generally usable as a drop-in replacement, though it does not support the creation +of targets with the same name as a target that already exists. + +Because CMake targets are only accessible from within the directory they were defined (including subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files that create imported library targets needed in other directories. From e63108507f3467f21c2a3409ebdeedc9e7e36c75 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 14:01:17 -0600 Subject: [PATCH 082/330] docs: move + document blt_patch_target, rephrase description of blt_import_target --- RELEASE-NOTES.md | 3 + cmake/BLTMacros.cmake | 96 ++++++++++++++- cmake/BLTPrivateMacros.cmake | 93 --------------- docs/api/target.rst | 152 +++++++++++++++++------- docs/tutorial/external_dependencies.rst | 23 ++-- 5 files changed, 217 insertions(+), 150 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index a34d0f1ec..6b9ef9d79 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -22,6 +22,9 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ``BLT_REQUIRED_ASTYLE_VERSION``, ``BLT_REQUIRED_CLANGFORMAT_VERSION``, and ``BLT_REQUIRED_UNCRUSTIFY_VERSION`` - Added ``HEADERS`` to ``blt_add_executable``. This is important for build system dependency tracking and IDE folder support. +- Added new ``blt_import_library`` macro that creates a real CMake target for imported libraries, + intended to be used instead of ``blt_register_library`` whenever possible +- Added new ``blt_patch_target`` macro for modifying the properties of a CMake target in bulk ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 841b6ca85..ff807254e 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -389,6 +389,100 @@ macro(blt_register_library) endmacro(blt_register_library) +##------------------------------------------------------------------------------ +## blt_patch_target( NAME +## DEPENDS_ON [dep1 [dep2 ...]] +## INCLUDES [include1 [include2 ...]] +## LIBRARIES [lib1 [lib2 ...]] +## TREAT_INCLUDES_AS_SYSTEM [ON|OFF] +## FORTRAN_MODULES [ path1 [ path2 ..]] +## COMPILE_FLAGS [ flag1 [ flag2 ..]] +## LINK_FLAGS [ flag1 [ flag2 ..]] +## DEFINES [def1 [def2 ...]] ) +## +## Modifies an existing CMake target - currently only sets INTERFACE visibility +##------------------------------------------------------------------------------ +macro(blt_patch_target) + set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) + set(multiValueArgs INCLUDES + DEPENDS_ON + LIBRARIES + FORTRAN_MODULES + COMPILE_FLAGS + LINK_FLAGS + DEFINES ) + + ## parse the arguments + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # Input checks + if( "${arg_NAME}" STREQUAL "" ) + message(FATAL_ERROR "blt_patch_target() must be called with argument NAME ") + endif() + + if (NOT TARGET ${arg_NAME}) + message(FATAL_ERROR "blt_patch_target() NAME argument must be a native CMake target") + endif() + + # LIBRARIES and DEPENDS_ON are kept separate in case different logic is needed for + # the library itself versus its dependencies + if( arg_LIBRARIES ) + target_link_libraries(${arg_NAME} INTERFACE ${arg_LIBRARIES}) + endif() + + # TODO: This won't expand BLT-registered libraries + if( arg_DEPENDS_ON ) + target_link_libraries(${arg_NAME} INTERFACE ${arg_DEPENDS_ON}) + endif() + + if( arg_INCLUDES ) + if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) + target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) + get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(${arg_NAME} SYSTEM INTERFACE ${_target_includes}) + endif() + else() + # Interface include directories need to be set manually + set_property(TARGET ${arg_NAME} + APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) + get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) + set_target_properties(${arg_NAME} PROPERTIES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) + endif() + endif() + endif() + + # FIXME: Is this all that's needed? + if( arg_FORTRAN_MODULES ) + target_include_directories(${arg_NAME} INTERFACE ${arg_FORTRAN_MODULES}) + endif() + + if( arg_COMPILE_FLAGS ) + blt_add_target_compile_flags(TO ${arg_NAME} + SCOPE INTERFACE + FLAGS ${arg_COMPILE_FLAGS}) + endif() + + if( arg_LINK_FLAGS ) + blt_add_target_link_flags(TO ${arg_NAME} + SCOPE INTERFACE + FLAGS ${arg_LINK_FLAGS}) + endif() + + if( arg_DEFINES ) + blt_add_target_definitions(TO ${arg_NAME} + SCOPE INTERFACE + TARGET_DEFINITIONS ${arg_DEFINES}) + endif() + +endmacro(blt_patch_target) + ##------------------------------------------------------------------------------ ## blt_import_library( NAME ## LIBRARIES [lib1 [lib2 ...]] @@ -426,8 +520,6 @@ macro(blt_import_library) # dependencies are not transitively included in exports add_library(${arg_NAME} INTERFACE) - # This is a separate function as patching a target may later be useful in other contexts - # in which case it should be converted to a public macro blt_patch_target( NAME ${arg_NAME} LIBRARIES ${arg_LIBRARIES} diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index fbc77e131..7cd7c2dc3 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -459,99 +459,6 @@ macro(blt_setup_cuda_target) endif() endmacro(blt_setup_cuda_target) -##------------------------------------------------------------------------------ -## blt_patch_target( NAME -## DEPENDS_ON [dep1 [dep2 ...]] -## INCLUDES [include1 [include2 ...]] -## LIBRARIES [lib1 [lib2 ...]] -## TREAT_INCLUDES_AS_SYSTEM [ON|OFF] -## FORTRAN_MODULES [ path1 [ path2 ..]] -## COMPILE_FLAGS [ flag1 [ flag2 ..]] -## LINK_FLAGS [ flag1 [ flag2 ..]] -## DEFINES [def1 [def2 ...]] ) -## -## Modifies an existing CMake target - currently only sets INTERFACE visibility -##------------------------------------------------------------------------------ -macro(blt_patch_target) - set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) - set(multiValueArgs INCLUDES - DEPENDS_ON - LIBRARIES - FORTRAN_MODULES - COMPILE_FLAGS - LINK_FLAGS - DEFINES ) - - ## parse the arguments - cmake_parse_arguments(arg - "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) - - # Input checks - if( "${arg_NAME}" STREQUAL "" ) - message(FATAL_ERROR "blt_patch_target() must be called with argument NAME ") - endif() - - if (NOT TARGET ${arg_NAME}) - message(FATAL_ERROR "blt_patch_target() NAME argument must be a native CMake target") - endif() - - # LIBRARIES and DEPENDS_ON are kept separate in case different logic is needed for - # the library itself versus its dependencies - if( arg_LIBRARIES ) - target_link_libraries(${arg_NAME} INTERFACE ${arg_LIBRARIES}) - endif() - - # TODO: This won't expand BLT-registered libraries - if( arg_DEPENDS_ON ) - target_link_libraries(${arg_NAME} INTERFACE ${arg_DEPENDS_ON}) - endif() - - if( arg_INCLUDES ) - if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) - target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) - # PGI does not support -isystem - if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - target_include_directories(${arg_NAME} SYSTEM INTERFACE ${arg_INCLUDES}) - endif() - else() - # Interface include directories need to be set manually - set_property(TARGET ${arg_NAME} - APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) - # PGI does not support -isystem - if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - set_property(TARGET ${arg_NAME} - APPEND PROPERTY - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${arg_INCLUDES}) - endif() - endif() - endif() - - # FIXME: Is this all that's needed? - if( arg_FORTRAN_MODULES ) - target_include_directories(${arg_NAME} INTERFACE ${arg_FORTRAN_MODULES}) - endif() - - if( arg_COMPILE_FLAGS ) - blt_add_target_compile_flags(TO ${arg_NAME} - SCOPE INTERFACE - FLAGS ${arg_COMPILE_FLAGS}) - endif() - - if( arg_LINK_FLAGS ) - blt_add_target_link_flags(TO ${arg_NAME} - SCOPE INTERFACE - FLAGS ${arg_LINK_FLAGS}) - endif() - - if( arg_DEFINES ) - blt_add_target_definitions(TO ${arg_NAME} - SCOPE INTERFACE - TARGET_DEFINITIONS ${arg_DEFINES}) - endif() - -endmacro(blt_patch_target) - ##------------------------------------------------------------------------------ ## blt_add_hip_library(NAME ## SOURCES [source1 [source2 ...]] diff --git a/docs/api/target.rst b/docs/api/target.rst index cb3b3926a..dd5f6b53b 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -305,60 +305,69 @@ is always on in your build project. COMMAND my_test --with-some-argument) endif() +.. _blt_patch_target: -.. _blt_register_library: - -blt_register_library -~~~~~~~~~~~~~~~~~~~~ +blt_patch_target +~~~~~~~~~~~~~~~~ .. code-block:: cmake - blt_register_library( NAME - DEPENDS_ON [dep1 [dep2 ...]] - INCLUDES [include1 [include2 ...]] - TREAT_INCLUDES_AS_SYSTEM [ON|OFF] - FORTRAN_MODULES [path1 [path2 ..]] - LIBRARIES [lib1 [lib2 ...]] - COMPILE_FLAGS [flag1 [flag2 ..]] - LINK_FLAGS [flag1 [flag2 ..]] - DEFINES [def1 [def2 ...]] ) + blt_patch_target( NAME + DEPENDS_ON [dep1 [dep2 ...]] + INCLUDES [include1 [include2 ...]] + TREAT_INCLUDES_AS_SYSTEM [ON|OFF] + FORTRAN_MODULES [path1 [path2 ..]] + LIBRARIES [lib1 [lib2 ...]] + COMPILE_FLAGS [flag1 [flag2 ..]] + LINK_FLAGS [flag1 [flag2 ..]] + DEFINES [def1 [def2 ...]] ) -Registers a library to the project to ease use in other BLT macro calls. +Modifies the ``INTERFACE`` properties of an existing target. -Stores information about a library in a specific way that is easily recalled -in other macros. For example, after registering gtest, you can add gtest to -the DEPENDS_ON in your blt_add_executable call and it will add the INCLUDES -and LIBRARIES to that executable. +NAME + Name of the CMake target to patch -TREAT_INCLUDES_AS_SYSTEM informs the compiler to treat this library's include paths -as system headers. Only some compilers support this. This is useful if the headers -generate warnings you want to not have them reported in your build. This defaults -to OFF. +DEPENDS_ON + List of CMake targets that this target depends on -This does not actually build the library. This is strictly to ease use after -discovering it on your system or building it yourself inside your project. +INCLUDES + List of include directories to be inherited by dependent targets -Note: The OBJECT parameter is for internal BLT support for object libraries -and is not for users. Object libraries are created using blt_add_library(). +TREAT_INCLUDES_AS_SYSTEM + Whether to inform the compiler to treat this target's include paths + as system headers - this applies to all include paths for the target, + not just those specifies in the INCLUDES parameter. Only some + compilers support this. This is useful if the headers generate warnings + you want to not have them reported in your build. This defaults to OFF. -Internally created variables (NAME = "foo"): - | _BLT_FOO_IS_REGISTERED_LIBRARY - | _BLT_FOO_IS_OBJECT_LIBRARY - | _BLT_FOO_DEPENDS_ON - | _BLT_FOO_INCLUDES - | _BLT_FOO_TREAT_INCLUDES_AS_SYSTEM - | _BLT_FOO_FORTRAN_MODULES - | _BLT_FOO_LIBRARIES - | _BLT_FOO_COMPILE_FLAGS - | _BLT_FOO_LINK_FLAGS - | _BLT_FOO_DEFINES +FORTRAN_MODULES + FORTRAN module directories to be inherited by dependent targets -Internal variable names are prefixed with ``_`` to avoid collision with input parameters. +LIBRARIES + List of CMake targets and library files (.a/.so/.lib/.dll) that make up + this target, used for libraries + +COMPILE_FLAGS + List of compiler flags to be inherited by dependent targets + +LINK_FLAGS + List of linker flags to be inherited by dependent targets + +DEFINES + List of compiler defines to be inherited by dependent targets + +This macro does not create a target - it is intended to be used with CMake +targets created via another BLT macro or CMake command. Unlike ``blt_register_library``, +it modifies the specified target, updating the CMake properties of the target that correspond +to each of the parameters. + +.. warning:: The DEPENDS_ON and LIBRARIES parameters cannot be used when patching a target + declared in a separate directory unless CMake policy CMP0079 has been set. .. _blt_import_library: blt_import_library -~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~ .. code-block:: cmake @@ -372,7 +381,7 @@ blt_import_library LINK_FLAGS [flag1 [flag2 ..]] DEFINES [def1 [def2 ...]] ) -Creates a CMake library target from a list of existing library files or targets. +Creates a CMake target from build artifacts and system files generated outside of this build system. NAME Name of the created CMake target @@ -403,10 +412,15 @@ LINK_FLAGS DEFINES List of compiler defines to be inherited by dependent targets -This behaves similarly to :ref:`blt_register_library`, but because it defines -a native CMake target, no internal variable names are defined. This means that it -is usable in contexts other than those that specifically accept BLT-registered -libraries, and can take full advantage of CMake's transitive dependency resolution. +Allows libraries not built with CMake to be imported as native CMake targets +in order to take full advantage of CMake's transitive dependency resolution. + +For example, a ``Find.cmake`` may set only the variables ``_LIBRARIES`` +(which might contain the .a/.so/.lib/.dll file for the library itself, and the libraries it +depends on) and ``_INCLUDES`` (which might contain the include directories required +to use the library). Instead of using these variables directly every time they are needed, +they could instead be built into a CMake target. It also allows for compiler and linker +options to be associated with the library. As with BLT-registered libraries, it can be added to the DEPENDS_ON parameter when building another target or to ``target_link_libraries`` to transitively add in @@ -414,3 +428,53 @@ all includes, libraries, flags, and definitions associated with the imported lib This does not actually build a library. This is strictly to ease use after discovering it on your system or building it yourself inside your project. + +.. _blt_register_library: + +blt_register_library +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + blt_register_library( NAME + DEPENDS_ON [dep1 [dep2 ...]] + INCLUDES [include1 [include2 ...]] + TREAT_INCLUDES_AS_SYSTEM [ON|OFF] + FORTRAN_MODULES [path1 [path2 ..]] + LIBRARIES [lib1 [lib2 ...]] + COMPILE_FLAGS [flag1 [flag2 ..]] + LINK_FLAGS [flag1 [flag2 ..]] + DEFINES [def1 [def2 ...]] ) + +Registers a library to the project to ease use in other BLT macro calls. + +Stores information about a library in a specific way that is easily recalled +in other macros. For example, after registering gtest, you can add gtest to +the DEPENDS_ON in your blt_add_executable call and it will add the INCLUDES +and LIBRARIES to that executable. + +.. note:: In general, this macro should be avoided unless absolutely necessary, as it + does not create a native CMake target. If the library to register already exists + as a CMake target, consider using ``blt_patch_target``. Otherwise, consider using + ``blt_import_library``. These options are insufficient in some circumstances, for example, + if it is necessary to add libraries to a CMake library target declared in another + directory while keeping the modified target usable with the same name as the original + target. In this case ``blt_register_library`` is the only option. + + +Note: The OBJECT parameter is for internal BLT support for object libraries +and is not for users. Object libraries are created using blt_add_library(). + +Internally created variables (NAME = "foo"): + | _BLT_FOO_IS_REGISTERED_LIBRARY + | _BLT_FOO_IS_OBJECT_LIBRARY + | _BLT_FOO_DEPENDS_ON + | _BLT_FOO_INCLUDES + | _BLT_FOO_TREAT_INCLUDES_AS_SYSTEM + | _BLT_FOO_FORTRAN_MODULES + | _BLT_FOO_LIBRARIES + | _BLT_FOO_COMPILE_FLAGS + | _BLT_FOO_LINK_FLAGS + | _BLT_FOO_DEFINES + +Internal variable names are prefixed with ``_`` to avoid collision with input parameters. diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index cf15cf73b..d445744ec 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -18,7 +18,7 @@ directories, libraries, compile flags, link flags, defines, etc. You can also hide any warnings created by their headers by setting the ``TREAT_INCLUDES_AS_SYSTEM`` argument. -For example, to find and register the external dependency *axom* as a CMake target, you can simply use: +For example, to find and add the external dependency *axom* as a CMake target, you can simply use: .. code-block:: cmake @@ -39,21 +39,22 @@ and exported. This is especially helpful for "converting" external libraries that are not built with CMake into CMake-friendly imported targets. +BLT also supports using ``blt_register_library()`` to provide additional options for existing CMake targets. +The implementation doesn't modify the properties of the existing targets, +it just exposes these options via BLT's support for ``DEPENDS_ON``. + This first-class importing functionality provided by ``blt_import_library()`` should be preferred, but ``blt_register_library()`` is -still available for compatibility. It is generally usable as a drop-in replacement, though it does not support the creation -of targets with the same name as a target that already exists. +still available for compatibility. ``blt_import_library()`` is generally usable as a drop-in replacement, +though it does not support the creation of targets with the same name as a target that already exists. -Because CMake targets are only accessible from within the directory they were defined (including -subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files -that create imported library targets needed in other directories. +.. note:: + Because CMake targets are only accessible from within the directory they were defined (including + subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files + that create imported library targets needed in other directories. -MPI, CUDA, and OpenMP are all registered via ``blt_import_library()``. +BLT's ``mpi``, ``cuda``, and ``openmp`` targets are all defined via ``blt_import_library()``. You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. -BLT also supports using ``blt_register_library()`` to provide additional options for existing CMake targets. -The implementation doesn't modify the properties of the existing targets, -it just exposes these options via BLT's support for ``DEPENDS_ON``. - .. admonition:: blt_register_library :class: hint From 0c6fd1d0b7c46f4bc82d2b8bfdbbb29568710f14 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 14:22:45 -0600 Subject: [PATCH 083/330] fix: patch_target uses interface visibility for interface libraries and public otherwise --- cmake/BLTMacros.cmake | 51 ++++++++++++++++++++++++------------------- docs/api/target.rst | 6 ++++- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index ff807254e..b886640a9 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -400,7 +400,8 @@ endmacro(blt_register_library) ## LINK_FLAGS [ flag1 [ flag2 ..]] ## DEFINES [def1 [def2 ...]] ) ## -## Modifies an existing CMake target - currently only sets INTERFACE visibility +## Modifies an existing CMake target - sets PUBLIC visibility except for INTERFACE +## libraries, which use INTERFACE visibility ##------------------------------------------------------------------------------ macro(blt_patch_target) set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) @@ -425,59 +426,65 @@ macro(blt_patch_target) message(FATAL_ERROR "blt_patch_target() NAME argument must be a native CMake target") endif() + # Default to public scope, unless it's an interface library + set(_scope PUBLIC) + get_property(_targetType TARGET ${arg_TARGET} PROPERTY TYPE) + if(${arg_TARGET} STREQUAL "INTERFACE_LIBRARY") + set(_scope INTERFACE) + endif() + # LIBRARIES and DEPENDS_ON are kept separate in case different logic is needed for # the library itself versus its dependencies if( arg_LIBRARIES ) - target_link_libraries(${arg_NAME} INTERFACE ${arg_LIBRARIES}) + target_link_libraries(${arg_NAME} ${_scope} ${arg_LIBRARIES}) endif() # TODO: This won't expand BLT-registered libraries if( arg_DEPENDS_ON ) - target_link_libraries(${arg_NAME} INTERFACE ${arg_DEPENDS_ON}) + target_link_libraries(${arg_NAME} ${_scope} ${arg_DEPENDS_ON}) endif() if( arg_INCLUDES ) - if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0" ) - target_include_directories(${arg_NAME} INTERFACE ${arg_INCLUDES}) - # PGI does not support -isystem - if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(${arg_NAME} SYSTEM INTERFACE ${_target_includes}) - endif() + if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${arg_TARGET} STREQUAL "INTERFACE_LIBRARY")) + target_include_directories(${arg_NAME} ${_scope} ${arg_INCLUDES}) else() # Interface include directories need to be set manually - set_property(TARGET ${arg_NAME} - APPEND PROPERTY + set_property(TARGET ${arg_NAME} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${arg_INCLUDES}) - # PGI does not support -isystem - if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - set_target_properties(${arg_NAME} PROPERTIES - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) - endif() + endif() + endif() + + # PGI does not support -isystem + if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) + get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) + if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${arg_TARGET} STREQUAL "INTERFACE_LIBRARY")) + target_include_directories(${arg_NAME} SYSTEM ${_scope} ${_target_includes}) + else() + set_target_properties(${arg_NAME} PROPERTIES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) endif() endif() # FIXME: Is this all that's needed? if( arg_FORTRAN_MODULES ) - target_include_directories(${arg_NAME} INTERFACE ${arg_FORTRAN_MODULES}) + target_include_directories(${arg_NAME} ${_scope} ${arg_FORTRAN_MODULES}) endif() if( arg_COMPILE_FLAGS ) blt_add_target_compile_flags(TO ${arg_NAME} - SCOPE INTERFACE + SCOPE ${_scope} FLAGS ${arg_COMPILE_FLAGS}) endif() if( arg_LINK_FLAGS ) blt_add_target_link_flags(TO ${arg_NAME} - SCOPE INTERFACE + SCOPE ${_scope} FLAGS ${arg_LINK_FLAGS}) endif() if( arg_DEFINES ) blt_add_target_definitions(TO ${arg_NAME} - SCOPE INTERFACE + SCOPE ${_scope} TARGET_DEFINITIONS ${arg_DEFINES}) endif() diff --git a/docs/api/target.rst b/docs/api/target.rst index dd5f6b53b..74a10989d 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -322,7 +322,9 @@ blt_patch_target LINK_FLAGS [flag1 [flag2 ..]] DEFINES [def1 [def2 ...]] ) -Modifies the ``INTERFACE`` properties of an existing target. +Modifies the properties of an existing target. ``PUBLIC`` visibility +is used unless the target is an ``INTERFACE`` library, in which case +``INTERFACE`` visibility is used. NAME Name of the CMake target to patch @@ -426,6 +428,8 @@ As with BLT-registered libraries, it can be added to the DEPENDS_ON parameter when building another target or to ``target_link_libraries`` to transitively add in all includes, libraries, flags, and definitions associated with the imported library. +In CMake terms, the imported libraries will be ``INTERFACE`` libraries. + This does not actually build a library. This is strictly to ease use after discovering it on your system or building it yourself inside your project. From 222952d737e031127eb82a4c272d59b055d28ad9 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 14:28:36 -0600 Subject: [PATCH 084/330] fix: correct get_target_property calls --- cmake/BLTMacros.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index b886640a9..f247d51cb 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -428,8 +428,8 @@ macro(blt_patch_target) # Default to public scope, unless it's an interface library set(_scope PUBLIC) - get_property(_targetType TARGET ${arg_TARGET} PROPERTY TYPE) - if(${arg_TARGET} STREQUAL "INTERFACE_LIBRARY") + get_target_property(_targetType ${arg_NAME} TYPE) + if(${_targetType} STREQUAL "INTERFACE_LIBRARY") set(_scope INTERFACE) endif() @@ -445,7 +445,7 @@ macro(blt_patch_target) endif() if( arg_INCLUDES ) - if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${arg_TARGET} STREQUAL "INTERFACE_LIBRARY")) + if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${_targetType} STREQUAL "INTERFACE_LIBRARY")) target_include_directories(${arg_NAME} ${_scope} ${arg_INCLUDES}) else() # Interface include directories need to be set manually @@ -457,7 +457,7 @@ macro(blt_patch_target) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${arg_TARGET} STREQUAL "INTERFACE_LIBRARY")) + if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${_targetType} STREQUAL "INTERFACE_LIBRARY")) target_include_directories(${arg_NAME} SYSTEM ${_scope} ${_target_includes}) else() set_target_properties(${arg_NAME} PROPERTIES From e228d080fc1d5dc77d3ca7b207a59885a9dda345 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 15:21:16 -0600 Subject: [PATCH 085/330] docs: add global option to import_library --- RELEASE-NOTES.md | 3 ++- cmake/BLTMacros.cmake | 15 +++++++++------ docs/api/target.rst | 6 +++++- docs/tutorial/external_dependencies.rst | 5 +++-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 6b9ef9d79..b6e976ff5 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -24,7 +24,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ and IDE folder support. - Added new ``blt_import_library`` macro that creates a real CMake target for imported libraries, intended to be used instead of ``blt_register_library`` whenever possible -- Added new ``blt_patch_target`` macro for modifying the properties of a CMake target in bulk +- Added new ``blt_patch_target`` macro to simplify modifying properties of an existing CMake target. + This macro accounts for known differences in compilers, target types, and CMake releases. ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index f247d51cb..35ec3dd78 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -499,12 +499,13 @@ endmacro(blt_patch_target) ## FORTRAN_MODULES [ path1 [ path2 ..]] ## COMPILE_FLAGS [ flag1 [ flag2 ..]] ## LINK_FLAGS [ flag1 [ flag2 ..]] -## DEFINES [def1 [def2 ...]] ) +## DEFINES [def1 [def2 ...]] +## GLOBAL [ON|OFF]) ## ## Imports a library as a CMake target ##------------------------------------------------------------------------------ macro(blt_import_library) - set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM) + set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM GLOBAL) set(multiValueArgs LIBRARIES INCLUDES DEPENDS_ON @@ -522,10 +523,12 @@ macro(blt_import_library) message(FATAL_ERROR "blt_import_library() must be called with argument NAME ") endif() - # Add all imported targets to a single interface target - # Introducing OBJECT targets for each library file causes issues when exporting as - # dependencies are not transitively included in exports - add_library(${arg_NAME} INTERFACE) + # Add all imported targets to a single imported interface target + if(${arg_GLOBAL}) + add_library(${arg_NAME} INTERFACE IMPORTED GLOBAL) + else() + add_library(${arg_NAME} INTERFACE IMPORTED) + endif() blt_patch_target( NAME ${arg_NAME} diff --git a/docs/api/target.rst b/docs/api/target.rst index 74a10989d..c9b94c115 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -381,7 +381,8 @@ blt_import_library LIBRARIES [lib1 [lib2 ...]] COMPILE_FLAGS [flag1 [flag2 ..]] LINK_FLAGS [flag1 [flag2 ..]] - DEFINES [def1 [def2 ...]] ) + DEFINES [def1 [def2 ...]] + GLOBAL [ON|OFF]) Creates a CMake target from build artifacts and system files generated outside of this build system. @@ -414,6 +415,9 @@ LINK_FLAGS DEFINES List of compiler defines to be inherited by dependent targets +GLOBAL + Whether to extend the visibility of the created library to global scope + Allows libraries not built with CMake to be imported as native CMake targets in order to take full advantage of CMake's transitive dependency resolution. diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index d445744ec..2ac2f0606 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -50,9 +50,10 @@ though it does not support the creation of targets with the same name as a targe .. note:: Because CMake targets are only accessible from within the directory they were defined (including subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files - that create imported library targets needed in other directories. + that create imported library targets needed in other directories. The GLOBAL option to ``blt_import_library()`` + can also be used to manage visibility. -BLT's ``mpi``, ``cuda``, and ``openmp`` targets are all defined via ``blt_import_library()``. +BLT's ``mpi``, ``cuda``, ``cuda_runtime``, and ``openmp`` targets are all defined via ``blt_import_library()``. You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. .. admonition:: blt_register_library From fc3fadaeb15006df056d15bfc7c8de921166e446 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 15:47:24 -0600 Subject: [PATCH 086/330] fix: support for old interface for linking interface libraries --- cmake/BLTMacros.cmake | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 35ec3dd78..2800479e6 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -428,24 +428,38 @@ macro(blt_patch_target) # Default to public scope, unless it's an interface library set(_scope PUBLIC) - get_target_property(_targetType ${arg_NAME} TYPE) - if(${_targetType} STREQUAL "INTERFACE_LIBRARY") + get_target_property(_target_type ${arg_NAME} TYPE) + if(${_target_type} STREQUAL "INTERFACE_LIBRARY") set(_scope INTERFACE) endif() + # Interface libraries were heavily restricted pre-3.11 + set(_standard_lib_interface FALSE) + if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${_target_type} STREQUAL "INTERFACE_LIBRARY")) + set(_standard_lib_interface TRUE) + endif() + # LIBRARIES and DEPENDS_ON are kept separate in case different logic is needed for # the library itself versus its dependencies + set(_libs_to_link "") if( arg_LIBRARIES ) - target_link_libraries(${arg_NAME} ${_scope} ${arg_LIBRARIES}) + list(APPEND _libs_to_link ${arg_LIBRARIES}) endif() # TODO: This won't expand BLT-registered libraries if( arg_DEPENDS_ON ) - target_link_libraries(${arg_NAME} ${_scope} ${arg_DEPENDS_ON}) + list(APPEND _libs_to_link ${arg_DEPENDS_ON}) endif() + if(_standard_lib_interface) + target_link_libraries(${arg_NAME} ${_scope} ${_libs_to_link}) + else() + set_property(TARGET ${arg_NAME} APPEND PROPERTY + INTERFACE_LINK_LIBRARIES ${_libs_to_link}) + endif() + if( arg_INCLUDES ) - if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${_targetType} STREQUAL "INTERFACE_LIBRARY")) + if(_standard_lib_interface) target_include_directories(${arg_NAME} ${_scope} ${arg_INCLUDES}) else() # Interface include directories need to be set manually @@ -457,7 +471,7 @@ macro(blt_patch_target) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${_targetType} STREQUAL "INTERFACE_LIBRARY")) + if(_standard_lib_interface) target_include_directories(${arg_NAME} SYSTEM ${_scope} ${_target_includes}) else() set_target_properties(${arg_NAME} PROPERTIES @@ -1294,8 +1308,8 @@ macro(blt_print_target_properties) blt_list_remove_duplicates(TO _property_list) ## For interface targets, filter against whitelist of valid properties - get_property(_targetType TARGET ${arg_TARGET} PROPERTY TYPE) - if(${_targetType} STREQUAL "INTERFACE_LIBRARY") + get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) + if(${_target_type} STREQUAL "INTERFACE_LIBRARY") blt_filter_list(TO _property_list REGEX "^(INTERFACE_|IMPORTED_LIBNAME_|COMPATIBLE_INTERFACE_|MAP_IMPORTED_CONFIG_)|^(NAME|TYPE|EXPORT_NAME)$" OPERATION "include") From 4e57c030a0142067865dfe07ed491b8ed5fa819b Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 11 Nov 2020 13:51:24 -0800 Subject: [PATCH 087/330] feat: add yapf to README This commit adds Yapf support to the project README. --- README.md | 63 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 12d2d3250..6dd517610 100644 --- a/README.md +++ b/README.md @@ -4,25 +4,25 @@ Status](https://dev.azure.com/llnl-blt/blt/_apis/build/status/LLNL.blt?branchName=develop)](https://dev.azure.com/llnl-blt/blt/_build/latest?definitionId=1&branchName=develop) [![Documentation Status](https://readthedocs.org/projects/llnl-blt/badge/?version=develop)](https://llnl-blt.readthedocs.io/en/develop/?badge=develop) -BLT is a streamlined [CMake](https://cmake.org)-based foundation for +BLT is a streamlined [CMake](https://cmake.org)-based foundation for Building, Linking and Testing large-scale high performance computing (HPC) applications. -BLT makes it easy to get up and running on a wide range of HPC compilers, +BLT makes it easy to get up and running on a wide range of HPC compilers, operating systems and technologies: * Compiler families: - [gcc](https://gcc.gnu.org), - [clang](https://clang.llvm.org), - [Intel](https://software.intel.com/en-us/compilers), - [XL](https://www.ibm.com/us-en/marketplace/ibm-c-and-c-plus-plus-compiler-family), + [gcc](https://gcc.gnu.org), + [clang](https://clang.llvm.org), + [Intel](https://software.intel.com/en-us/compilers), + [XL](https://www.ibm.com/us-en/marketplace/ibm-c-and-c-plus-plus-compiler-family), [Visual Studio](https://visualstudio.microsoft.com/vs/features/cplusplus) - * Operating systems: - Linux, - Mac OS, + * Operating systems: + Linux, + Mac OS, Windows * HPC programming models: - [MPI](https://www.mpi-forum.org/), - [OpenMP](https://www.openmp.org/), - [CUDA](https://developer.nvidia.com/cuda-zone), + [MPI](https://www.mpi-forum.org/), + [OpenMP](https://www.openmp.org/), + [CUDA](https://developer.nvidia.com/cuda-zone), [HIP](https://gpuopen.com/compute-product/hip-convert-cuda-to-portable-c-code) * Unit testing and benchmarking (built-in): [Google Test (gtest and gmock)](https://github.com/google/googletest), @@ -35,11 +35,12 @@ operating systems and technologies: [AStyle](http://astyle.sourceforge.net), [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html), [Uncrustify](http://uncrustify.sourceforge.net) + [YAPF](https://github.com/google/yapf) * Code quality [clang-query](http://clang.llvm.org/docs/LibASTMatchers.html), [clang-tidy](https://clang.llvm.org/extra/clang-tidy), [Cppcheck](http://cppcheck.sourceforge.net) - + Getting started --------------- @@ -73,10 +74,10 @@ Developers include: * Richard Hornung, LLNL * Randolph Settgast, LLNL -Please see our [contributing guide](https://github.com/LLNL/blt/blob/develop/CONTRIBUTING.md) +Please see our [contributing guide](https://github.com/LLNL/blt/blob/develop/CONTRIBUTING.md) for details about how to contribute to the project. -The full list of project contributors can be found on the +The full list of project contributors can be found on the [BLT Contributors Page](https://github.com/LLNL/BLT/graphs/contributors). Open-Source Projects using BLT @@ -103,7 +104,7 @@ Copyrights and patents in the BLT project are retained by contributors. No copyright assignment is required to contribute to BLT. See [LICENSE](./LICENSE) for details. - + Unlimited Open Source - BSD 3-clause Distribution `LLNL-CODE-725085` `OCEC-17-023` @@ -125,22 +126,22 @@ BLT bundles its external dependencies in thirdparty_builtin/. These packages are covered by various permissive licenses. A summary listing follows. See the license included with each package for full details. -PackageName: fruit -PackageHomePage: https://sourceforge.net/projects/fortranxunit/ -PackageLicenseDeclared: BSD-3-Clause +PackageName: fruit +PackageHomePage: https://sourceforge.net/projects/fortranxunit/ +PackageLicenseDeclared: BSD-3-Clause -PackageName: gbenchmark -PackageHomePage: https://github.com/google/benchmark -PackageLicenseDeclared: Apache-2.0 +PackageName: gbenchmark +PackageHomePage: https://github.com/google/benchmark +PackageLicenseDeclared: Apache-2.0 -PackageName: gmock -PackageHomePage: https://github.com/google/googlemock -PackageLicenseDeclared: BSD-3-Clause +PackageName: gmock +PackageHomePage: https://github.com/google/googlemock +PackageLicenseDeclared: BSD-3-Clause -PackageName: gtest -PackageHomePage: https://github.com/google/googletest -PackageLicenseDeclared: BSD-3-Clause +PackageName: gtest +PackageHomePage: https://github.com/google/googletest +PackageLicenseDeclared: BSD-3-Clause -PackageName: run-clang-format -PackageHomePage: https://github.com/Sarcasm/run-clang-format -PackageLicenseDeclared: MIT +PackageName: run-clang-format +PackageHomePage: https://github.com/Sarcasm/run-clang-format +PackageLicenseDeclared: MIT From e3d8fd9e9ed76d14f1eff8c8998029680e5b93b6 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 15:52:59 -0600 Subject: [PATCH 088/330] fix: old interface for flags as well --- cmake/BLTMacros.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 2800479e6..c2d81f510 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -273,7 +273,12 @@ macro(blt_add_target_link_flags) get_target_property(target_type ${arg_TO} TYPE) if (${target_type} STREQUAL "INTERFACE_LIBRARY") # If it's an interface library, we add the flag via link_libraries - target_link_libraries(${arg_TO} INTERFACE ${_flags}) + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") + target_link_libraries(${arg_TO} INTERFACE ${_flags}) + else() + set_property(TARGET ${arg_NAME} APPEND PROPERTY + INTERFACE_LINK_LIBRARIES ${_libs_to_link}) + endif() else() get_target_property(_link_flags ${arg_TO} LINK_FLAGS) # Append to existing flags From 1d8a1a9abdc348d80bf6f9f91067c5e95ec0dc06 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 15:59:49 -0600 Subject: [PATCH 089/330] fix: old interface for compile flags in addition to link flags --- cmake/BLTMacros.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index c2d81f510..0029170a8 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -184,7 +184,13 @@ macro(blt_add_target_compile_flags) # Only add the flag if it is not empty string(STRIP "${arg_FLAGS}" _strippedFlags) if(NOT "${_strippedFlags}" STREQUAL "") - target_compile_options(${arg_TO} ${_scope} ${_strippedFlags}) + get_target_property(_target_type ${arg_TO} TYPE) + if ((${_target_type} STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS "3.11.0")) + set_property(TARGET ${arg_NAME} APPEND PROPERTY + INTERFACE_COMPILE_OPTIONS ${_libs_to_link}) + else() + target_compile_options(${arg_TO} ${_scope} ${_strippedFlags}) + endif() endif() unset(_strippedFlags) @@ -270,8 +276,8 @@ macro(blt_add_target_link_flags) endif() else() # In CMake <= 3.12, there is no target_link_flags or target_link_options command - get_target_property(target_type ${arg_TO} TYPE) - if (${target_type} STREQUAL "INTERFACE_LIBRARY") + get_target_property(_target_type ${arg_TO} TYPE) + if (${_target_type} STREQUAL "INTERFACE_LIBRARY") # If it's an interface library, we add the flag via link_libraries if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") target_link_libraries(${arg_TO} INTERFACE ${_flags}) From dde332ed81e97e471618a8436b85bfbd04a4c010 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 14:10:05 -0800 Subject: [PATCH 090/330] fix: fix typos in set commands --- cmake/BLTMacros.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 0029170a8..26f7db628 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -187,7 +187,7 @@ macro(blt_add_target_compile_flags) get_target_property(_target_type ${arg_TO} TYPE) if ((${_target_type} STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS "3.11.0")) set_property(TARGET ${arg_NAME} APPEND PROPERTY - INTERFACE_COMPILE_OPTIONS ${_libs_to_link}) + INTERFACE_COMPILE_OPTIONS ${_strippedFlags}) else() target_compile_options(${arg_TO} ${_scope} ${_strippedFlags}) endif() @@ -283,7 +283,7 @@ macro(blt_add_target_link_flags) target_link_libraries(${arg_TO} INTERFACE ${_flags}) else() set_property(TARGET ${arg_NAME} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES ${_libs_to_link}) + INTERFACE_LINK_LIBRARIES ${_flags}) endif() else() get_target_property(_link_flags ${arg_TO} LINK_FLAGS) From ec2a64cd1f9b4c5a5ef7165fa7c463fc6c51f697 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 16:26:08 -0600 Subject: [PATCH 091/330] fix: set_property instead of set_target_property to avoid quoting --- cmake/BLTMacros.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 26f7db628..fcb08edbd 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -485,8 +485,8 @@ macro(blt_patch_target) if(_standard_lib_interface) target_include_directories(${arg_NAME} SYSTEM ${_scope} ${_target_includes}) else() - set_target_properties(${arg_NAME} PROPERTIES - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) + set_property(TARGET ${arg_NAME} PROPERTY + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) endif() endif() From 017a2c79518a06dc6551325a2ecf78e2da2b01ab Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 11 Nov 2020 17:16:33 -0600 Subject: [PATCH 092/330] cleanup: quote strings for target type --- cmake/BLTMacros.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index fcb08edbd..71c291282 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -185,7 +185,7 @@ macro(blt_add_target_compile_flags) string(STRIP "${arg_FLAGS}" _strippedFlags) if(NOT "${_strippedFlags}" STREQUAL "") get_target_property(_target_type ${arg_TO} TYPE) - if ((${_target_type} STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS "3.11.0")) + if (("${_target_type}" STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS "3.11.0")) set_property(TARGET ${arg_NAME} APPEND PROPERTY INTERFACE_COMPILE_OPTIONS ${_strippedFlags}) else() @@ -277,7 +277,7 @@ macro(blt_add_target_link_flags) else() # In CMake <= 3.12, there is no target_link_flags or target_link_options command get_target_property(_target_type ${arg_TO} TYPE) - if (${_target_type} STREQUAL "INTERFACE_LIBRARY") + if ("${_target_type}" STREQUAL "INTERFACE_LIBRARY") # If it's an interface library, we add the flag via link_libraries if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") target_link_libraries(${arg_TO} INTERFACE ${_flags}) @@ -440,13 +440,13 @@ macro(blt_patch_target) # Default to public scope, unless it's an interface library set(_scope PUBLIC) get_target_property(_target_type ${arg_NAME} TYPE) - if(${_target_type} STREQUAL "INTERFACE_LIBRARY") + if("${_target_type}" STREQUAL "INTERFACE_LIBRARY") set(_scope INTERFACE) endif() # Interface libraries were heavily restricted pre-3.11 set(_standard_lib_interface FALSE) - if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT ${_target_type} STREQUAL "INTERFACE_LIBRARY")) + if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") OR (NOT "${_target_type}" STREQUAL "INTERFACE_LIBRARY")) set(_standard_lib_interface TRUE) endif() @@ -1320,7 +1320,7 @@ macro(blt_print_target_properties) ## For interface targets, filter against whitelist of valid properties get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) - if(${_target_type} STREQUAL "INTERFACE_LIBRARY") + if("${_target_type}" STREQUAL "INTERFACE_LIBRARY") blt_filter_list(TO _property_list REGEX "^(INTERFACE_|IMPORTED_LIBNAME_|COMPATIBLE_INTERFACE_|MAP_IMPORTED_CONFIG_)|^(NAME|TYPE|EXPORT_NAME)$" OPERATION "include") From b4837db337b23248055ca378d488ad5f4e3a1c28 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Wed, 11 Nov 2020 17:58:12 -0800 Subject: [PATCH 093/330] fix: add missing brace to yapf nonconformant test This commit adds a missing brace to the yapf nonconformant style test so that a CMake variable is interpolated correctly. The current version lacks this brace, which is a syntax error. --- tests/internal/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 42d397265..b0ba798ce 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -363,7 +363,7 @@ if(YAPF_FOUND) blt_add_code_checks( PREFIX yapf_nonconformant_tests - SOURCES ${internal_nonconformant_python_srcs + SOURCES ${internal_nonconformant_python_srcs} YAPF_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yapf.cfg) endif() # end if(YAPF_FOUND) From 170a4041af7c7e201f19cdf1a12281fa4ea326fb Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 12 Nov 2020 07:49:07 -0800 Subject: [PATCH 094/330] feat: tested hip_smoke/hip_runtime_smoke on rzwhamo with blt_import_library, appears to work --- cmake/thirdparty/SetupHIP.cmake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index 62bd283f9..dd693badf 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -30,17 +30,17 @@ set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFI # depend on 'hip', if you need to use hip # headers, link to hip libs, and need to run your source # through a hip compiler (hipcc) -blt_register_library(NAME hip - INCLUDES ${HIP_INCLUDE_DIRS} - LIBRARIES ${HIP_LIBRARIES} - TREAT_INCLUDES_AS_SYSTEM ON) +blt_import_library(NAME hip + INCLUDES ${HIP_INCLUDE_DIRS} + LIBRARIES ${HIP_LIBRARIES} + TREAT_INCLUDES_AS_SYSTEM ON) # depend on 'hip_runtime', if you only need to use hip # headers or link to hip libs, but don't need to run your source # through a hip compiler (hipcc) -blt_register_library(NAME hip_runtime - INCLUDES ${HIP_RUNTIME_INCLUDE_DIRS} - DEFINES ${HIP_RUNTIME_DEFINES} - COMPILE_FLAGS ${HIP_RUNTIME_COMPILE_FLAGS} - LIBRARIES ${HIP_RUNTIME_LIBRARIES} - TREAT_INCLUDES_AS_SYSTEM ON) +blt_import_library(NAME hip_runtime + INCLUDES ${HIP_RUNTIME_INCLUDE_DIRS} + DEFINES ${HIP_RUNTIME_DEFINES} + COMPILE_FLAGS ${HIP_RUNTIME_COMPILE_FLAGS} + LIBRARIES ${HIP_RUNTIME_LIBRARIES} + TREAT_INCLUDES_AS_SYSTEM ON) From 62c22db8f79545688fcd9a9aa428b21e271025a4 Mon Sep 17 00:00:00 2001 From: Daniel Taller Date: Fri, 13 Nov 2020 13:34:09 -0800 Subject: [PATCH 095/330] initial blt commit --- cmake/thirdparty/SetupHIP.cmake | 6 +++++- host-configs/other/hcc.cmake | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index dd693badf..e2f2e2cd1 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -22,7 +22,11 @@ if(${HIP_PLATFORM} STREQUAL "hcc") elseif(${HIP_PLATFORM} STREQUAL "nvcc") set(HIP_RUNTIME_DEFINE "__HIP_PLATFORM_NVCC__") endif() -set(HIP_RUNTIME_INCLUDE_DIRS "${HIP_ROOT_DIR}/include;${HIP_ROOT_DIR}/hcc/include" CACHE STRING "") +if ( IS_DIRECTORY "${HIP_ROOT_DIR}/hcc/include" ) # this path only exists on older rocm installs + set(HIP_RUNTIME_INCLUDE_DIRS "${HIP_ROOT_DIR}/include;${HIP_ROOT_DIR}/hcc/include" CACHE STRING "") +else() + set(HIP_RUNTIME_INCLUDE_DIRS "${HIP_ROOT_DIR}/include" CACHE STRING "") +endif() set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFINE};-Wno-unused-parameter") # set(HIP_RUNTIME_LIBRARIES "${HIP_ROOT_DIR}/hcc/lib") # set(HIP_RUNTIME_LIBRARIES "${HIP_ROOT_DIR}/hcc/lib") diff --git a/host-configs/other/hcc.cmake b/host-configs/other/hcc.cmake index 15469bd24..429f4489b 100644 --- a/host-configs/other/hcc.cmake +++ b/host-configs/other/hcc.cmake @@ -32,7 +32,11 @@ set(ENABLE_OPENMP OFF CACHE BOOL "") set(ROCM_ROOT_DIR "/opt/rocm" CACHE PATH "ROCm ROOT directory path") -set(ROCM_INCLUDE_PATH "${ROCM_ROOT_DIR}/hcc/include;${ROCM_ROOT_DIR}/include" CACHE PATH "") +if ( IS_DIRECTORY "${ROCM_ROOT_DIR}/hcc/include" ) # this path only exists on older rocm installs + set(ROCM_INCLUDE_PATH "${ROCM_ROOT_DIR}/hcc/include;${ROCM_ROOT_DIR}/include" CACHE PATH "") +else() + set(ROCM_INCLUDE_PATH "${ROCM_ROOT_DIR}/include" CACHE PATH "") +endif() set(ROCM_CXX_LIBRARIES "-L${ROCM_ROOT_DIR}/lib -lhc_am -lhip_hcc" CACHE STRING "") ########################################################### @@ -60,6 +64,7 @@ set(ROCM_CXX_LINK_FLAGS "${ROCM_CXX_LINK_FLAGS} ${ROCM_ARCH_FLAG} ${ROCM_CXX_LIB ########################################################### # set CMake cache variables ########################################################### +# if hcc does not exist, consider setting the compiler to "${ROCM_ROOT_DIR}/bin/hipcc" set(CMAKE_CXX_COMPILER "${ROCM_ROOT_DIR}/hcc/bin/hcc" CACHE FILEPATH "ROCm HCC compiler") # set(BLT_CXX_FLAGS "${ROCM_CXX_COMPILE_FLAGS}" CACHE STRING "HCC compiler flags") From f5c967c523222c44e31fee8573d700b66289ad29 Mon Sep 17 00:00:00 2001 From: Daniel Taller Date: Fri, 13 Nov 2020 16:28:05 -0800 Subject: [PATCH 096/330] update release notes --- RELEASE-NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index cdb8ee7c0..2215978d5 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -32,6 +32,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed as single string prefixed by ``SHELL:`` to prevent de-duplication of flags passed to ``target_link_options``. +- For HIP-dependent builds, only add HCC include directory if it exists. ### Fixed - ClangFormat checks now support multiple Python executable names From 9bc3ceeac531c8fd17711d98fa978695ab9e54bc Mon Sep 17 00:00:00 2001 From: Kristi Belcher Date: Mon, 16 Nov 2020 16:35:44 -0800 Subject: [PATCH 097/330] bug fix to make sure HIP can be linked if enabled --- cmake/BLTMacros.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 71c291282..1b7d50d5b 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -787,8 +787,9 @@ macro(blt_add_executable) # Force to load with Fortran if the first file is Fortran. list(GET arg_SOURCES 0 _first) get_source_file_property(_lang ${_first} LANGUAGE) + #Check to see if HIP is enabled before resetting if(_lang STREQUAL Fortran) - if (NOT CUDA_LINK_WITH_NVCC) + if (NOT CUDA_LINK_WITH_NVCC OR ENABLE_HIP) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) endif() target_include_directories(${arg_NAME} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}) From a070f1e9a6e5aca7a94f282fa0118695e2d0f16c Mon Sep 17 00:00:00 2001 From: Kristi Belcher Date: Tue, 17 Nov 2020 08:21:08 -0800 Subject: [PATCH 098/330] boolean logic is hard :( --- cmake/BLTMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 1b7d50d5b..a41e2d78e 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -789,7 +789,7 @@ macro(blt_add_executable) get_source_file_property(_lang ${_first} LANGUAGE) #Check to see if HIP is enabled before resetting if(_lang STREQUAL Fortran) - if (NOT CUDA_LINK_WITH_NVCC OR ENABLE_HIP) + if (NOT CUDA_LINK_WITH_NVCC OR NOT ENABLE_HIP) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) endif() target_include_directories(${arg_NAME} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}) From cb01c68976dbdf739ee9e0d184671e72e4ddad8f Mon Sep 17 00:00:00 2001 From: Kristi Belcher Date: Tue, 17 Nov 2020 08:31:10 -0800 Subject: [PATCH 099/330] Fix for boolean logic --- cmake/BLTMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index a41e2d78e..f9911fb31 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -789,7 +789,7 @@ macro(blt_add_executable) get_source_file_property(_lang ${_first} LANGUAGE) #Check to see if HIP is enabled before resetting if(_lang STREQUAL Fortran) - if (NOT CUDA_LINK_WITH_NVCC OR NOT ENABLE_HIP) + if (NOT (CUDA_LINK_WITH_NVCC OR ENABLE_HIP)) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) endif() target_include_directories(${arg_NAME} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}) From 672825ed326810e559b844455f825f15210ed589 Mon Sep 17 00:00:00 2001 From: Kristi Belcher Date: Tue, 17 Nov 2020 10:55:40 -0800 Subject: [PATCH 100/330] adding comment --- cmake/BLTMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index f9911fb31..8f33b2a96 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -787,8 +787,8 @@ macro(blt_add_executable) # Force to load with Fortran if the first file is Fortran. list(GET arg_SOURCES 0 _first) get_source_file_property(_lang ${_first} LANGUAGE) - #Check to see if HIP is enabled before resetting if(_lang STREQUAL Fortran) + #Check to see if HIP is enabled before resetting if (NOT (CUDA_LINK_WITH_NVCC OR ENABLE_HIP)) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) endif() From 6a61af85bc33f2a079365371e1fc4e2039fef832 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 17 Nov 2020 15:05:45 -0800 Subject: [PATCH 101/330] fix: add INTERFACE_INCLUDE_DIRECTORIES for genexpr in HIP dependency generation target --- cmake/thirdparty/FindHIP.cmake | 4 +++ tests/smoke/CMakeLists.txt | 22 +++++++++++++++ tests/smoke/blt_cuda_gtest_smoke.cpp | 40 ++++++++++++++++++++++++++++ tests/smoke/blt_hip_gtest_smoke.cpp | 35 ++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 tests/smoke/blt_cuda_gtest_smoke.cpp create mode 100644 tests/smoke/blt_hip_gtest_smoke.cpp diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index 165bbd7c6..19e6ee476 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -456,6 +456,10 @@ macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files set(include_directories_generator "$") list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") + # Add the interface include directories + set(interface_include_directories_generator "$") + list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") + get_directory_property(_hip_include_directories INCLUDE_DIRECTORIES) list(REMOVE_DUPLICATES _hip_include_directories) if(_hip_include_directories) diff --git a/tests/smoke/CMakeLists.txt b/tests/smoke/CMakeLists.txt index 88449a1fa..857bfa72a 100644 --- a/tests/smoke/CMakeLists.txt +++ b/tests/smoke/CMakeLists.txt @@ -144,6 +144,17 @@ if (ENABLE_CUDA) COMMAND blt_cuda_mpi_smoke NUM_MPI_TASKS 4) endif() + + if(ENABLE_GTEST) + blt_add_executable(NAME blt_cuda_gtest_smoke + SOURCES blt_cuda_gtest_smoke.cpp + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON cuda gtest + FOLDER blt/tests ) + + blt_add_test(NAME blt_cuda_gtest_smoke + COMMAND blt_cuda_gtest_smoke) + endif() endif() ################ @@ -193,4 +204,15 @@ if (ENABLE_HIP) blt_add_test(NAME blt_hip_runtime_smoke COMMAND blt_hip_runtime_smoke) + if(ENABLE_GTEST) + blt_add_executable(NAME blt_hip_gtest_smoke + SOURCES blt_hip_gtest_smoke.cpp + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON gtest hip + FOLDER blt/tests ) + + blt_add_test(NAME blt_hip_gtest_smoke + COMMAND blt_hip_gtest_smoke) + endif() + endif() diff --git a/tests/smoke/blt_cuda_gtest_smoke.cpp b/tests/smoke/blt_cuda_gtest_smoke.cpp new file mode 100644 index 000000000..43404a2ea --- /dev/null +++ b/tests/smoke/blt_cuda_gtest_smoke.cpp @@ -0,0 +1,40 @@ +// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// other BLT Project Developers. See the top-level COPYRIGHT file for details +// +// SPDX-License-Identifier: (BSD-3-Clause) + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// +// Note: This is a CUDA Hello world example from NVIDIA: +// Obtained from here: https://developer.nvidia.com/cuda-education +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// + +//----------------------------------------------------------------------------- +// +// file: blt_cuda_smoke.cpp +// +//----------------------------------------------------------------------------- + +#include +#include + +#include "gtest/gtest.h" + +__device__ const char *STR = "HELLO WORLD!"; +const char STR_LENGTH = 12; + +__global__ void hello() +{ + printf("%c\n", STR[threadIdx.x % STR_LENGTH]); +} + +//------------------------------------------------------------------------------ +// Simple smoke test for gtest+CUDA +//------------------------------------------------------------------------------ +TEST(blt_cuda_gtest_smoke,basic_assert_example) +{ + int num_threads = STR_LENGTH; + int num_blocks = 1; + hello<<>>(); + cudaDeviceSynchronize(); + EXPECT_TRUE( true ); +} diff --git a/tests/smoke/blt_hip_gtest_smoke.cpp b/tests/smoke/blt_hip_gtest_smoke.cpp new file mode 100644 index 000000000..473f701e1 --- /dev/null +++ b/tests/smoke/blt_hip_gtest_smoke.cpp @@ -0,0 +1,35 @@ +// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// other BLT Project Developers. See the top-level COPYRIGHT file for details +// +// SPDX-License-Identifier: (BSD-3-Clause) + +//----------------------------------------------------------------------------- +// +// file: blt_hip_smoke.cpp +// +//----------------------------------------------------------------------------- + +#include +#include +#include "gtest/gtest.h" +#include "hip/hip_runtime.h" + +__device__ const char STR[] = "HELLO WORLD!"; +const char STR_LENGTH = 12; + +__global__ void hello() +{ + printf("%c\n", STR[threadIdx.x % STR_LENGTH]); +} + +//------------------------------------------------------------------------------ +// Simple smoke test for gtest+HIP +//------------------------------------------------------------------------------ +TEST(blt_hip_gtest_smoke,basic_assert_example) +{ + int num_threads = STR_LENGTH; + int num_blocks = 1; + hipLaunchKernelGGL((hello), dim3(num_blocks), dim3(num_threads),0,0); + hipDeviceSynchronize(); + EXPECT_TRUE( true ); +} \ No newline at end of file From 090c66e48f2896f36e4f83f43527ed3ab984a8d0 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 17 Nov 2020 15:12:46 -0800 Subject: [PATCH 102/330] format: proper spacing for macro call --- tests/smoke/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/smoke/CMakeLists.txt b/tests/smoke/CMakeLists.txt index 857bfa72a..b36e6c0fb 100644 --- a/tests/smoke/CMakeLists.txt +++ b/tests/smoke/CMakeLists.txt @@ -147,10 +147,10 @@ if (ENABLE_CUDA) if(ENABLE_GTEST) blt_add_executable(NAME blt_cuda_gtest_smoke - SOURCES blt_cuda_gtest_smoke.cpp - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON cuda gtest - FOLDER blt/tests ) + SOURCES blt_cuda_gtest_smoke.cpp + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON cuda gtest + FOLDER blt/tests ) blt_add_test(NAME blt_cuda_gtest_smoke COMMAND blt_cuda_gtest_smoke) @@ -206,10 +206,10 @@ if (ENABLE_HIP) if(ENABLE_GTEST) blt_add_executable(NAME blt_hip_gtest_smoke - SOURCES blt_hip_gtest_smoke.cpp - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON gtest hip - FOLDER blt/tests ) + SOURCES blt_hip_gtest_smoke.cpp + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON gtest hip + FOLDER blt/tests ) blt_add_test(NAME blt_hip_gtest_smoke COMMAND blt_hip_gtest_smoke) From 4b15c8221278cab67ec193aa570be01ad28132b8 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 17 Nov 2020 15:14:39 -0800 Subject: [PATCH 103/330] format: trailing newline for hip gtest smoketest --- tests/smoke/blt_hip_gtest_smoke.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/smoke/blt_hip_gtest_smoke.cpp b/tests/smoke/blt_hip_gtest_smoke.cpp index 473f701e1..3ca73838d 100644 --- a/tests/smoke/blt_hip_gtest_smoke.cpp +++ b/tests/smoke/blt_hip_gtest_smoke.cpp @@ -32,4 +32,4 @@ TEST(blt_hip_gtest_smoke,basic_assert_example) hipLaunchKernelGGL((hello), dim3(num_blocks), dim3(num_threads),0,0); hipDeviceSynchronize(); EXPECT_TRUE( true ); -} \ No newline at end of file +} From 57f6345e9b8c6b889cf63a2498022b48bd1a69bc Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 18 Nov 2020 09:44:22 -0800 Subject: [PATCH 104/330] HIP: update HIP CMake utilities from ROCm develop --- cmake/thirdparty/FindHIP.cmake | 67 ++++++++++++++++++------ cmake/thirdparty/FindHIP/run_hipcc.cmake | 4 +- 2 files changed, 53 insertions(+), 18 deletions(-) diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index 19e6ee476..c644677e0 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -16,6 +16,7 @@ set(HIP_HCC_FLAGS "" CACHE STRING "Semicolon delimited flags for HCC") set(HIP_CLANG_FLAGS "" CACHE STRING "Semicolon delimited flags for CLANG") set(HIP_NVCC_FLAGS "" CACHE STRING "Semicolon delimted flags for NVCC") mark_as_advanced(HIP_HIPCC_FLAGS HIP_HCC_FLAGS HIP_CLANG_FLAGS HIP_NVCC_FLAGS) + set(_hip_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo) list(REMOVE_DUPLICATES _hip_configuration_types) foreach(config ${_hip_configuration_types}) @@ -210,8 +211,13 @@ set(CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_DYNA set(HIP_CLANG_PARALLEL_BUILD_COMPILE_OPTIONS "") set(HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS "") -if("${HIP_COMPILER}" STREQUAL "hcc") - # Set the CMake Flags to use the HCC Compiler. +if("${HIP_COMPILER}" STREQUAL "nvcc") + # Set the CMake Flags to use the nvcc Compiler. + set(CMAKE_HIP_CREATE_SHARED_LIBRARY "${HIP_HIPCC_CMAKE_LINKER_HELPER} -o ") + set(CMAKE_HIP_CREATE_SHARED_MODULE "${HIP_HIPCC_CMAKE_LINKER_HELPER} -o -shared" ) + set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} -o ") +elseif("${HIP_COMPILER}" STREQUAL "hcc") + # Set the CMake Flags to use the hcc Compiler. set(CMAKE_HIP_CREATE_SHARED_LIBRARY "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_HOME} -o ") set(CMAKE_HIP_CREATE_SHARED_MODULE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_HOME} -o -shared" ) set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_HOME} -o ") @@ -226,7 +232,7 @@ elseif("${HIP_COMPILER}" STREQUAL "clang") endif() if(HIP_CLANG_NUM_PARALLEL_JOBS GREATER 1) if(${HIP_CLANG_SUPPORTS_PARALLEL_JOBS}) - set(HIP_CLANG_PARALLEL_BUILD_COMPILE_OPTIONS "-parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS} -Wno-format-nonliteral") + set(HIP_CLANG_PARALLEL_BUILD_COMPILE_OPTIONS "-Wno-format-nonliteral -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS}") set(HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS "-parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS}") else() message("clang compiler doesn't support parallel jobs") @@ -237,6 +243,13 @@ elseif("${HIP_COMPILER}" STREQUAL "clang") set(CMAKE_HIP_CREATE_SHARED_LIBRARY "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HIP_CLANG_PATH} ${HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS} -o ") set(CMAKE_HIP_CREATE_SHARED_MODULE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HIP_CLANG_PATH} ${HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS} -o -shared" ) set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HIP_CLANG_PATH} ${HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS} -o ") + + if("${HIP_RUNTIME}" STREQUAL "rocclr") + if(TARGET host) + message(STATUS "host interface - found") + set(HIP_HOST_INTERFACE host) + endif() + endif() endif() ############################################################################### @@ -624,29 +637,42 @@ macro(HIP_ADD_EXECUTABLE hip_target) endif() if("${HIP_COMPILER}" STREQUAL "hcc") if("x${HCC_HOME}" STREQUAL "x") - if (DEFINED $ENV{ROCM_PATH}) - set(HCC_HOME "$ENV{ROCM_PATH}/hcc") - elseif( DEFINED $ENV{HIP_PATH}) - set(HCC_HOME "$ENV{HIP_PATH}/../hcc") + if (DEFINED ENV{ROCM_PATH}) + set(HCC_HOME "$ENV{ROCM_PATH}/hcc") + elseif(DEFINED ENV{HIP_PATH}) + set(HCC_HOME "$ENV{HIP_PATH}/../hcc") else() - set(HCC_HOME "/opt/rocm/hcc") + set(HCC_HOME "/opt/rocm/hcc") endif() endif() set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_HOME} -o ") elseif("${HIP_COMPILER}" STREQUAL "clang") - if("x${HIP_CLANG_PATH}" STREQUAL "x") - if (DEFINED $ENV{ROCM_PATH}) - set(HIP_CLANG_PATH "$ENV{ROCM_PATH}/llvm/bin") - elseif( DEFINED $ENV{HIP_PATH}) - set(HIP_CLANG_PATH "$ENV{HIP_PATH}/../llvm/bin") + if("x${HIP_CLANG_PATH}" STREQUAL "x") + if(DEFINED ENV{HIP_CLANG_PATH}) + set(HIP_CLANG_PATH $ENV{HIP_CLANG_PATH}) + elseif(DEFINED ENV{ROCM_PATH}) + set(HIP_CLANG_PATH "$ENV{ROCM_PATH}/llvm/bin") + elseif(DEFINED ENV{HIP_PATH}) + set(HIP_CLANG_PATH "$ENV{HIP_PATH}/../llvm/bin") else() - set(HIP_CLANG_PATH "/opt/rocm/llvm/bin") + set(HIP_CLANG_PATH "/opt/rocm/llvm/bin") endif() endif() set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HIP_CLANG_PATH} ${HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS} -o ") + else() + set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} -o ") + endif() + if ("${_sources}" STREQUAL "") + add_executable(${hip_target} ${_cmake_options} ${_generated_files} "") + else() + add_executable(${hip_target} ${_cmake_options} ${_generated_files} ${_sources}) endif() - add_executable(${hip_target} ${_cmake_options} ${_generated_files} ${_sources}) set_target_properties(${hip_target} PROPERTIES LINKER_LANGUAGE HIP) + # Link with host + if (HIP_HOST_INTERFACE) + # hip rt should be rocclr, compiler should be clang + target_link_libraries(${hip_target} ${HIP_HOST_INTERFACE}) + endif() endmacro() ############################################################################### @@ -659,8 +685,17 @@ macro(HIP_ADD_LIBRARY hip_target) if(_source_files) list(REMOVE_ITEM _sources ${_source_files}) endif() - add_library(${hip_target} ${_cmake_options} ${_generated_files} ${_sources}) + if ("${_sources}" STREQUAL "") + add_library(${hip_target} ${_cmake_options} ${_generated_files} "") + else() + add_library(${hip_target} ${_cmake_options} ${_generated_files} ${_sources}) + endif() set_target_properties(${hip_target} PROPERTIES LINKER_LANGUAGE ${HIP_C_OR_CXX}) + # Link with host + if (HIP_HOST_INTERFACE) + # hip rt should be rocclr, compiler should be clang + target_link_libraries(${hip_target} ${HIP_HOST_INTERFACE}) + endif() endmacro() # vim: ts=4:sw=4:expandtab:smartindent diff --git a/cmake/thirdparty/FindHIP/run_hipcc.cmake b/cmake/thirdparty/FindHIP/run_hipcc.cmake index ec8f91da5..f544b2541 100644 --- a/cmake/thirdparty/FindHIP/run_hipcc.cmake +++ b/cmake/thirdparty/FindHIP/run_hipcc.cmake @@ -53,7 +53,7 @@ execute_process(COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --compiler OUTPUT_VARIABLE H execute_process(COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --runtime OUTPUT_VARIABLE HIP_RUNTIME OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT host_flag) set(__CC ${HIP_HIPCC_EXECUTABLE}) - if("${HIP_PLATFORM}" STREQUAL "hcc") + if("${HIP_PLATFORM}" STREQUAL "amd") if("${HIP_COMPILER}" STREQUAL "hcc") if(NOT "x${HCC_HOME}" STREQUAL "x") set(ENV{HCC_HOME} ${HCC_HOME}) @@ -64,7 +64,7 @@ if(NOT host_flag) set(ENV{HIP_CLANG_PATH} ${HIP_CLANG_PATH}) endif() # Temporarily include HIP_HCC_FLAGS for HIP-Clang for PyTorch builds - set(__CC_FLAGS ${HIP_CLANG_PARALLEL_BUILD_COMPILE_OPTIONS} ${HIP_HIPCC_FLAGS} ${HIP_HCC_FLAGS} ${HIP_CLANG_FLAGS} ${HIP_HIPCC_FLAGS_${build_configuration}} ${HIP_CLANG_FLAGS_${build_configuration}}) + set(__CC_FLAGS ${HIP_CLANG_PARALLEL_BUILD_COMPILE_OPTIONS} ${HIP_HIPCC_FLAGS} ${HIP_HCC_FLAGS} ${HIP_CLANG_FLAGS} ${HIP_HIPCC_FLAGS_${build_configuration}} ${HIP_HCC_FLAGS_${build_configuration}} ${HIP_CLANG_FLAGS_${build_configuration}}) endif() else() set(__CC_FLAGS ${HIP_HIPCC_FLAGS} ${HIP_NVCC_FLAGS} ${HIP_HIPCC_FLAGS_${build_configuration}} ${HIP_NVCC_FLAGS_${build_configuration}}) From 3a9bc60f762d21b0e6eadab79b0eb053d326d857 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 18 Nov 2020 10:02:29 -0800 Subject: [PATCH 105/330] fix: mark changes made to FindHIP.cmake in PR #427 --- cmake/thirdparty/FindHIP.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index c644677e0..eabfa6e41 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -469,9 +469,11 @@ macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files set(include_directories_generator "$") list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") + ############ START BLT CHANGE ############ # Add the interface include directories set(interface_include_directories_generator "$") list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") + ############ END BLT CHANGE ############ get_directory_property(_hip_include_directories INCLUDE_DIRECTORIES) list(REMOVE_DUPLICATES _hip_include_directories) From c9d485bb345d7631d488ce940706923946411844 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 18 Nov 2020 10:15:38 -0800 Subject: [PATCH 106/330] update changelog to reflect updated HIP utils --- RELEASE-NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 2215978d5..bfa19d219 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -33,6 +33,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ as single string prefixed by ``SHELL:`` to prevent de-duplication of flags passed to ``target_link_options``. - For HIP-dependent builds, only add HCC include directory if it exists. +- HIP CMake utilities updated to AMD's latest version ### Fixed - ClangFormat checks now support multiple Python executable names From 9d028c1ba4c3dd0d4802f4414b131c54dbf206fd Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 18 Nov 2020 16:31:27 -0600 Subject: [PATCH 107/330] fix: discover coverage-related executables automatically --- cmake/SetupCodeCoverageReports.cmake | 9 ++++----- cmake/thirdparty/SetupThirdParty.cmake | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cmake/SetupCodeCoverageReports.cmake b/cmake/SetupCodeCoverageReports.cmake index 996037222..7cb8c5481 100644 --- a/cmake/SetupCodeCoverageReports.cmake +++ b/cmake/SetupCodeCoverageReports.cmake @@ -62,12 +62,12 @@ function(add_code_coverage_target _targetname _testrunner) # Cleanup lcov ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} --directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_SOURCE_DIR}/components --zerocounters - # Run tests - COMMAND ${_testrunner} ${ARGV2} + # Run tests - allow for failing tests + COMMAND ${_testrunner} ${ARGV2} || (exit 0) # Capture lcov counters and generating report - COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} --directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_SOURCE_DIR}/components --capture --output-file ${_targetname}.info - COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} --directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_SOURCE_DIR}/components --remove ${_targetname}.info '/usr/include/*' --output-file ${_targetname}.info.cleaned + COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} --directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_SOURCE_DIR}/src --capture --output-file ${_targetname}.info + COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} --directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_SOURCE_DIR}/src --remove ${_targetname}.info '/usr/include/*' --output-file ${_targetname}.info.cleaned COMMAND ${GENHTML_EXECUTABLE} -o ${_targetname} ${_targetname}.info.cleaned COMMAND ${CMAKE_COMMAND} -E remove ${_targetname}.info ${_targetname}.info.cleaned @@ -88,4 +88,3 @@ if(BLT_CODE_COVERAGE_REPORTS) add_code_coverage_target(coverage make test) message(STATUS "Code coverage: reports enabled via lcov, genthml, and gcov.") endif() - diff --git a/cmake/thirdparty/SetupThirdParty.cmake b/cmake/thirdparty/SetupThirdParty.cmake index 1280eb6e8..ca42612c7 100644 --- a/cmake/thirdparty/SetupThirdParty.cmake +++ b/cmake/thirdparty/SetupThirdParty.cmake @@ -115,3 +115,21 @@ if(CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja" blt_find_executable(NAME ClangTidy EXECUTABLES clang-tidy) endif() + +#------------------------------------ +# Code coverage +#------------------------------------ +if (ENABLE_COVERAGE) + # find_executable requires that the executables be enabled + set(ENABLE_GCOV ON) + set(ENABLE_LCOV ON) + set(ENABLE_GENHTML ON) + blt_find_executable(NAME gcov + EXECUTABLES gcov) + + blt_find_executable(NAME lcov + EXECUTABLES lcov) + + blt_find_executable(NAME genhtml + EXECUTABLES genhtml) +endif() From 556ad6d5909b80917e22416c61979c5681d922dd Mon Sep 17 00:00:00 2001 From: Kristi Belcher Date: Wed, 18 Nov 2020 16:32:31 -0800 Subject: [PATCH 108/330] updating Release notes --- RELEASE-NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 2215978d5..ff232fd33 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -52,6 +52,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ blt_add_code_checks; previously, these combinations were implied to be errors in BLT documentation, but BLT would not return an error in those cases. +- Check added to make sure that if HIP is enabled with fortran, the LINKER LANGUAGE + is not changed back to Fortran. ## [Version 0.3.6] - Release date 2020-07-27 From 6be8fc678611be3fee9573961cb4ee0d8af92fab Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 19 Nov 2020 09:13:46 -0600 Subject: [PATCH 109/330] docs: document new user-facing coverage macro --- cmake/SetupCodeCoverageReports.cmake | 69 ++++++++++++++++++++-------- docs/api/code_metric.rst | 43 +++++++++++++++++ docs/api/index.rst | 1 + 3 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 docs/api/code_metric.rst diff --git a/cmake/SetupCodeCoverageReports.cmake b/cmake/SetupCodeCoverageReports.cmake index 7cb8c5481..d6dd95bd8 100644 --- a/cmake/SetupCodeCoverageReports.cmake +++ b/cmake/SetupCodeCoverageReports.cmake @@ -21,6 +21,8 @@ # 2017-07-25, Cyrus Harrison # - Refactored to only include report gen logic, not coverage flags # +# 2020-11-18, Josh Essman +# - Continue generation after failing tests, allow user to specify src dir set(BLT_CODE_COVERAGE_REPORTS ON) @@ -45,46 +47,73 @@ endif() mark_as_advanced(BLT_CODE_COVERAGE_REPORTS) -###################################################################### -# Function that adds target that generates code coverage reports -##################################################################### -# Param _targetname The name of new the custom make target and output file name. -# Param _testrunner The name of the target which runs the tests. -# MUST return ZERO always, even on errors. -# If not, no coverage report will be created! -# Optional fourth parameter is passed as arguments to _testrunner -# Pass them in list form, e.g.: "-j;2" for -j 2 -function(add_code_coverage_target _targetname _testrunner) +##------------------------------------------------------------------------------ +## blt_add_code_coverage_target( NAME +## RUNNER +## SOURCE_DIRECTORIES [dir1 [dir2 ...]]) +## +## Creates a new target with the given NAME that generates a code coverage report. +##------------------------------------------------------------------------------ +function(blt_add_code_coverage_target) + + set(options) + set(singleValueArgs NAME) + set(multiValueArgs RUNNER SOURCE_DIRECTORIES) + + # parse the arguments + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # Check/Set required parameters + if(NOT DEFINED arg_NAME) + message(FATAL_ERROR "blt_add_code_coverage_target requires a NAME parameter") + endif() + + if(NOT DEFINED arg_RUNNER) + message(FATAL_ERROR "blt_add_code_coverage_target requires a RUNNER parameter") + endif() + + set(_coverage_directories "--directory=${CMAKE_BINARY_DIR}") + if(DEFINED arg_SOURCE_DIRECTORIES) + foreach(_src_dir ${arg_SOURCE_DIRECTORIES}) + list(APPEND _coverage_directories "--directory=${_src_dir}") + endforeach() + else() + # Default to everything + list(APPEND _coverage_directories "--directory=${CMAKE_CURRENT_SOURCE_DIR}") + endif() # Setup target - add_custom_target(${_targetname} + add_custom_target(${arg_NAME} # Cleanup lcov - ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} --directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_SOURCE_DIR}/components --zerocounters + ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} ${_coverage_directories} --zerocounters # Run tests - allow for failing tests - COMMAND ${_testrunner} ${ARGV2} || (exit 0) + COMMAND ${arg_RUNNER} || (exit 0) # Capture lcov counters and generating report - COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} --directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_SOURCE_DIR}/src --capture --output-file ${_targetname}.info - COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} --directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_SOURCE_DIR}/src --remove ${_targetname}.info '/usr/include/*' --output-file ${_targetname}.info.cleaned - COMMAND ${GENHTML_EXECUTABLE} -o ${_targetname} ${_targetname}.info.cleaned - COMMAND ${CMAKE_COMMAND} -E remove ${_targetname}.info ${_targetname}.info.cleaned + COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} ${_coverage_directories} --capture --output-file ${arg_NAME}.info + COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} ${_coverage_directories} --remove ${arg_NAME}.info '/usr/include/*' --output-file ${arg_NAME}.info.cleaned + COMMAND ${GENHTML_EXECUTABLE} -o ${arg_NAME} ${arg_NAME}.info.cleaned + COMMAND ${CMAKE_COMMAND} -E remove ${arg_NAME}.info ${arg_NAME}.info.cleaned WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." ) # Show info where to find the report - add_custom_command(TARGET ${_targetname} POST_BUILD + add_custom_command(TARGET ${arg_NAME} POST_BUILD COMMAND ; - COMMENT "Open ./${_targetname}/index.html in your browser to view the coverage report." + COMMENT "Open ./${arg_NAME}/index.html in your browser to view the coverage report." ) endfunction() if(BLT_CODE_COVERAGE_REPORTS) # Add code coverage target - add_code_coverage_target(coverage make test) + blt_add_code_coverage_target(NAME coverage + RUNNER make test + SOURCE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src) message(STATUS "Code coverage: reports enabled via lcov, genthml, and gcov.") endif() diff --git a/docs/api/code_metric.rst b/docs/api/code_metric.rst new file mode 100644 index 000000000..3a76fe127 --- /dev/null +++ b/docs/api/code_metric.rst @@ -0,0 +1,43 @@ +.. # Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +Code Metric Macros +================== + +blt_add_code_coverage_target +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + blt_add_code_coverage_target( NAME + RUNNER + SOURCE_DIRECTORIES [dir1 [dir2 ...]]) + +Creates a new build target for generating a code coverage report. + +NAME + Name of created build target + +RUNNER + The command used to run the tests, e.g., ``make test`` + +SOURCE_DIRECTORIES + The directories containing the source code whose test coverage is to be evaluated + +Code coverage is the degree to which the tests for a piece of software "cover" functions +and/or individual lines of code. It can be used to identify gaps in testing, namely, code +that is not tested. GCC's ``gcov`` tool is used to generate the coverage data, and its accompanying +``lcov`` tool is used to generate an HTML report containing coverage percentage information and +highlighted source code that indicates which code was or was not executed as part of the test suite. + +.. note:: + Coverage analysis is only supported by GNU/Clang compilers. + +This functionality requires that BLT's ``ENABLE_COVERAGE`` option is enabled and that ``gcov``, ``lcov``, +and ``genhtml`` are present on your system. + +.. note:: + The ``ENABLE_COVERAGE`` option will add compiler flags that instrument your code (and slow it down). + The option should never be enabled by default in a project for performance reasons. diff --git a/docs/api/index.rst b/docs/api/index.rst index cee8969f4..a599d0f87 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -14,4 +14,5 @@ API Documentation utility git code_check + code_metric documentation From ee4e1920c76a1b51e5863b724f7274c8827165a0 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 19 Nov 2020 09:23:30 -0600 Subject: [PATCH 110/330] fix: preserve behavior of default coverage target --- cmake/SetupCodeCoverageReports.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake/SetupCodeCoverageReports.cmake b/cmake/SetupCodeCoverageReports.cmake index d6dd95bd8..3b8e83a66 100644 --- a/cmake/SetupCodeCoverageReports.cmake +++ b/cmake/SetupCodeCoverageReports.cmake @@ -112,8 +112,6 @@ endfunction() if(BLT_CODE_COVERAGE_REPORTS) # Add code coverage target - blt_add_code_coverage_target(NAME coverage - RUNNER make test - SOURCE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src) + blt_add_code_coverage_target(NAME coverage RUNNER make test) message(STATUS "Code coverage: reports enabled via lcov, genthml, and gcov.") endif() From b7b4eaeb38d459bdb0dc7db7ff6048ff5bf839c6 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 20:42:25 -0700 Subject: [PATCH 111/330] feat: cmake-format: expose ENABLE_CMAKEFORMAT var This commit adds an ENABLE_CMAKEFORMAT variable intended for eventual use in supporting CMake source beautification via [cmake format](https://github.com/cheshirekow/cmake_format). --- cmake/BLTOptions.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index 2f6822aa5..dd9c61722 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -37,6 +37,7 @@ option(ENABLE_ASTYLE "Enables AStyle support" ON) option(ENABLE_CLANGFORMAT "Enables ClangFormat support" ON) option(ENABLE_UNCRUSTIFY "Enables Uncrustify support" ON) option(ENABLE_YAPF "Enables Yapf support" ON) +option(ENABLE_CMAKEFORMAT "Enables CMakeFormat support" OFF) #------------------------------------------------------------------------------ # Build Options From 13a15382c5e10e801c59748f529678b0e559c75b Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 20:46:16 -0700 Subject: [PATCH 112/330] feat: cmake-format: find executable This commit adds code to find the `cmake-format` executable as part of adding CMake formatter intrastructure to BLT. fix: del trailing whitespace in setup 3rd party --- cmake/thirdparty/SetupThirdParty.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/thirdparty/SetupThirdParty.cmake b/cmake/thirdparty/SetupThirdParty.cmake index 1280eb6e8..357677688 100644 --- a/cmake/thirdparty/SetupThirdParty.cmake +++ b/cmake/thirdparty/SetupThirdParty.cmake @@ -98,6 +98,10 @@ blt_find_executable(NAME Uncrustify blt_find_executable(NAME Yapf EXECUTABLES yapf) +blt_find_executable(NAME CMakeFormat + EXECUTABLES cmake-format) + + #------------------------------------ # Static analysis via Cppcheck #------------------------------------ From b32f16a67f87e483f9c53a1fb897f84fa8a86f82 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 20:50:53 -0700 Subject: [PATCH 113/330] feat: add cmakeformat_style and cmakeformat_check This commit adds the cmakeformat_style and cmakeformat_check targets in preparation for supporting CMake code beautification using cmake-format. --- cmake/SetupCodeChecks.cmake | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 8a973ed68..5ad30d555 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -54,6 +54,17 @@ if(YAPF_FOUND) add_custom_target(yapf_style) add_dependencies(${BLT_CODE_STYLE_TARGET_NAME} yapf_style) endif() + +if(CMAKEFORMAT_FOUND) + set(BLT_REQUIRED_CMAKEFORMAT_VERSION "" CACHE STRING "Required version of cmake-format") + # targets for verifying formatting + add_custom_target(cmakeformat_check) + add_dependencies(${BLT_CODE_CHECK_TARGET_NAME} cmakeformat_check) + + # targets for modifying formatting + add_custom_target(cmakeformat_style) + add_dependencies(${BLT_CODE_STYLE_TARGET_NAME} cmakeformat_style) +endif() if(CPPCHECK_FOUND) add_custom_target(cppcheck_check) @@ -78,8 +89,8 @@ endif() # Code check targets should only be run on demand foreach(target - check yapf_check uncrustify_check astyle_check clangformat_check cppcheck_check - style yapf_style uncrustify_style astyle_style clangformat_style + check cmakeformat_check yapf_check uncrustify_check astyle_check clangformat_check cppcheck_check + style cmakeformat_style yapf_style uncrustify_style astyle_style clangformat_style clang_query_check interactive_clang_query_check clang_tidy_check) if(TARGET ${target}) set_property(TARGET ${target} PROPERTY EXCLUDE_FROM_ALL TRUE) From 515a60e624b69ccfc98fb483a458c5e860c12cd0 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 21:11:54 -0700 Subject: [PATCH 114/330] feat: expose blt_cmake_file_exts setting This commit exposes a BLT variable named BLT_CMAKE_FILE_EXTS that holds a list of file extensions for CMake source files as part of implementing CMake code beautification support using cmake-format. --- SetupBLT.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SetupBLT.cmake b/SetupBLT.cmake index bfe1553cf..255bb89b9 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -178,6 +178,8 @@ if (NOT BLT_LOADED) CACHE STRING "List of known file extensions used for Fortran sources") set(BLT_Python_FILE_EXTS ".py" CACHE STRING "List of known file extensions used for Python sources") + set(BLT_CMAKE_FILE_EXTS ".cmake" # NOTE: CMakeLists.txt handled elsewhere + CACHE STRING "List of known file extensions used for CMake sources") ################################ # Setup compiler options From 58854db94f04a95ced69faa9eb068f9a3378efda Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 21:25:05 -0700 Subject: [PATCH 115/330] feat: blt split src list by lang: add cmake This commit adds a CMAKE_LIST output to the blt_split_source_list_by_language CMake macro as part of adding CMake code beautifier support to BLT using cmake-format. Checks for HIP or CUDA code do not filter for Python sources because the blt_add_cuda_target, blt_add_hip_library, and blt_add_hip_executable targets are intended for compiling source code, which is inapplicable to CMake source files. --- cmake/BLTPrivateMacros.cmake | 21 ++++++++++++++------- cmake/SetupCodeChecks.cmake | 4 +++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index a0f3a8dd1..d3e45c571 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -581,18 +581,19 @@ endmacro(blt_add_hip_executable) ## C_LIST ## Fortran_LIST ## Python_LIST ) +## CMAKE_LIST ) ## -## Filters source list by file extension into C/C++, Fortran, and -## Python source lists based on the global BLT variables -## BLT_C_FILE_EXTS, BLT_Fortran_FILE_EXTS, and BLT_Python_FILE_EXTS, -## respectively. Files with no extension or generator expressions -## that are not object libraries (of the form +## Filters source list by file extension into C/C++, Fortran, Python, and +## CMake source lists based on BLT_C_FILE_EXTS, BLT_Fortran_FILE_EXTS, +## and BLT_CMAKE_FILE_EXTS (global BLT variables). Files named +## "CMakeLists.txt" are also filtered here. Files with no extension +## or generator expressions that are not object libraries (of the form ## "$") will throw fatal errors. ## ------------------------------------------------------------------------------ macro(blt_split_source_list_by_language) set(options) - set(singleValueArgs C_LIST Fortran_LIST Python_LIST) + set(singleValueArgs C_LIST Fortran_LIST Python_LIST CMAKE_LIST) set(multiValueArgs SOURCES) # Parse the arguments @@ -619,6 +620,8 @@ macro(blt_split_source_list_by_language) message(FATAL_ERROR "blt_split_source_list_by_language given source file with no extension: ${_file}") endif() + get_filename_component(_name ${_file} NAME) + string(TOLOWER ${_ext} _ext_lower) if(${_ext_lower} IN_LIST BLT_C_FILE_EXTS) @@ -633,8 +636,12 @@ macro(blt_split_source_list_by_language) if (DEFINED arg_Python_LIST) list(APPEND ${arg_Python_LIST} ${_file}) endif() + elseif(${_ext_lower} IN_LIST BLT_CMAKE_FILE_EXTS OR ${_name} STREQUAL "CMakeLists.txt") + if (DEFINED arg_CMAKE_LIST) + list(APPEND ${arg_CMAKE_LIST} ${_file}) + endif() else() - message(FATAL_ERROR "blt_split_source_list_by_language given source file with unknown file extension. Add the missing extension to the corresponding list (BLT_C_FILE_EXTS, BLT_Fortran_FILE_EXTS, or BLT_Python_FILE_EXTS).\n Unknown file: ${_file}") + message(FATAL_ERROR "blt_split_source_list_by_language given source file with unknown file extension. Add the missing extension to the corresponding list (BLT_C_FILE_EXTS, BLT_Fortran_FILE_EXTS, BLT_Python_FILE_EXTS, or BLT_CMAKE_FILE_EXTS).\n Unknown file: ${_file}") endif() endforeach() diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 5ad30d555..22eea74be 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -148,10 +148,12 @@ macro(blt_add_code_checks) set(_c_sources) set(_f_sources) set(_py_sources) + set(_cmake_sources) blt_split_source_list_by_language(SOURCES ${_rel_sources} C_LIST _c_sources Fortran_LIST _f_sources - Python_LIST _py_sources) + Python_LIST _py_sources + CMAKE_LIST _cmake_sources) # Check that no more than one formatting config file was supplied # for C-style languages. From ed2134404dcfed87718e40195ed68e22d4035f16 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 21:41:06 -0700 Subject: [PATCH 116/330] feat: add blt_add_cmakeformat_target CMake macro This commit adds a blt_add_cmakeformat_target CMake macro as part of adding CMake beautification support using the cmake-format source code beautifier. This macro is written by analogy to the blt_add_astyle_target, blt_add_clangformat_target, and blt_add_uncrustify_target macros, and exposes a means to invoke cmake-format on a collection of (CMake) source files. --- cmake/SetupCodeChecks.cmake | 96 +++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 22eea74be..a48cc6865 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -909,3 +909,99 @@ macro(blt_add_yapf_target) set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) endif() endmacro(blt_add_yapf_target) + + +##------------------------------------------------------------------------------ +## blt_add_cmakeformat_target( NAME +## MODIFY_FILES [TRUE | FALSE (default)] +## CFG_FILE +## PREPEND_FLAGS +## APPEND_FLAGS +## COMMENT +## WORKING_DIRECTORY +## SRC_FILES [FILE1 [FILE2 ...]] ) +## +## Creates a new target with the given NAME for running cmake-format over the given SRC_FILES. +##------------------------------------------------------------------------------ +macro(blt_add_cmakeformat_target) + + ## parse the arguments to the macro + set(options) + set(singleValueArgs NAME MODIFY_FILES CFG_FILE COMMENT WORKING_DIRECTORY) + set(multiValueArgs SRC_FILES PREPEND_FLAGS APPEND_FLAGS) + + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # Check/Set required parameters + if(NOT DEFINED arg_NAME) + message(FATAL_ERROR "blt_add_cmakeformat_target requires a NAME parameter") + endif() + + if(NOT DEFINED arg_CFG_FILE) + message(FATAL_ERROR "blt_add_cmakeformat_target requires a CFG_FILE parameter") + endif() + + if(NOT DEFINED arg_SRC_FILES) + message(FATAL_ERROR "blt_add_cmakeformat_target requires a SRC_FILES parameter") + endif() + + if(NOT DEFINED arg_MODIFY_FILES) + set(arg_MODIFY_FILES FALSE) + endif() + + if(DEFINED arg_WORKING_DIRECTORY) + set(_wd ${arg_WORKING_DIRECTORY}) + else() + set(_wd ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + set(_generate_target TRUE) + + # Check the version -- output is of the form "X.Y.Z" + execute_process( + COMMAND ${CMAKEFORMAT_EXECUTABLE} --version + OUTPUT_VARIABLE _version_str + ERROR_VARIABLE _version_str + OUTPUT_STRIP_TRAILING_WHITESPACE ) + string(REGEX MATCH "([0-9]+(\\.)?)+$" _cmakeformat_version ${_version_str}) + + if(BLT_REQUIRED_CMAKEFORMAT_VERSION) + # The user may only specify a part of the version (e.g. just the maj ver) + # so check for substring + string(FIND "${_cmakeformat_version}" ${BLT_REQUIRED_CMAKEFORMAT_VERSION} VERSION_POS) + if (NOT VERSION_POS EQUAL 0) + set(_generate_target FALSE) + if(NOT _BLT_STYLE_VERSION_WARNING_ISSUED) + message(WARNING "blt_add_cmakeformat_target: cmake-format '${BLT_REQUIRED_CMAKEFORMAT_VERSION}' is required, found '${_cmakeformat_version}'. Disabling 'style' build target.") + set(_BLT_STYLE_VERSION_WARNING_ISSUED TRUE CACHE BOOL "Limits BLT issuing more than one warning for style version" FORCE) + endif() + endif() + endif() + + if(${arg_MODIFY_FILES}) + set(MODIFY_FILES_FLAG --in-place) + else() + set(MODIFY_FILES_FLAG --check) + endif() + + if(_generate_target) + add_custom_target( + ${arg_NAME} + COMMAND ${CMAKEFORMAT_EXECUTABLE} ${arg_PREPEND_FLAGS} + --config-files ${arg_CFG_FILE} ${MODIFY_FILES_FLAG} ${arg_SRC_FILES} ${arg_APPEND_FLAGS} + WORKING_DIRECTORY ${_wd} + COMMENT "${arg_COMMENT}Running CMakeFormat source code formatting checks.") + + # Hook our new target into the proper dependency chain + if(${arg_MODIFY_FILES}) + add_dependencies(cmakeformat_style ${arg_NAME}) + else() + add_dependencies(cmakeformat_check ${arg_NAME}) + endif() + + # Code formatting targets should only be run on demand + set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_ALL TRUE) + set_property(TARGET ${arg_NAME} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE) + endif() +endmacro(blt_add_cmakeformat_target) From 9b9b7938991d6e479dbfa9e9df1e871ed13d2640 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 21:50:25 -0700 Subject: [PATCH 117/330] feat: blt_add_code_checks: add cmake-format calls This commit adds conditional invocations of the blt_add_cmakeformat_target CMake macro to the blt_add_code_checks CMake macro in order to call cmake-format on CMake source files. These changes are made as part of adding support to configure CMake beautification using cmake-format. --- cmake/SetupCodeChecks.cmake | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index a48cc6865..c188ca43e 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -106,6 +106,7 @@ endforeach() ## CLANGFORMAT_CFG_FILE ## UNCRUSTIFY_CFG_FILE ## YAPF_CFG_FILE +## CMAKEFORMAT_CFG_FILE ## CPPCHECK_FLAGS ## CLANGQUERY_CHECKER_DIRECTORIES [dir1 [dir2]]) ## @@ -116,7 +117,7 @@ endforeach() macro(blt_add_code_checks) set(options ) - set(singleValueArgs PREFIX ASTYLE_CFG_FILE CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE YAPF_CFG_FILE) + set(singleValueArgs PREFIX ASTYLE_CFG_FILE CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE YAPF_CFG_FILE CMAKEFORMAT_CFG_FILE) set(multiValueArgs SOURCES CPPCHECK_FLAGS CLANGQUERY_CHECKER_DIRECTORIES) cmake_parse_arguments(arg @@ -253,6 +254,25 @@ macro(blt_add_code_checks) SRC_FILES ${_py_sources} ) endif() + if (CMAKEFORMAT_FOUND AND DEFINED arg_CMAKEFORMAT_CFG_FILE) + set(_check_target_name ${arg_PREFIX}_cmakeformat_check) + blt_error_if_target_exists(${_check_target_name} ${_error_msg}) + set(_style_target_name ${arg_PREFIX}_cmakeformat_style) + blt_error_if_target_exists(${_style_target_name} ${_error_msg}) + + blt_add_cmakeformat_target( NAME ${_check_target_name} + MODIFY_FILES FALSE + CFG_FILE ${arg_CMAKEFORMAT_CFG_FILE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + SRC_FILES ${_cmake_sources} ) + + blt_add_cmakeformat_target( NAME ${_style_target_name} + MODIFY_FILES TRUE + CFG_FILE ${arg_CMAKEFORMAT_CFG_FILE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + SRC_FILES ${_cmake_sources} ) + endif() + if (CPPCHECK_FOUND) set(_cppcheck_target_name ${arg_PREFIX}_cppcheck_check) blt_error_if_target_exists(${_cppcheck_target_name} ${_error_msg}) From 0b6f2f063fdaf9852784fd923af650f128dd6845 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 22:08:04 -0700 Subject: [PATCH 118/330] feat: add blt_add_cmakeformat_target to api docs This commit adds documentation on the blt_add_cmakeformat_target CMake macro to the BLT API documentation as part of providing support for CMake source code beautification using cmake-format. --- docs/api/code_check.rst | 75 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 7 deletions(-) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 73878058a..b4742aa85 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -17,6 +17,7 @@ blt_add_code_checks CLANGFORMAT_CFG_FILE UNCRUSTIFY_CFG_FILE YAPF_CFG_FILE + CMAKEFORMAT_CFG_FILE CPPCHECK_FLAGS CLANGQUERY_CHECKER_DIRECTORIES [dir1 [dir2]]) @@ -41,6 +42,9 @@ UNCRUSTIFY_CFG_FILE YAPF_CFG_FILE Path to Yapf config file +CMAKEFORMAT_CFG_FILE + Path to CMakeFormat config file + CPPCHECK_FLAGS List of flags added to Cppcheck @@ -57,10 +61,11 @@ functionality you will need to call the individual code check macros yourself. other codes. The following check `if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")` will stop your code checks from running unless you are the main CMake project. -Sources are filtered based on file extensions for use in these code checks. If you need -additional file extensions defined add them to BLT_C_FILE_EXTS, BLT_Python_FILE_EXTS, and -BLT_Fortran_FILE_EXTS. Currently this macro only has code checks for C/C++ and Python; it -simply filters out the Fortran files. +Sources are filtered based on file extensions for use in these code +checks. If you need additional file extensions defined add them to +BLT_C_FILE_EXTS, BLT_Python_FILE_EXTS, BLT_CMAKE_FILE_EXTS, and +BLT_Fortran_FILE_EXTS. Currently this macro only has code checks for +C/C++ and Python; it simply filters out the Fortran files. This macro supports C/C++ code formatting with either AStyle, ClangFormat, or Uncrustify (but not all at the same time) only if the following requirements are met: @@ -90,14 +95,20 @@ are met: * YAPF_CFG_FILE is given * YAPF_EXECUTABLE is defined and found prior to calling this macro +This macro also supports CMake code formatting with CMakeFormat only if the following requirements are met: + +* CMAKEFORMAT_CFG_FILE is given +* CMAKEFORMAT_EXECUTABLE is defined and found prior to calling this macro + Enabled code formatting checks produce a `check` build target that will test to see if you are out of compliance with your code formatting and a `style` build target that will actually modify your source files. It also creates smaller child build targets that follow the pattern `__`. -If a particular version of a code formatting tool is required, you can configure BLT to enforce -that version by setting ``BLT_REQUIRED__VERSION`` to as much of the version -as you need. For example: +If a particular version of a code formatting tool is required, you can +configure BLT to enforce that version by setting +``BLT_REQUIRED__VERSION`` +to as much of the version as you need. For example: .. code-block:: cmake @@ -418,6 +429,7 @@ which files do not conform to your style guide. .. Note:: Setting MODIFY_FILES to FALSE is only supported in Uncrustify v0.61 or greater. + blt_add_yapf_target ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -465,3 +477,52 @@ When MODIFY_FILES is set to TRUE, modifies the files in place and adds the creat target to the parent `style` build target. Otherwise the files are not modified and the created target is added to the parent `check` build target. This target will notify you which files do not conform to your style guide. + + +blt_add_cmakeformat_target +~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + blt_add_cmakeformat_target( NAME + MODIFY_FILES [TRUE | FALSE (default)] + CFG_FILE + PREPEND_FLAGS + APPEND_FLAGS + COMMENT + WORKING_DIRECTORY + SRC_FILES [FILE1 [FILE2 ...]] ) + +Creates a new build target for running CMakeFormat + +NAME + Name of created build target + +MODIFY_FILES + Modify the files in place. Defaults to FALSE. + +CFG_FILE + Path to CMakeFormat config file + +PREPEND_FLAGS + Additional flags added to the front of the CMakeFormat flags + +APPEND_FLAGS + Additional flags added to the end of the CMakeFormat flags + +COMMENT + Comment prepended to the build target output + +WORKING_DIRECTORY + Directory in which the CMakeFormat command is run. Defaults to where macro is called. + +SRC_FILES + Source list that CMakeFormat will be ran on + +CMakeFormat is a Source Code Beautifier for CMake code. More information about +CMakeFormat can be found `here `_. + +When MODIFY_FILES is set to TRUE, modifies the files in place and adds the created build +target to the parent `style` build target. Otherwise the files are not modified and the +created target is added to the parent `check` build target. This target will notify you +which files do not conform to your style guide. From 10da12edf34b371c78183e103bad9b88b4bbfc7f Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 22:12:37 -0700 Subject: [PATCH 119/330] feat: add cmake-format support to release notes This commit adds to the release notes the just-implemented support for formatting CMake source code using cmake-format. --- RELEASE-NOTES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index bfa19d219..dd8ff3f9a 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -25,8 +25,9 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added support for formatting Python code using YAPF. - Added new ``blt_import_library`` macro that creates a real CMake target for imported libraries, intended to be used instead of ``blt_register_library`` whenever possible -- Added new ``blt_patch_target`` macro to simplify modifying properties of an existing CMake target. +- Added new ``blt_patch_target`` macro to simplify modifying properties of an existing CMake target. This macro accounts for known differences in compilers, target types, and CMake releases. +- Added support for formatting CMake code using cmake-format. ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed From cc0b952c1a8821f29b364c4cee3b854369fac1cf Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 22:15:31 -0700 Subject: [PATCH 120/330] feat: set ENABLE_CMAKEFORMAT to ON by default This commit sets the ENABLE_CMAKEFORMAT CMake variable to ON to enable support for CMake source code formatting using cmake-format by default. --- cmake/BLTOptions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index dd9c61722..f0e06fff6 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -37,7 +37,7 @@ option(ENABLE_ASTYLE "Enables AStyle support" ON) option(ENABLE_CLANGFORMAT "Enables ClangFormat support" ON) option(ENABLE_UNCRUSTIFY "Enables Uncrustify support" ON) option(ENABLE_YAPF "Enables Yapf support" ON) -option(ENABLE_CMAKEFORMAT "Enables CMakeFormat support" OFF) +option(ENABLE_CMAKEFORMAT "Enables CMakeFormat support" ON) #------------------------------------------------------------------------------ # Build Options From 8482229ee1b86bdeb51f2a992c4afd505eb7f550 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Fri, 30 Oct 2020 22:45:50 -0700 Subject: [PATCH 121/330] feat: add internal cmake-format style/check tests This commit adds some internal tests of cmake-format styling and checking using examples from the cmake-format documentation. * tests/internal/cmake_format_style.py is a cmake-format configuration in Python format generated via the command cmake-format --dump-config python > tests/internal/cmake_format_style.py This command outputs the default cmake-format configuration to stdout and redirects stdout to the file above. The cmake-format version used is version 0.6.13 from pip and should probably be changed if a different cmake-format version is used. * tests/internal/src/test_cmake_format_nonconformant.cmake is a CMake source file that should change if cmake-format is run on it using the cmake-format configuration above; after running cmake-format on it, its contents should match those of test_cmake_format_conformant.cmake. Rather than use an example from the cmake-format documentation, this file is the version of cmake/SetupCodeChecks.cmake as of this commit. * tests/internal/src/test_cmake_format_conformant.cmake is a CMake source file that should not change if cmake-format is run on it using the cmake-format configuration above. It is generated via the command cp tests/internal/src/test_cmake_format_nonconformant.cmake \ tests/internal/src/test_cmake_format_conformant.cmake && \ cmake-format -c tests/internal/cmake_format_style.py \ --in-place tests/internal/src/test_cmake_format_conformant.cmake --- tests/internal/CMakeLists.txt | 23 ++ tests/internal/cmake_format_style.py | 244 ++++++++++++++++++ .../src/test_cmake_format_conformant.cmake | 55 ++++ .../src/test_cmake_format_nonconformant.cmake | 38 +++ 4 files changed, 360 insertions(+) create mode 100644 tests/internal/cmake_format_style.py create mode 100644 tests/internal/src/test_cmake_format_conformant.cmake create mode 100644 tests/internal/src/test_cmake_format_nonconformant.cmake diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index b0ba798ce..b74f3e1bb 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -367,8 +367,31 @@ if(YAPF_FOUND) YAPF_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yapf.cfg) endif() # end if(YAPF_FOUND) +if (CMAKEFORMAT_FOUND) + # Test case where a style target running cmake-format should do nothing, and + # a corresponding check target should return 0 + set(internal_conformant_cmake_srcs + src/test_cmake_format_conformant.cmake) + + blt_add_code_checks( + PREFIX cmake_format_conformant_tests + SOURCES ${internal_conformant_cmake_srcs} + CMAKEFORMAT_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake-format-style.py ) + # Test case where a style target running cmake-format should reformat the source file, + # and a corresponding check target should return a nonzero code + # + # After styling, cmake_format_conformant.cmake and + # cmake_format_nonconformant.cmake should have the same contents + set(internal_nonconformant_cmake_srcs + src/test_cmake_format_nonconformant.cmake) + blt_add_code_checks( + PREFIX cmake_format_nonconformant_tests + SOURCES ${internal_nonconformant_cmake_srcs} + CMAKEFORMAT_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake-format-style.py ) +endif() # end if(CMAKEFORMAT_FOUND) + # Check blt_add_test with a command that is not a target if(WIN32) configure_file(return_true_win32.in tests/return_true.bat COPYONLY) diff --git a/tests/internal/cmake_format_style.py b/tests/internal/cmake_format_style.py new file mode 100644 index 000000000..10fde7327 --- /dev/null +++ b/tests/internal/cmake_format_style.py @@ -0,0 +1,244 @@ +# This file was generated by running +# cmake-format --dump-config python + +# ---------------------------------- +# Options affecting listfile parsing +# ---------------------------------- +with section("parse"): + + # Specify structure for custom cmake functions + additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'], + 'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}} + + # Override configurations per-command where available + override_spec = {} + + # Specify variable tags. + vartags = [] + + # Specify property tags. + proptags = [] + +# ----------------------------- +# Options affecting formatting. +# ----------------------------- +with section("format"): + + # Disable formatting entirely, making cmake-format a no-op + disable = False + + # How wide to allow formatted cmake files + line_width = 80 + + # How many spaces to tab for indent + tab_size = 2 + + # If true, lines are indented using tab characters (utf-8 0x09) instead of + # space characters (utf-8 0x20). In cases where the layout would + # require a fractional tab character, the behavior of the fractional + # indentation is governed by + use_tabchars = False + + # If is True, then the value of this variable indicates how + # fractional indentions are handled during whitespace replacement. If set to + # 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set + # to `round-up` fractional indentation is replaced with a single tab character + # (utf-8 0x09) effectively shifting the column to the next tabstop + fractional_tab_policy = 'use-space' + + # If an argument group contains more than this many sub-groups (parg or kwarg + # groups) then force it to a vertical layout. + max_subgroups_hwrap = 2 + + # If a positional argument group contains more than this many arguments, then + # force it to a vertical layout. + max_pargs_hwrap = 6 + + # If a cmdline positional group consumes more than this many lines without + # nesting, then invalidate the layout (and nest) + max_rows_cmdline = 2 + + # If true, separate flow control names from their parentheses with a space + separate_ctrl_name_with_space = False + + # If true, separate function names from parentheses with a space + separate_fn_name_with_space = False + + # If a statement is wrapped to more than one line, than dangle the closing + # parenthesis on its own line. + dangle_parens = False + + # If the trailing parenthesis must be 'dangled' on its on line, then align it + # to this reference: `prefix`: the start of the statement, `prefix-indent`: + # the start of the statement, plus one indentation level, `child`: align to + # the column of the arguments + dangle_align = 'prefix' + + # If the statement spelling length (including space and parenthesis) is + # smaller than this amount, then force reject nested layouts. + min_prefix_chars = 4 + + # If the statement spelling length (including space and parenthesis) is larger + # than the tab width by more than this amount, then force reject un-nested + # layouts. + max_prefix_chars = 10 + + # If a candidate layout is wrapped horizontally but it exceeds this many + # lines, then reject the layout. + max_lines_hwrap = 2 + + # What style line endings to use in the output. + line_ending = 'unix' + + # Format command names consistently as 'lower' or 'upper' case + command_case = 'canonical' + + # Format keywords consistently as 'lower' or 'upper' case + keyword_case = 'unchanged' + + # A list of command names which should always be wrapped + always_wrap = [] + + # If true, the argument lists which are known to be sortable will be sorted + # lexicographicall + enable_sort = True + + # If true, the parsers may infer whether or not an argument list is sortable + # (without annotation). + autosort = False + + # By default, if cmake-format cannot successfully fit everything into the + # desired linewidth it will apply the last, most agressive attempt that it + # made. If this flag is True, however, cmake-format will print error, exit + # with non-zero status code, and write-out nothing + require_valid_layout = False + + # A dictionary mapping layout nodes to a list of wrap decisions. See the + # documentation for more information. + layout_passes = {} + +# ------------------------------------------------ +# Options affecting comment reflow and formatting. +# ------------------------------------------------ +with section("markup"): + + # What character to use for bulleted lists + bullet_char = '*' + + # What character to use as punctuation after numerals in an enumerated list + enum_char = '.' + + # If comment markup is enabled, don't reflow the first comment block in each + # listfile. Use this to preserve formatting of your copyright/license + # statements. + first_comment_is_literal = False + + # If comment markup is enabled, don't reflow any comment block which matches + # this (regex) pattern. Default is `None` (disabled). + literal_comment_pattern = None + + # Regular expression to match preformat fences in comments default= + # ``r'^\s*([`~]{3}[`~]*)(.*)$'`` + fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$' + + # Regular expression to match rulers in comments default= + # ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'`` + ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$' + + # If a comment line matches starts with this pattern then it is explicitly a + # trailing comment for the preceeding argument. Default is '#<' + explicit_trailing_pattern = '#<' + + # If a comment line starts with at least this many consecutive hash + # characters, then don't lstrip() them off. This allows for lazy hash rulers + # where the first hash char is not separated by space + hashruler_min_length = 10 + + # If true, then insert a space between the first hash char and remaining hash + # chars in a hash ruler, and normalize its length to fill the column + canonicalize_hashrulers = True + + # enable comment markup parsing and reflow + enable_markup = True + +# ---------------------------- +# Options affecting the linter +# ---------------------------- +with section("lint"): + + # a list of lint codes to disable + disabled_codes = [] + + # regular expression pattern describing valid function names + function_pattern = '[0-9a-z_]+' + + # regular expression pattern describing valid macro names + macro_pattern = '[0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with global + # (cache) scope + global_var_pattern = '[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with global + # scope (but internal semantic) + internal_var_pattern = '_[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with local + # scope + local_var_pattern = '[a-z][a-z0-9_]+' + + # regular expression pattern describing valid names for privatedirectory + # variables + private_var_pattern = '_[0-9a-z_]+' + + # regular expression pattern describing valid names for public directory + # variables + public_var_pattern = '[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for function/macro + # arguments and loop variables. + argument_var_pattern = '[a-z][a-z0-9_]+' + + # regular expression pattern describing valid names for keywords used in + # functions or macros + keyword_pattern = '[A-Z][0-9A-Z_]+' + + # In the heuristic for C0201, how many conditionals to match within a loop in + # before considering the loop a parser. + max_conditionals_custom_parser = 2 + + # Require at least this many newlines between statements + min_statement_spacing = 1 + + # Require no more than this many newlines between statements + max_statement_spacing = 2 + max_returns = 6 + max_branches = 12 + max_arguments = 5 + max_localvars = 15 + max_statements = 50 + +# ------------------------------- +# Options affecting file encoding +# ------------------------------- +with section("encode"): + + # If true, emit the unicode byte-order mark (BOM) at the start of the file + emit_byteorder_mark = False + + # Specify the encoding of the input file. Defaults to utf-8 + input_encoding = 'utf-8' + + # Specify the encoding of the output file. Defaults to utf-8. Note that cmake + # only claims to support utf-8 so be careful when using anything else + output_encoding = 'utf-8' + +# ------------------------------------- +# Miscellaneous configurations options. +# ------------------------------------- +with section("misc"): + + # A dictionary containing any per-command configuration overrides. Currently + # only `command_case` is supported. + per_command = {} + diff --git a/tests/internal/src/test_cmake_format_conformant.cmake b/tests/internal/src/test_cmake_format_conformant.cmake new file mode 100644 index 000000000..9cba56c9f --- /dev/null +++ b/tests/internal/src/test_cmake_format_conformant.cmake @@ -0,0 +1,55 @@ +# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and other +# BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) +# ------------------------------------------------------------------------------ +# Example CMake file used to test cmake-format +# ------------------------------------------------------------------------------ +macro(cmake_format_example) + # Test for 80 column wrap + set(greek_letters + alpha + beta + gamme + delta + epsilon + zeta + eta + theta + iota + kappa + lambda + mu + nu + xi + omicron + pi + rho + sigma + tau + upsilon + phi + chi + psi + omega) + + # Test for reflowing multi-line command to single line + set(shopkeeper "the" "frogurt" "is" "also" "cursed") + + # Test that cmake-format doesn't break up a long string argument + set(bird_physics_quote + "A five ounce bird could not carry a one pound coconut.") + + # Indent conditionals + if(first_condition) + if(second_condition) + # Condense blank lines below comment to single line + + # Reflow a long comment into multiple lines because it's extremely long -- + # longer than the line length limit. + set(foo bar baz quux) + + # Reflow a mulitple line short comment to a single line + endif() + endif() +endmacro() diff --git a/tests/internal/src/test_cmake_format_nonconformant.cmake b/tests/internal/src/test_cmake_format_nonconformant.cmake new file mode 100644 index 000000000..b36044366 --- /dev/null +++ b/tests/internal/src/test_cmake_format_nonconformant.cmake @@ -0,0 +1,38 @@ +# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and other +# BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) +# ------------------------------------------------------------------------------ +# Example CMake file used to test cmake-format +# ------------------------------------------------------------------------------ +macro(cmake_format_example) + # Test for 80 column wrap + set(greek_letters alpha beta gamme delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi rho sigma tau upsilon phi chi psi omega) + + # Test for reflowing multi-line command to single line + set(shopkeeper + "the" + "frogurt" + "is" + "also" + "cursed") + + # Test that cmake-format doesn't break up a long string argument + set(bird_physics_quote "A five ounce bird could not carry a one pound coconut.") + + # Indent conditionals + if(first_condition) + if(second_condition) + # Condense blank lines below comment to single line + + + + # Reflow a long comment into multiple lines because it's extremely long -- longer than the line length limit. + set(foo bar baz quux) + + # Reflow a mulitple + # line short comment + # to a single line + endif() + endif() +endmacro() From 648aba8200964a5c7687c7fdf16dae0d8f40ccf5 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Thu, 12 Nov 2020 21:39:11 -0800 Subject: [PATCH 122/330] fix: quote deref'd split src cmake suffix vars This commit quotes the dereferenced variables in the blt_split_source_list_by_language macro on lines changed in order to detect CMake files via their suffixes (i.e., their extensions). --- cmake/BLTPrivateMacros.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index d3e45c571..c5831f393 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -620,7 +620,7 @@ macro(blt_split_source_list_by_language) message(FATAL_ERROR "blt_split_source_list_by_language given source file with no extension: ${_file}") endif() - get_filename_component(_name ${_file} NAME) + get_filename_component(_name "${_file}" NAME) string(TOLOWER ${_ext} _ext_lower) @@ -636,9 +636,9 @@ macro(blt_split_source_list_by_language) if (DEFINED arg_Python_LIST) list(APPEND ${arg_Python_LIST} ${_file}) endif() - elseif(${_ext_lower} IN_LIST BLT_CMAKE_FILE_EXTS OR ${_name} STREQUAL "CMakeLists.txt") + elseif("${_ext_lower}" IN_LIST BLT_CMAKE_FILE_EXTS OR "${_name}" STREQUAL "CMakeLists.txt") if (DEFINED arg_CMAKE_LIST) - list(APPEND ${arg_CMAKE_LIST} ${_file}) + list(APPEND ${arg_CMAKE_LIST} "${_file}") endif() else() message(FATAL_ERROR "blt_split_source_list_by_language given source file with unknown file extension. Add the missing extension to the corresponding list (BLT_C_FILE_EXTS, BLT_Fortran_FILE_EXTS, BLT_Python_FILE_EXTS, or BLT_CMAKE_FILE_EXTS).\n Unknown file: ${_file}") From 84c6a170a8a5fe0cd0d948141df6ee86b74b3c87 Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Thu, 12 Nov 2020 21:51:18 -0800 Subject: [PATCH 123/330] fix: quote various deref'd vars in split src macro This commit quotes a number of dereferenced variables in the blt_split_source_by_language macro to guard against weirdness that happens if filenames have spaces or arguments are empty strings. --- cmake/BLTPrivateMacros.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index c5831f393..a2610a5bf 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -615,26 +615,26 @@ macro(blt_split_source_list_by_language) message(FATAL_ERROR "blt_split_source_list_by_language macro does not support generator expressions because CMake does not provide a way to evaluate them. Given generator expression: ${_file}") endif() - get_filename_component(_ext ${_file} EXT) + get_filename_component(_ext "${_file}" EXT) if("${_ext}" STREQUAL "") message(FATAL_ERROR "blt_split_source_list_by_language given source file with no extension: ${_file}") endif() get_filename_component(_name "${_file}" NAME) - string(TOLOWER ${_ext} _ext_lower) + string(TOLOWER "${_ext}" _ext_lower) - if(${_ext_lower} IN_LIST BLT_C_FILE_EXTS) + if("${_ext_lower}" IN_LIST BLT_C_FILE_EXTS) if (DEFINED arg_C_LIST) - list(APPEND ${arg_C_LIST} ${_file}) + list(APPEND ${arg_C_LIST} "${_file}") endif() - elseif(${_ext_lower} IN_LIST BLT_Fortran_FILE_EXTS) + elseif("${_ext_lower}" IN_LIST BLT_Fortran_FILE_EXTS) if (DEFINED arg_Fortran_LIST) - list(APPEND ${arg_Fortran_LIST} ${_file}) + list(APPEND ${arg_Fortran_LIST} "${_file}") endif() - elseif(${_ext_lower} IN_LIST BLT_Python_FILE_EXTS) + elseif("${_ext_lower}" IN_LIST BLT_Python_FILE_EXTS) if (DEFINED arg_Python_LIST) - list(APPEND ${arg_Python_LIST} ${_file}) + list(APPEND ${arg_Python_LIST} "${_file}") endif() elseif("${_ext_lower}" IN_LIST BLT_CMAKE_FILE_EXTS OR "${_name}" STREQUAL "CMakeLists.txt") if (DEFINED arg_CMAKE_LIST) From 4be187fa22c311f80d69078f152c6dd20ea1ecf0 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 20 Nov 2020 13:53:07 -0800 Subject: [PATCH 124/330] Update README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6dd517610..644797ac2 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,9 @@ operating systems and technologies: * Code style: [AStyle](http://astyle.sourceforge.net), [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html), - [Uncrustify](http://uncrustify.sourceforge.net) - [YAPF](https://github.com/google/yapf) + [cmake-format](https://github.com/cheshirekow/cmake_format), + [Uncrustify](http://uncrustify.sourceforge.net), + [YAPF (Yet Another Python Formatter)](https://github.com/google/yapf) * Code quality [clang-query](http://clang.llvm.org/docs/LibASTMatchers.html), [clang-tidy](https://clang.llvm.org/extra/clang-tidy), From 5a067264777c3c0a25cfe3309c86f5d80d5a0b68 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 20 Nov 2020 13:55:17 -0800 Subject: [PATCH 125/330] Add spaces back at end of line --- README.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 644797ac2..b1cd23143 100644 --- a/README.md +++ b/README.md @@ -127,22 +127,24 @@ BLT bundles its external dependencies in thirdparty_builtin/. These packages are covered by various permissive licenses. A summary listing follows. See the license included with each package for full details. -PackageName: fruit -PackageHomePage: https://sourceforge.net/projects/fortranxunit/ -PackageLicenseDeclared: BSD-3-Clause +[//]: # (Note: The spaces at the end of each line below add line breaks) -PackageName: gbenchmark -PackageHomePage: https://github.com/google/benchmark -PackageLicenseDeclared: Apache-2.0 +PackageName: fruit +PackageHomePage: https://sourceforge.net/projects/fortranxunit/ +PackageLicenseDeclared: BSD-3-Clause -PackageName: gmock -PackageHomePage: https://github.com/google/googlemock -PackageLicenseDeclared: BSD-3-Clause +PackageName: gbenchmark +PackageHomePage: https://github.com/google/benchmark +PackageLicenseDeclared: Apache-2.0 -PackageName: gtest -PackageHomePage: https://github.com/google/googletest -PackageLicenseDeclared: BSD-3-Clause +PackageName: gmock +PackageHomePage: https://github.com/google/googlemock +PackageLicenseDeclared: BSD-3-Clause -PackageName: run-clang-format -PackageHomePage: https://github.com/Sarcasm/run-clang-format -PackageLicenseDeclared: MIT +PackageName: gtest +PackageHomePage: https://github.com/google/googletest +PackageLicenseDeclared: BSD-3-Clause + +PackageName: run-clang-format +PackageHomePage: https://github.com/Sarcasm/run-clang-format +PackageLicenseDeclared: MIT From 7ae6b1cd7f2694e2671306be786a85334920b166 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 20 Nov 2020 13:58:01 -0800 Subject: [PATCH 126/330] Update Authors --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b1cd23143..75ea99915 100644 --- a/README.md +++ b/README.md @@ -67,11 +67,12 @@ Developers include: * Chris White, LLNL * Kenneth Weiss, LLNL + * David A. Beckingsale, LLNL + * Josh Essman, LLNL * Cyrus Harrison, LLNL * George Zagaris, LLNL * Lee Taylor, LLNL * Aaron Black, LLNL - * David A. Beckingsale, LLNL * Richard Hornung, LLNL * Randolph Settgast, LLNL From d8ca37eb4d63757496c5621f5b9907a6e8cf28cb Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 20 Nov 2020 14:07:44 -0800 Subject: [PATCH 127/330] Add more projects to README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 75ea99915..eaa445281 100644 --- a/README.md +++ b/README.md @@ -85,11 +85,17 @@ The full list of project contributors can be found on the Open-Source Projects using BLT ------------------------------ + * [Adiak](https://github.com/LLNL/Adiak): Library for collecting metadata from HPC application runs * [Ascent](https://github.com/Alpine-DAV/ascent): A flyweight in-situ visualization and analysis runtime for multi-physics HPC simulations * [Axom](https://github.com/LLNL/axom): Software infrastructure for the development of multi-physics applications and computational tools + * [CARE](https://github.com/LLNL/CARE): CHAI and RAJA extensions * [CHAI](https://github.com/LLNL/CHAI): Copy-hiding array abstraction to automatically migrate data between memory spaces * [Conduit](https://github.com/LLNL/conduit): Simplified data exchange for HPC simulations + * [Kripke](https://github.com/LLNL/Kripke): Simple, scalable, 3D Sn deterministic particle transport code * [RAJA](https://github.com/LLNL/raja): Performance portability layer for HPC + * [SAMRAI](https://github.com/LLNL/SAMRAI): Structured Adaptive Mesh Refinement Application Infrastructure + * [Serac](https://github.com/LLNL/serac): 3D implicit nonlinear thermal-structural simulation code + * [Spheral](https://github.com/LLNL/spheral): Steerable parallel environment for performing coupled hydrodynamical & gravitational numerical simulations * [Umpire](https://github.com/LLNL/Umpire): Application-focused API for memory management on NUMA and GPU architectures * [VTK-h](https://github.com/Alpine-DAV/vtk-h): Scientific visualization algorithms for emerging processor architectures From c03d7ef6e87519d75e084129d265a9fb5f726460 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 20 Nov 2020 15:23:58 -0800 Subject: [PATCH 128/330] fix typo in parameter name --- docs/api/target.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target.rst b/docs/api/target.rst index c9b94c115..1d69eea6e 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -203,7 +203,7 @@ library and have headers that go along with them (unless it's a Fortran library) Header-only libraries are useful when you do not want the library separately compiled or are using C++ templates that require the library's user to instantiate them. These libraries have headers but no sources. To create a header-only library (CMake calls them INTERFACE libraries), -simply list all headers under the HEADER argument and do not specify SOURCES (because there aren't any). +simply list all headers under the HEADERS argument and do not specify SOURCES (because there aren't any). Object libraries are basically a collection of compiled source files that are not archived or linked. They are sometimes useful when you want to solve compilicated linking From eae46810c92d986f53287dd3626152421ff87cae Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 08:19:12 -0600 Subject: [PATCH 129/330] docs: find_executable only works with ENABLEd tools, describe how to use custom lcov/gcov --- RELEASE-NOTES.md | 2 ++ cmake/BLTPrivateMacros.cmake | 3 ++- cmake/thirdparty/SetupThirdParty.cmake | 9 +++++---- docs/api/code_metric.rst | 9 +++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index bfa19d219..5a8ffb6d8 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -34,6 +34,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ passed to ``target_link_options``. - For HIP-dependent builds, only add HCC include directory if it exists. - HIP CMake utilities updated to AMD's latest version +- Updated ``add_code_coverage_target`` to ``blt_add_code_coverage_target``, which now supports + user-specified source directories ### Fixed - ClangFormat checks now support multiple Python executable names diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index a0f3a8dd1..3cc2d0449 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -136,7 +136,8 @@ endfunction() ## ## This macro attempts to find the given executable via either a previously defined ## _EXECUTABLE or using find_program with the given EXECUTABLES. -## if EXECUTABLES is left empty, then NAME is used. +## if EXECUTABLES is left empty, then NAME is used. This macro will only attempt +## to locate the executable if _ENABLED is TRUE. ## ## If successful the following variables will be defined: ## _FOUND diff --git a/cmake/thirdparty/SetupThirdParty.cmake b/cmake/thirdparty/SetupThirdParty.cmake index ca42612c7..9f1996fd9 100644 --- a/cmake/thirdparty/SetupThirdParty.cmake +++ b/cmake/thirdparty/SetupThirdParty.cmake @@ -120,10 +120,11 @@ endif() # Code coverage #------------------------------------ if (ENABLE_COVERAGE) - # find_executable requires that the executables be enabled - set(ENABLE_GCOV ON) - set(ENABLE_LCOV ON) - set(ENABLE_GENHTML ON) + # Attempt to find the executables associated with gcov, lcov and genhtml. + # This requires that the associate features are enabled. + set(ENABLE_GCOV ON CACHE BOOL "") + set(ENABLE_LCOV ON CACHE BOOL "") + set(ENABLE_GENHTML ON CACHE BOOL "") blt_find_executable(NAME gcov EXECUTABLES gcov) diff --git a/docs/api/code_metric.rst b/docs/api/code_metric.rst index 3a76fe127..e6eeed882 100644 --- a/docs/api/code_metric.rst +++ b/docs/api/code_metric.rst @@ -11,9 +11,9 @@ blt_add_code_coverage_target .. code-block:: cmake - blt_add_code_coverage_target( NAME - RUNNER - SOURCE_DIRECTORIES [dir1 [dir2 ...]]) + blt_add_code_coverage_target( NAME + RUNNER + SOURCE_DIRECTORIES [dir1 [dir2 ...]] ) Creates a new build target for generating a code coverage report. @@ -36,7 +36,8 @@ highlighted source code that indicates which code was or was not executed as par Coverage analysis is only supported by GNU/Clang compilers. This functionality requires that BLT's ``ENABLE_COVERAGE`` option is enabled and that ``gcov``, ``lcov``, -and ``genhtml`` are present on your system. +and ``genhtml`` are present on your system. To use a specific version of one of these tools, you can set +``GCOV_EXECUTABLE``, ``LCOV_EXECUTABLE``, and ``GENHTML_EXECUTABLE`` to point at the desired version(s). .. note:: The ``ENABLE_COVERAGE`` option will add compiler flags that instrument your code (and slow it down). From fdf68288e143a336d944dc9dc8f88005e04e62bf Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 07:01:09 -0800 Subject: [PATCH 130/330] fix: don't add nonexistent variables to HIP target, check for existence of includes before copying to SYSTEM_INCL_DIRS --- cmake/BLTMacros.cmake | 13 ++++++++----- cmake/thirdparty/FindHIP.cmake | 6 ------ cmake/thirdparty/SetupHIP.cmake | 9 +++------ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 71c291282..27527e17e 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -482,11 +482,14 @@ macro(blt_patch_target) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - if(_standard_lib_interface) - target_include_directories(${arg_NAME} SYSTEM ${_scope} ${_target_includes}) - else() - set_property(TARGET ${arg_NAME} PROPERTY - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) + # Don't copy if the target had no include directories + if(_target_includes) + if(_standard_lib_interface) + target_include_directories(${arg_NAME} SYSTEM ${_scope} ${_target_includes}) + else() + set_property(TARGET ${arg_NAME} PROPERTY + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) + endif() endif() endif() diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index eabfa6e41..03bce824a 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -469,12 +469,6 @@ macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files set(include_directories_generator "$") list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") - ############ START BLT CHANGE ############ - # Add the interface include directories - set(interface_include_directories_generator "$") - list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") - ############ END BLT CHANGE ############ - get_directory_property(_hip_include_directories INCLUDE_DIRECTORIES) list(REMOVE_DUPLICATES _hip_include_directories) if(_hip_include_directories) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index e2f2e2cd1..48e107666 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -14,8 +14,6 @@ find_package(HIP REQUIRED) message(STATUS "HIP version: ${HIP_VERSION_STRING}") message(STATUS "HIP platform: ${HIP_PLATFORM}") -#message(STATUS "HIP Include Path: ${HIP_INCLUDE_DIRS}") -#message(STATUS "HIP Libraries: ${HIP_LIBRARIES}") if(${HIP_PLATFORM} STREQUAL "hcc") set(HIP_RUNTIME_DEFINE "__HIP_PLATFORM_HCC__") @@ -34,10 +32,9 @@ set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFI # depend on 'hip', if you need to use hip # headers, link to hip libs, and need to run your source # through a hip compiler (hipcc) -blt_import_library(NAME hip - INCLUDES ${HIP_INCLUDE_DIRS} - LIBRARIES ${HIP_LIBRARIES} - TREAT_INCLUDES_AS_SYSTEM ON) +# This is currently used only as an indicator for blt_add_hip* -- FindHIP/hipcc will handle resolution +# of all required HIP-related includes/libraries/flags. +blt_import_library(NAME hip TREAT_INCLUDES_AS_SYSTEM ON) # depend on 'hip_runtime', if you only need to use hip # headers or link to hip libs, but don't need to run your source From daff401f0edc87f3a528f4560cfb4d6e2552fb1f Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 07:02:16 -0800 Subject: [PATCH 131/330] fix: remove TREAT_INCLUDES_AS_SYSTEM from HIP target --- cmake/thirdparty/SetupHIP.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index 48e107666..afeed5171 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -34,7 +34,7 @@ set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFI # through a hip compiler (hipcc) # This is currently used only as an indicator for blt_add_hip* -- FindHIP/hipcc will handle resolution # of all required HIP-related includes/libraries/flags. -blt_import_library(NAME hip TREAT_INCLUDES_AS_SYSTEM ON) +blt_import_library(NAME hip) # depend on 'hip_runtime', if you only need to use hip # headers or link to hip libs, but don't need to run your source From 585587625482805666dc72aec34803cc4d723662 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 07:10:13 -0800 Subject: [PATCH 132/330] docs: update changelog --- RELEASE-NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index dd8ff3f9a..953b44ba0 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -54,6 +54,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ blt_add_code_checks; previously, these combinations were implied to be errors in BLT documentation, but BLT would not return an error in those cases. +- ``blt_patch_target`` no longer attempts to set system include directories when a target + has no include directories ## [Version 0.3.6] - Release date 2020-07-27 From d04e867cdc5be5b1f8759704bd1f752a21ff2b08 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 07:01:09 -0800 Subject: [PATCH 133/330] fix: don't add nonexistent variables to HIP target, check for existence of includes before copying to SYSTEM_INCL_DIRS --- cmake/BLTMacros.cmake | 13 ++++++++----- cmake/thirdparty/FindHIP.cmake | 6 ------ cmake/thirdparty/SetupHIP.cmake | 9 +++------ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 71c291282..27527e17e 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -482,11 +482,14 @@ macro(blt_patch_target) # PGI does not support -isystem if( (${arg_TREAT_INCLUDES_AS_SYSTEM}) AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) get_target_property(_target_includes ${arg_NAME} INTERFACE_INCLUDE_DIRECTORIES) - if(_standard_lib_interface) - target_include_directories(${arg_NAME} SYSTEM ${_scope} ${_target_includes}) - else() - set_property(TARGET ${arg_NAME} PROPERTY - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) + # Don't copy if the target had no include directories + if(_target_includes) + if(_standard_lib_interface) + target_include_directories(${arg_NAME} SYSTEM ${_scope} ${_target_includes}) + else() + set_property(TARGET ${arg_NAME} PROPERTY + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${_target_includes}) + endif() endif() endif() diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index eabfa6e41..03bce824a 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -469,12 +469,6 @@ macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files set(include_directories_generator "$") list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") - ############ START BLT CHANGE ############ - # Add the interface include directories - set(interface_include_directories_generator "$") - list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") - ############ END BLT CHANGE ############ - get_directory_property(_hip_include_directories INCLUDE_DIRECTORIES) list(REMOVE_DUPLICATES _hip_include_directories) if(_hip_include_directories) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index e2f2e2cd1..48e107666 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -14,8 +14,6 @@ find_package(HIP REQUIRED) message(STATUS "HIP version: ${HIP_VERSION_STRING}") message(STATUS "HIP platform: ${HIP_PLATFORM}") -#message(STATUS "HIP Include Path: ${HIP_INCLUDE_DIRS}") -#message(STATUS "HIP Libraries: ${HIP_LIBRARIES}") if(${HIP_PLATFORM} STREQUAL "hcc") set(HIP_RUNTIME_DEFINE "__HIP_PLATFORM_HCC__") @@ -34,10 +32,9 @@ set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFI # depend on 'hip', if you need to use hip # headers, link to hip libs, and need to run your source # through a hip compiler (hipcc) -blt_import_library(NAME hip - INCLUDES ${HIP_INCLUDE_DIRS} - LIBRARIES ${HIP_LIBRARIES} - TREAT_INCLUDES_AS_SYSTEM ON) +# This is currently used only as an indicator for blt_add_hip* -- FindHIP/hipcc will handle resolution +# of all required HIP-related includes/libraries/flags. +blt_import_library(NAME hip TREAT_INCLUDES_AS_SYSTEM ON) # depend on 'hip_runtime', if you only need to use hip # headers or link to hip libs, but don't need to run your source From ac82567b1fa00d695bc07f50012d7787746dab5f Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 07:02:16 -0800 Subject: [PATCH 134/330] fix: remove TREAT_INCLUDES_AS_SYSTEM from HIP target --- cmake/thirdparty/SetupHIP.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index 48e107666..afeed5171 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -34,7 +34,7 @@ set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFI # through a hip compiler (hipcc) # This is currently used only as an indicator for blt_add_hip* -- FindHIP/hipcc will handle resolution # of all required HIP-related includes/libraries/flags. -blt_import_library(NAME hip TREAT_INCLUDES_AS_SYSTEM ON) +blt_import_library(NAME hip) # depend on 'hip_runtime', if you only need to use hip # headers or link to hip libs, but don't need to run your source From 9aaac27f6582d90a742e53e8b11ebac571d6badf Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 07:10:13 -0800 Subject: [PATCH 135/330] docs: update changelog fix: resolve typo --- RELEASE-NOTES.md | 2 ++ cmake/thirdparty/SetupThirdParty.cmake | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 4e8e5e552..38a1781fa 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -56,6 +56,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ blt_add_code_checks; previously, these combinations were implied to be errors in BLT documentation, but BLT would not return an error in those cases. +- ``blt_patch_target`` no longer attempts to set system include directories when a target + has no include directories ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/thirdparty/SetupThirdParty.cmake b/cmake/thirdparty/SetupThirdParty.cmake index bec63696f..1c97ff86e 100644 --- a/cmake/thirdparty/SetupThirdParty.cmake +++ b/cmake/thirdparty/SetupThirdParty.cmake @@ -125,7 +125,7 @@ endif() #------------------------------------ if (ENABLE_COVERAGE) # Attempt to find the executables associated with gcov, lcov and genhtml. - # This requires that the associate features are enabled. + # This requires that the associated features are enabled. set(ENABLE_GCOV ON CACHE BOOL "") set(ENABLE_LCOV ON CACHE BOOL "") set(ENABLE_GENHTML ON CACHE BOOL "") From 0388cfd6478406faeeab10b8206eabd178e407be Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 13:58:10 -0600 Subject: [PATCH 136/330] feat: support for INTERFACE libraries in blt_setup_target --- cmake/BLTPrivateMacros.cmake | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 6a4fb55d3..ad10eb86d 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -293,6 +293,15 @@ macro(blt_setup_target) message( FATAL_ERROR "Must provide a NAME argument to the 'blt_setup_target' macro" ) endif() + # Default to "real" scope, unless it's an interface library + set(_private_scope PRIVATE) + set(_public_scope PUBLIC) + get_target_property(_target_type ${arg_NAME} TYPE) + if("${_target_type}" STREQUAL "INTERFACE_LIBRARY") + set(_private_scope INTERFACE) + set(_public_scope INTERFACE) + endif() + # Expand dependency list set(_expanded_DEPENDS_ON ${arg_DEPENDS_ON}) foreach( i RANGE 50 ) @@ -314,21 +323,21 @@ macro(blt_setup_target) string(TOUPPER ${dependency} uppercase_dependency ) if ( NOT arg_OBJECT AND _BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY ) - target_sources(${arg_NAME} PRIVATE $) + target_sources(${arg_NAME} ${_private_scope} $) endif() if ( DEFINED _BLT_${uppercase_dependency}_INCLUDES ) if ( _BLT_${uppercase_dependency}_TREAT_INCLUDES_AS_SYSTEM ) - target_include_directories( ${arg_NAME} SYSTEM PUBLIC + target_include_directories( ${arg_NAME} SYSTEM ${_public_scope} ${_BLT_${uppercase_dependency}_INCLUDES} ) else() - target_include_directories( ${arg_NAME} PUBLIC + target_include_directories( ${arg_NAME} ${_public_scope} ${_BLT_${uppercase_dependency}_INCLUDES} ) endif() endif() if ( DEFINED _BLT_${uppercase_dependency}_FORTRAN_MODULES ) - target_include_directories( ${arg_NAME} PUBLIC + target_include_directories( ${arg_NAME} ${_public_scope} ${_BLT_${uppercase_dependency}_FORTRAN_MODULES} ) endif() @@ -359,15 +368,15 @@ macro(blt_setup_target) # actual CMake targets if(NOT "${_BLT_${uppercase_dependency}_LIBRARIES}" STREQUAL "BLT_NO_LIBRARIES" ) - target_link_libraries( ${arg_NAME} PUBLIC + target_link_libraries( ${arg_NAME} ${_public_scope} ${_BLT_${uppercase_dependency}_LIBRARIES} ) endif() else() - target_link_libraries( ${arg_NAME} PUBLIC ${dependency} ) + target_link_libraries( ${arg_NAME} ${_public_scope} ${dependency} ) endif() if ( DEFINED _BLT_${uppercase_dependency}_DEFINES ) - target_compile_definitions( ${arg_NAME} PUBLIC + target_compile_definitions( ${arg_NAME} ${_public_scope} ${_BLT_${uppercase_dependency}_DEFINES} ) endif() From 76bec129bc564ec9d352620788c360f07e171e77 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 14:33:22 -0600 Subject: [PATCH 137/330] tests: add tests for header-only library with dependencies --- tests/internal/CMakeLists.txt | 6 +++++- tests/internal/src/HeaderOnly.hpp | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index b74f3e1bb..a836b91af 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -67,8 +67,12 @@ if(ENABLE_GTEST) # Header-only test #------------------------------------------------------ + blt_add_target_definitions(TO example + TARGET_DEFINITIONS BLT_EXAMPLE_LIB) + blt_add_library(NAME blt_header_only - HEADERS "src/HeaderOnly.hpp") + HEADERS "src/HeaderOnly.hpp" + DEPENDS_ON example) # This executable depends on the header-only library diff --git a/tests/internal/src/HeaderOnly.hpp b/tests/internal/src/HeaderOnly.hpp index d23209473..727d3be27 100644 --- a/tests/internal/src/HeaderOnly.hpp +++ b/tests/internal/src/HeaderOnly.hpp @@ -6,12 +6,19 @@ #ifndef BLT_HEADER_ONLY_HPP #define BLT_HEADER_ONLY_HPP +#include "Example.hpp" + +#ifndef BLT_EXAMPLE_LIB + #error Compile definitions were not propagated from "example" library +#endif + namespace blt { inline bool ReturnTrue() { - return true; + Example e; + return e.ReturnTrue(); } } // end of namespace blt From 637d21ed5005c8ce97e99284b5098c2c2182d223 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 23 Nov 2020 14:48:10 -0600 Subject: [PATCH 138/330] docs: update changelog, add snippet on header-only lib dependencies to docs --- RELEASE-NOTES.md | 1 + docs/api/target.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 38a1781fa..7295cda81 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -58,6 +58,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ those cases. - ``blt_patch_target`` no longer attempts to set system include directories when a target has no include directories +- Header-only libraries now can have dependencies via DEPENDS_ON in ``blt_add_library`` ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/docs/api/target.rst b/docs/api/target.rst index 1d69eea6e..6f84d4b1b 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -204,6 +204,8 @@ Header-only libraries are useful when you do not want the library separately com are using C++ templates that require the library's user to instantiate them. These libraries have headers but no sources. To create a header-only library (CMake calls them INTERFACE libraries), simply list all headers under the HEADERS argument and do not specify SOURCES (because there aren't any). +Header-only libraries can have dependencies like compiled libraries - these will be propagated to targets +that depend on the header-only library. Object libraries are basically a collection of compiled source files that are not archived or linked. They are sometimes useful when you want to solve compilicated linking From 6b1829b1182d9866ac758cdac0c23dea763e328d Mon Sep 17 00:00:00 2001 From: Daniel Taller Date: Tue, 24 Nov 2020 15:58:27 -0800 Subject: [PATCH 139/330] fix for fPic error --- cmake/thirdparty/FindHIP.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index 03bce824a..800420e1a 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -503,7 +503,7 @@ macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files if(_hip_build_shared_libs) list(APPEND HIP_HCC_FLAGS "-fPIC") list(APPEND HIP_CLANG_FLAGS "-fPIC") - list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler '-fPIC'") + list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler -fPIC") endif() # Set host compiler From 229d0b45a93697a2b002f1db6e616c722c15c1ef Mon Sep 17 00:00:00 2001 From: Daniel Taller Date: Wed, 25 Nov 2020 15:22:26 -0800 Subject: [PATCH 140/330] fix: set HIPCC ot NVCC depending on platform --- cmake/thirdparty/FindHIP.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index 800420e1a..7f390d2ec 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -503,7 +503,11 @@ macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files if(_hip_build_shared_libs) list(APPEND HIP_HCC_FLAGS "-fPIC") list(APPEND HIP_CLANG_FLAGS "-fPIC") - list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler -fPIC") + if("x${HIP_PLATFORM}" STREQUAL "xnvcc") # hip using nvcc cuda underneath + list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler '-fPIC'") + else() # platform is hcc + list(APPEND HIP_HIPCC_FLAGS "-fPIC") + endif() endif() # Set host compiler From 617cc4b8c2e13457909e474501f1228cae6ed0f7 Mon Sep 17 00:00:00 2001 From: Daniel Taller Date: Wed, 25 Nov 2020 15:24:48 -0800 Subject: [PATCH 141/330] indentation --- cmake/thirdparty/FindHIP.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index 7f390d2ec..ab4ffdb25 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -504,7 +504,7 @@ macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files list(APPEND HIP_HCC_FLAGS "-fPIC") list(APPEND HIP_CLANG_FLAGS "-fPIC") if("x${HIP_PLATFORM}" STREQUAL "xnvcc") # hip using nvcc cuda underneath - list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler '-fPIC'") + list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler '-fPIC'") else() # platform is hcc list(APPEND HIP_HIPCC_FLAGS "-fPIC") endif() From ee21ff5ef5ee93183f766e17e206e95547923a6a Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 1 Dec 2020 11:15:12 -0600 Subject: [PATCH 142/330] fix: leave generated coverage files as byproducts instead of deleting them so they can be picked up by coverage uploaders --- cmake/SetupCodeCoverageReports.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/SetupCodeCoverageReports.cmake b/cmake/SetupCodeCoverageReports.cmake index 3b8e83a66..bfd91513d 100644 --- a/cmake/SetupCodeCoverageReports.cmake +++ b/cmake/SetupCodeCoverageReports.cmake @@ -96,8 +96,7 @@ function(blt_add_code_coverage_target) COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} ${_coverage_directories} --capture --output-file ${arg_NAME}.info COMMAND ${LCOV_EXECUTABLE} --no-external --gcov-tool ${GCOV_EXECUTABLE} ${_coverage_directories} --remove ${arg_NAME}.info '/usr/include/*' --output-file ${arg_NAME}.info.cleaned COMMAND ${GENHTML_EXECUTABLE} -o ${arg_NAME} ${arg_NAME}.info.cleaned - COMMAND ${CMAKE_COMMAND} -E remove ${arg_NAME}.info ${arg_NAME}.info.cleaned - + BYPRODUCTS ${arg_NAME}.info ${arg_NAME}.info.cleaned WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." ) From 15fab054ae126aa8c9a22202011047ae81e61208 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 1 Dec 2020 12:00:43 -0600 Subject: [PATCH 143/330] changelog: update RELEASE-NOTES --- RELEASE-NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7295cda81..047c325c9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -37,6 +37,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - HIP CMake utilities updated to AMD's latest version - Updated ``add_code_coverage_target`` to ``blt_add_code_coverage_target``, which now supports user-specified source directories +- Code coverage targets leave LCOV-generated files intact for later use; these files will + still be removed by ``make clean`` ### Fixed - ClangFormat checks now support multiple Python executable names From 0a187e6f5b73a28e7f6d4fc5ba3d0623424a61fa Mon Sep 17 00:00:00 2001 From: Daniel Taller Date: Wed, 2 Dec 2020 15:00:04 -0800 Subject: [PATCH 144/330] alternative fix due to David Beckinsale --- cmake/thirdparty/FindHIP.cmake | 6 +----- cmake/thirdparty/FindHIP/run_hipcc.cmake | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index ab4ffdb25..03bce824a 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -503,11 +503,7 @@ macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files if(_hip_build_shared_libs) list(APPEND HIP_HCC_FLAGS "-fPIC") list(APPEND HIP_CLANG_FLAGS "-fPIC") - if("x${HIP_PLATFORM}" STREQUAL "xnvcc") # hip using nvcc cuda underneath - list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler '-fPIC'") - else() # platform is hcc - list(APPEND HIP_HIPCC_FLAGS "-fPIC") - endif() + list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler '-fPIC'") endif() # Set host compiler diff --git a/cmake/thirdparty/FindHIP/run_hipcc.cmake b/cmake/thirdparty/FindHIP/run_hipcc.cmake index f544b2541..538e1969f 100644 --- a/cmake/thirdparty/FindHIP/run_hipcc.cmake +++ b/cmake/thirdparty/FindHIP/run_hipcc.cmake @@ -53,7 +53,7 @@ execute_process(COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --compiler OUTPUT_VARIABLE H execute_process(COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --runtime OUTPUT_VARIABLE HIP_RUNTIME OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT host_flag) set(__CC ${HIP_HIPCC_EXECUTABLE}) - if("${HIP_PLATFORM}" STREQUAL "amd") + if("${HIP_PLATFORM}" STREQUAL "hcc") if("${HIP_COMPILER}" STREQUAL "hcc") if(NOT "x${HCC_HOME}" STREQUAL "x") set(ENV{HCC_HOME} ${HCC_HOME}) From e20f180b733380b003cb4bc89bf6f896c43a8b60 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 1 Dec 2020 09:51:37 -0800 Subject: [PATCH 145/330] BUGFIX: fix typo in blt_git_tag macro The check for whether or not the caller supplied a SOURCE_DIR when calling the macro had a typo that was preventing calling the macro with a specified SOURCE_DIR. Fixed that. --- cmake/BLTGitMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTGitMacros.cmake b/cmake/BLTGitMacros.cmake index d6024f6f6..051ef0888 100644 --- a/cmake/BLTGitMacros.cmake +++ b/cmake/BLTGitMacros.cmake @@ -144,7 +144,7 @@ macro(blt_git_tag) endif() ## set working directory - if ( NOT DEFINED arg_SOURCE_DIR} ) + if ( NOT DEFINED arg_SOURCE_DIR ) set(git_dir ${CMAKE_CURRENT_SOURCE_DIR}) else() set(git_dir ${arg_SOURCE_DIR}) From 5e2ad19040936e8cea88d57b9b4a1236216617ea Mon Sep 17 00:00:00 2001 From: Daniel Taller Date: Thu, 3 Dec 2020 11:28:53 -0800 Subject: [PATCH 146/330] additional fix after correspondence between David and vendor --- cmake/thirdparty/FindHIP/run_hipcc.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/thirdparty/FindHIP/run_hipcc.cmake b/cmake/thirdparty/FindHIP/run_hipcc.cmake index 538e1969f..5a862426e 100644 --- a/cmake/thirdparty/FindHIP/run_hipcc.cmake +++ b/cmake/thirdparty/FindHIP/run_hipcc.cmake @@ -53,7 +53,9 @@ execute_process(COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --compiler OUTPUT_VARIABLE H execute_process(COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --runtime OUTPUT_VARIABLE HIP_RUNTIME OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT host_flag) set(__CC ${HIP_HIPCC_EXECUTABLE}) - if("${HIP_PLATFORM}" STREQUAL "hcc") + # ROCm version 4.0 and higher will use amd for the platform, but older + # versions use hcc. Keep both for backwards compatibility. + if("${HIP_PLATFORM}" STREQUAL "hcc" OR "${HIP_PLATFORM}" STREQUAL "amd") if("${HIP_COMPILER}" STREQUAL "hcc") if(NOT "x${HCC_HOME}" STREQUAL "x") set(ENV{HCC_HOME} ${HCC_HOME}) From 113f4debe85e03f7f37b9ecd4bc0735da619dc2c Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Sun, 6 Dec 2020 19:34:04 -0800 Subject: [PATCH 147/330] Bugfix: Disable SYSTEM flag for IMPORTED targets on PGI PGI does not support the `isystem` flag, but CMake's default for imported targets is to mark include directories as SYTEM for imported targets. As a workaround, we disable this feature for PGI. --- SetupBLT.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SetupBLT.cmake b/SetupBLT.cmake index 255bb89b9..deeeb970e 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -101,6 +101,14 @@ if (NOT BLT_LOADED) ################################ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + + ################################ + # PGI doesn't support the SYSTEM flag, which is the default for imported targets. + ################################ + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") + set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE) + endif() + ################################ # Macros ################################ From a78c41773dfd680f5f492ebe01b986727695a465 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Sun, 6 Dec 2020 19:51:55 -0800 Subject: [PATCH 148/330] Moved workaround for PGI to `SetupCompilerOptions.cmake` --- SetupBLT.cmake | 8 -------- cmake/SetupCompilerOptions.cmake | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SetupBLT.cmake b/SetupBLT.cmake index deeeb970e..255bb89b9 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -101,14 +101,6 @@ if (NOT BLT_LOADED) ################################ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - - ################################ - # PGI doesn't support the SYSTEM flag, which is the default for imported targets. - ################################ - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") - set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE) - endif() - ################################ # Macros ################################ diff --git a/cmake/SetupCompilerOptions.cmake b/cmake/SetupCompilerOptions.cmake index 2463b0ba1..57bef7439 100644 --- a/cmake/SetupCompilerOptions.cmake +++ b/cmake/SetupCompilerOptions.cmake @@ -84,6 +84,14 @@ else() endif() +################################################################################# +# PGI doesn't support a SYSTEM flag for include directories. Since this is CMake's +# default for imported targets, we need to disable this feature for PGI. +################################################################################# +if(${C_COMPILER_FAMILY_IS_PGI}) + set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE) +endif() + ################################################ # Support for extra compiler flags and defines ################################################ From 4eccf257aa3edd2fdf84bcd295646aa4cf5d1836 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Sun, 6 Dec 2020 19:57:27 -0800 Subject: [PATCH 149/330] Updates RELEASE-NOTES --- RELEASE-NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 047c325c9..14963cacf 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -61,6 +61,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - ``blt_patch_target`` no longer attempts to set system include directories when a target has no include directories - Header-only libraries now can have dependencies via DEPENDS_ON in ``blt_add_library`` +- Added a workaround for include directories of imported targets on PGI. CMake was + erroneously marking them as SYSTEM but this is not supported by PGI. ## [Version 0.3.6] - Release date 2020-07-27 From a710d7663ac4cbb61fd9f0422d9b49ab618791b6 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 30 Nov 2020 08:29:53 -0800 Subject: [PATCH 150/330] feat: add EXPORTABLE option --- cmake/BLTMacros.cmake | 13 +++++++++---- docs/api/target.rst | 7 ++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 27527e17e..612f312b5 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -528,12 +528,13 @@ endmacro(blt_patch_target) ## COMPILE_FLAGS [ flag1 [ flag2 ..]] ## LINK_FLAGS [ flag1 [ flag2 ..]] ## DEFINES [def1 [def2 ...]] -## GLOBAL [ON|OFF]) +## GLOBAL [ON|OFF] +## EXPORTABLE [ON|OFF]) ## ## Imports a library as a CMake target ##------------------------------------------------------------------------------ macro(blt_import_library) - set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM GLOBAL) + set(singleValueArgs NAME TREAT_INCLUDES_AS_SYSTEM GLOBAL EXPORTABLE) set(multiValueArgs LIBRARIES INCLUDES DEPENDS_ON @@ -551,8 +552,12 @@ macro(blt_import_library) message(FATAL_ERROR "blt_import_library() must be called with argument NAME ") endif() - # Add all imported targets to a single imported interface target - if(${arg_GLOBAL}) + if(${arg_EXPORTABLE}) + if(${arg_GLOBAL}) + message(FATAL_ERROR "blt_import_library: EXPORTABLE targets cannot be GLOBAL") + endif() + add_library(${arg_NAME} INTERFACE) + elseif(${arg_GLOBAL}) add_library(${arg_NAME} INTERFACE IMPORTED GLOBAL) else() add_library(${arg_NAME} INTERFACE IMPORTED) diff --git a/docs/api/target.rst b/docs/api/target.rst index 6f84d4b1b..13693489b 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -384,7 +384,8 @@ blt_import_library COMPILE_FLAGS [flag1 [flag2 ..]] LINK_FLAGS [flag1 [flag2 ..]] DEFINES [def1 [def2 ...]] - GLOBAL [ON|OFF]) + GLOBAL [ON|OFF] + EXPORTABLE [ON|OFF]) Creates a CMake target from build artifacts and system files generated outside of this build system. @@ -420,6 +421,10 @@ DEFINES GLOBAL Whether to extend the visibility of the created library to global scope +EXPORTABLE + Whether the created target should be exportable and ``install``able - mutually + exclusive with the GLOBAL option + Allows libraries not built with CMake to be imported as native CMake targets in order to take full advantage of CMake's transitive dependency resolution. From 49002bff944394f4733422cc557c73a965a50e95 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 30 Nov 2020 09:25:31 -0800 Subject: [PATCH 151/330] feat: add option to make built-in TPL targets exportable --- cmake/BLTOptions.cmake | 5 +++++ cmake/thirdparty/SetupCUDA.cmake | 18 ++++++++++-------- cmake/thirdparty/SetupHIP.cmake | 3 ++- cmake/thirdparty/SetupMPI.cmake | 3 ++- cmake/thirdparty/SetupOpenMP.cmake | 3 ++- docs/tutorial/external_dependencies.rst | 5 ++++- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index f0e06fff6..5baf598c8 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -106,6 +106,11 @@ mark_as_advanced(BLT_ENABLE_MSVC_STATIC_MD_TO_MT) #------------------------------------------------------------------------------ option(ENABLE_FOLDERS "Organize projects using folders (in generators that support this)" OFF) +#------------------------------------------------------------------------------ +# Export/Install Options +#------------------------------------------------------------------------------ +option(BLT_EXPORT_THIRDPARTY "Configure the third-party targets created by BLT to be exportable" OFF) + #------------------------------------------------------------------------------ # Advanced configuration options #------------------------------------------------------------------------------ diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index 4a86a398e..292a6143b 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -144,11 +144,12 @@ endif() # This logic is handled in the blt_add_library/executable # macros blt_import_library(NAME cuda - COMPILE_FLAGS ${_cuda_compile_flags} - INCLUDES ${CUDA_INCLUDE_DIRS} - LIBRARIES ${CUDA_LIBRARIES} - LINK_FLAGS "${CMAKE_CUDA_LINK_FLAGS}" - ) + COMPILE_FLAGS ${_cuda_compile_flags} + INCLUDES ${CUDA_INCLUDE_DIRS} + LIBRARIES ${CUDA_LIBRARIES} + LINK_FLAGS "${CMAKE_CUDA_LINK_FLAGS}" + EXPORTABLE ${BLT_EXPORT_THIRDPARTY} + ) # same as 'cuda' but we don't flag your source files as # CUDA language. This causes your source files to use @@ -156,6 +157,7 @@ blt_import_library(NAME cuda # linking with nvcc. # This logic is handled in the blt_add_library/executable # macros -blt_import_library(NAME cuda_runtime - INCLUDES ${CUDA_INCLUDE_DIRS} - LIBRARIES ${CUDA_LIBRARIES}) +blt_import_library(NAME cuda_runtime + INCLUDES ${CUDA_INCLUDE_DIRS} + LIBRARIES ${CUDA_LIBRARIES} + EXPORTABLE ${BLT_EXPORT_THIRDPARTY}) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index afeed5171..286cdbc47 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -44,4 +44,5 @@ blt_import_library(NAME hip_runtime DEFINES ${HIP_RUNTIME_DEFINES} COMPILE_FLAGS ${HIP_RUNTIME_COMPILE_FLAGS} LIBRARIES ${HIP_RUNTIME_LIBRARIES} - TREAT_INCLUDES_AS_SYSTEM ON) + TREAT_INCLUDES_AS_SYSTEM ON + EXPORTABLE ${BLT_EXPORT_THIRDPARTY}) diff --git a/cmake/thirdparty/SetupMPI.cmake b/cmake/thirdparty/SetupMPI.cmake index 7bd65f5ec..8e438d40a 100644 --- a/cmake/thirdparty/SetupMPI.cmake +++ b/cmake/thirdparty/SetupMPI.cmake @@ -182,4 +182,5 @@ blt_import_library(NAME mpi TREAT_INCLUDES_AS_SYSTEM ON LIBRARIES ${_mpi_libraries} COMPILE_FLAGS ${_mpi_compile_flags} - LINK_FLAGS ${_mpi_link_flags} ) + LINK_FLAGS ${_mpi_link_flags} + EXPORTABLE ${BLT_EXPORT_THIRDPARTY}) diff --git a/cmake/thirdparty/SetupOpenMP.cmake b/cmake/thirdparty/SetupOpenMP.cmake index d0f0603a6..ba02689c9 100644 --- a/cmake/thirdparty/SetupOpenMP.cmake +++ b/cmake/thirdparty/SetupOpenMP.cmake @@ -54,4 +54,5 @@ message(STATUS "OpenMP Link Flags: ${_link_flags}") blt_import_library(NAME openmp COMPILE_FLAGS ${_compile_flags} - LINK_FLAGS ${_link_flags}) + LINK_FLAGS ${_link_flags} + EXPORTABLE ${BLT_EXPORT_THIRDPARTY}) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 2ac2f0606..a747afca1 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -54,7 +54,10 @@ though it does not support the creation of targets with the same name as a targe can also be used to manage visibility. BLT's ``mpi``, ``cuda``, ``cuda_runtime``, and ``openmp`` targets are all defined via ``blt_import_library()``. -You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. +You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. If your project exports targets and you would like +BLT's provided third-party targets to also be exported (for example, if a project that imports your project does not +use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. + .. admonition:: blt_register_library :class: hint From 8981e15910bf7d4a501f1fac2a0bdfb29dfadea8 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 30 Nov 2020 10:17:23 -0800 Subject: [PATCH 152/330] fix: proper punctuation on new parameter doc --- docs/api/target.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target.rst b/docs/api/target.rst index 13693489b..2ad2dabcb 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -422,7 +422,7 @@ GLOBAL Whether to extend the visibility of the created library to global scope EXPORTABLE - Whether the created target should be exportable and ``install``able - mutually + Whether the created target should be exportable and ``install``-able - mutually exclusive with the GLOBAL option Allows libraries not built with CMake to be imported as native CMake targets From 84f317140e47e51b023703e665148052c7090f04 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 30 Nov 2020 10:34:53 -0800 Subject: [PATCH 153/330] docs: explain requirement that EXPORTABLE libraries be installed explicitly --- RELEASE-NOTES.md | 2 ++ docs/api/target.rst | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 14963cacf..93d0c9754 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -28,6 +28,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added new ``blt_patch_target`` macro to simplify modifying properties of an existing CMake target. This macro accounts for known differences in compilers, target types, and CMake releases. - Added support for formatting CMake code using cmake-format. +- Added an EXPORTABLE option to ``blt_import_library`` that allows imported libraries to be + added to an export set and installed. ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/docs/api/target.rst b/docs/api/target.rst index 2ad2dabcb..60e3f946d 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -422,8 +422,11 @@ GLOBAL Whether to extend the visibility of the created library to global scope EXPORTABLE - Whether the created target should be exportable and ``install``-able - mutually - exclusive with the GLOBAL option + Whether the created target should be exportable and ``install``-able + +.. note:: Libraries marked EXPORTABLE cannot also be marked GLOBAL. They also + must be added to any export set that includes a target that depends on the + EXPORTABLE library. Allows libraries not built with CMake to be imported as native CMake targets in order to take full advantage of CMake's transitive dependency resolution. From 4ac3c87df8e6dffd091bc89cb6a3135996f308c9 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 15 Dec 2020 13:08:31 -0600 Subject: [PATCH 154/330] docs: more thorough documentation on the caveats of EXPORTABLE imports --- docs/api/target.rst | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/api/target.rst b/docs/api/target.rst index 60e3f946d..155553e85 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -424,10 +424,6 @@ GLOBAL EXPORTABLE Whether the created target should be exportable and ``install``-able -.. note:: Libraries marked EXPORTABLE cannot also be marked GLOBAL. They also - must be added to any export set that includes a target that depends on the - EXPORTABLE library. - Allows libraries not built with CMake to be imported as native CMake targets in order to take full advantage of CMake's transitive dependency resolution. @@ -442,6 +438,18 @@ As with BLT-registered libraries, it can be added to the DEPENDS_ON parameter when building another target or to ``target_link_libraries`` to transitively add in all includes, libraries, flags, and definitions associated with the imported library. +The EXPORTABLE option is intended to be used to simplify the process of exporting a project. +Instead of handwriting package location logic in a CMake package configuration file, the +EXPORTABLE targets can be exported with the targets defined by the project. + +.. note:: Libraries marked EXPORTABLE cannot also be marked GLOBAL. They also + must be added to any export set that includes a target that depends on the + EXPORTABLE library. + +.. note:: It is highly recommended that EXPORTABLE imported targets be installed with a + project-specific namespace/prefix, either with the NAMESPACE option of CMake's install() command, + or the EXPORT_NAME target property. This mitigates the risk of conflicting target names. + In CMake terms, the imported libraries will be ``INTERFACE`` libraries. This does not actually build a library. This is strictly to ease use after From bb2b7e7bf498e7f76a2c07c3a175d21580523376 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 15 Dec 2020 13:29:27 -0600 Subject: [PATCH 155/330] docs: add snippet to the examples describing the intended usage of the EXPORTABLE option --- docs/tutorial/external_dependencies.rst | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index a747afca1..b67fd32b8 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -27,14 +27,19 @@ For example, to find and add the external dependency *axom* as a CMake target, y include(FindAxom.cmake) blt_import_library(NAME axom TREAT_INCLUDES_AS_SYSTEM ON - DEFINES HAVE_AXOM=1 - INCLUDES ${AXOM_INCLUDES} - LIBRARIES ${AXOM_LIBRARIES}) + DEFINES HAVE_AXOM=1 + INCLUDES ${AXOM_INCLUDES} + LIBRARIES ${AXOM_LIBRARIES} + EXPORTABLE ON) Then *axom* is available to be used in the DEPENDS_ON list in the following ``blt_add_executable()`` or ``blt_add_library()`` calls, or in any CMake command that accepts a target. + CMake targets created by ``blt_import_library()`` are ``INTERFACE`` libraries that can be installed -and exported. +and exported if the ``EXPORTABLE`` option is enabled. For example, if the ``calc_pi`` project depends on +Axom, it could export its ``axom`` target. To avoid introducing target name conflicts for users of the +``calc_pi`` project who might also create a target called ``axom``, ``axom`` should be exported as +``calc_pi::axom``. This is especially helpful for "converting" external libraries that are not built with CMake into CMake-friendly imported targets. @@ -56,7 +61,10 @@ though it does not support the creation of targets with the same name as a targe BLT's ``mpi``, ``cuda``, ``cuda_runtime``, and ``openmp`` targets are all defined via ``blt_import_library()``. You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. If your project exports targets and you would like BLT's provided third-party targets to also be exported (for example, if a project that imports your project does not -use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. +use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other EXPORTABLE targets created by +``blt_import_library()``, these targets should be prefixed with the name of the project. Either the ``EXPORT_NAME`` +target property or the ``NAMESPACE`` option to CMake's ``install`` command can be used to modify the name of an +installed target. .. admonition:: blt_register_library From 7ba8f59285035e3e869dffefa2d44e6dbc0ad4f3 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 16 Dec 2020 12:20:09 -0600 Subject: [PATCH 156/330] docs: added a tutorial page on the BLT_EXPORT_THIRDPARTY flag --- docs/tutorial/exporting_blt_targets.rst | 74 +++++++++++++++++++++++++ docs/tutorial/external_dependencies.rst | 2 +- docs/tutorial/index.rst | 1 + 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 docs/tutorial/exporting_blt_targets.rst diff --git a/docs/tutorial/exporting_blt_targets.rst b/docs/tutorial/exporting_blt_targets.rst new file mode 100644 index 000000000..480321b2a --- /dev/null +++ b/docs/tutorial/exporting_blt_targets.rst @@ -0,0 +1,74 @@ +.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +Exporting BLT-created Targets +============================= + +BLT provides several built-in targets for commonly used libraries: + + * ``mpi`` (when ``ENABLE_MPI`` is on) + * ``openmp`` (when ``ENABLE_OPENMP`` is on) + * ``cuda`` and ``cuda_runtime`` (when ``ENABLE_CUDA`` is on) + * ``hip`` and ``hip_runtime`` (when ``ENABLE_HIP`` is on) + +These targets can be made exportable in order to make them available to users of +your project via CMake's ``install()`` command. Setting BLT's ``BLT_EXPORT_THIRDPARTY`` +option to ``ON`` will mark all active targets in the above list as ``EXPORTABLE`` +(see the ``blt_import_library()`` documentation for more info). + +.. note:: If a target in your project is added to an export set, any of its dependencies + marked ``EXPORTABLE`` must be added to the same export set. Failure to add them will + result in a CMake error in the exporting project. + +Typical usage of the ``BLT_EXPORT_THIRDPARTY`` option is as follows: + +.. code-block:: cmake + + # BLT configuration - enable MPI + set(ENABLE_MPI ON CACHE BOOL "") + # and mark the subsequently created MPI target as exportable + set(BLT_EXPORT_THIRDPARTY ON CACHE BOOL "") + + # Later, a project might mark a target as dependent on MPI + blt_add_executable( NAME example_1 + SOURCES example_1.cpp + DEPENDS_ON mpi ) + + # Add the example_1 target to the example-targets export set + install(TARGETS example_1 EXPORT example-targets) + + # Add the MPI target to the same export set - this is required + # because the mpi target was marked exportable + install(TARGETS mpi EXPORT example-targets) + + # To avoid collisions with projects that import "example-targets", + # one option is to prefix the name of the MPI target + # With this approach the exported name of example_1 is unchanged + set_target_properties(mpi PROPERTIES EXPORT_NAME example::mpi) + + # Alternatively, + +To avoid collisions with projects that import "example-targets", there are +two options for adjusting the exported name of the ``mpi`` target. + +The first is to rename only the ``mpi`` target's exported name: + +.. code-block:: cmake + + set_target_properties(mpi PROPERTIES EXPORT_NAME example::mpi) + install(EXPORT example-targets) + +With this approach the ``example_1`` target's exported name is unchanged - a +project that imports the ``example-targets`` export set will have ``example_1`` +and ``example::mpi`` targets made available. + +Another approach is to install all targets in the export set behind a namespace: + +.. code-block:: cmake + + install(EXPORT example-targets NAMESPACE example::) + +With this approach all targets in the export set are prefixed, so an importing +project will have ``example::example_1`` and ``example::mpi`` targets made available. diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index b67fd32b8..7c8c6ada9 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -64,7 +64,7 @@ BLT's provided third-party targets to also be exported (for example, if a projec use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other EXPORTABLE targets created by ``blt_import_library()``, these targets should be prefixed with the name of the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` command can be used to modify the name of an -installed target. +installed target. See the "Exporting BLT Targets" page for more info. .. admonition:: blt_register_library diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 3ed60f49d..e129d6423 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -33,5 +33,6 @@ Parts of the tutorial also require MPI, CUDA, Sphinx and Doxygen. using_flags unit_testing external_dependencies + exporting_blt_targets creating_documentation recommendations From c7406048d2876ace73744a778b2063a2b19e90ae Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 16 Dec 2020 12:23:52 -0600 Subject: [PATCH 157/330] docs: remove hyphenated compound adjective --- docs/tutorial/exporting_blt_targets.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/exporting_blt_targets.rst b/docs/tutorial/exporting_blt_targets.rst index 480321b2a..4e2738522 100644 --- a/docs/tutorial/exporting_blt_targets.rst +++ b/docs/tutorial/exporting_blt_targets.rst @@ -3,7 +3,7 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -Exporting BLT-created Targets +Exporting BLT Created Targets ============================= BLT provides several built-in targets for commonly used libraries: From 4ce1214cc27836575c953eeb496d412c1e422eea Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 16 Dec 2020 12:48:52 -0600 Subject: [PATCH 158/330] docs: clarify dependencies in imported projects, note that BLT_EXPORT_THIRDPARTY must be set before BLT setup --- docs/tutorial/exporting_blt_targets.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/exporting_blt_targets.rst b/docs/tutorial/exporting_blt_targets.rst index 4e2738522..da1d9a26f 100644 --- a/docs/tutorial/exporting_blt_targets.rst +++ b/docs/tutorial/exporting_blt_targets.rst @@ -30,6 +30,7 @@ Typical usage of the ``BLT_EXPORT_THIRDPARTY`` option is as follows: set(ENABLE_MPI ON CACHE BOOL "") # and mark the subsequently created MPI target as exportable set(BLT_EXPORT_THIRDPARTY ON CACHE BOOL "") + # Both of the above must happen before SetupBLT.cmake is included # Later, a project might mark a target as dependent on MPI blt_add_executable( NAME example_1 @@ -48,8 +49,6 @@ Typical usage of the ``BLT_EXPORT_THIRDPARTY`` option is as follows: # With this approach the exported name of example_1 is unchanged set_target_properties(mpi PROPERTIES EXPORT_NAME example::mpi) - # Alternatively, - To avoid collisions with projects that import "example-targets", there are two options for adjusting the exported name of the ``mpi`` target. @@ -62,7 +61,8 @@ The first is to rename only the ``mpi`` target's exported name: With this approach the ``example_1`` target's exported name is unchanged - a project that imports the ``example-targets`` export set will have ``example_1`` -and ``example::mpi`` targets made available. +and ``example::mpi`` targets made available. The imported ``example_1`` will +depend on ``example::mpi``. Another approach is to install all targets in the export set behind a namespace: @@ -72,3 +72,4 @@ Another approach is to install all targets in the export set behind a namespace: With this approach all targets in the export set are prefixed, so an importing project will have ``example::example_1`` and ``example::mpi`` targets made available. +The imported ``example::example_1`` will depend on ``example::mpi``. From b16f026fd4e35da231a9deeee3d04e7941234afd Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 16 Dec 2020 12:51:29 -0600 Subject: [PATCH 159/330] docs: remove duplicated snippet that changes EXPORT_NAME --- docs/tutorial/exporting_blt_targets.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/tutorial/exporting_blt_targets.rst b/docs/tutorial/exporting_blt_targets.rst index da1d9a26f..90bcd849f 100644 --- a/docs/tutorial/exporting_blt_targets.rst +++ b/docs/tutorial/exporting_blt_targets.rst @@ -31,6 +31,7 @@ Typical usage of the ``BLT_EXPORT_THIRDPARTY`` option is as follows: # and mark the subsequently created MPI target as exportable set(BLT_EXPORT_THIRDPARTY ON CACHE BOOL "") # Both of the above must happen before SetupBLT.cmake is included + include(/path/to/SetupBLT.cmake) # Later, a project might mark a target as dependent on MPI blt_add_executable( NAME example_1 @@ -44,11 +45,6 @@ Typical usage of the ``BLT_EXPORT_THIRDPARTY`` option is as follows: # because the mpi target was marked exportable install(TARGETS mpi EXPORT example-targets) - # To avoid collisions with projects that import "example-targets", - # one option is to prefix the name of the MPI target - # With this approach the exported name of example_1 is unchanged - set_target_properties(mpi PROPERTIES EXPORT_NAME example::mpi) - To avoid collisions with projects that import "example-targets", there are two options for adjusting the exported name of the ``mpi`` target. From 6daa52467b674d39c4913b7ead26fee921c9c668 Mon Sep 17 00:00:00 2001 From: Kristi Belcher Date: Mon, 21 Dec 2020 10:32:26 -0800 Subject: [PATCH 160/330] making linker check more precise --- cmake/BLTMacros.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 8d8c843dd..476b1d54b 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -794,10 +794,10 @@ macro(blt_add_executable) # CMake wants to load with C++ if any of the libraries are C++. # Force to load with Fortran if the first file is Fortran. list(GET arg_SOURCES 0 _first) - get_source_file_property(_lang ${_first} LANGUAGE) + get_source_file_property(_lang ${_first} HIP_SOURCE_PROPERTY_FORMAT) if(_lang STREQUAL Fortran) - #Check to see if HIP is enabled before resetting - if (NOT (CUDA_LINK_WITH_NVCC OR ENABLE_HIP)) + #Don't reset the linker if the NVCC or HIP linker is required + if (CUDA_LINK_WITH_NVCC) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) endif() target_include_directories(${arg_NAME} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}) From 8c5b3655c02e624a7ef308fb0f9fa8a3093195a1 Mon Sep 17 00:00:00 2001 From: Kristi Belcher Date: Mon, 21 Dec 2020 10:33:45 -0800 Subject: [PATCH 161/330] fix typo --- cmake/BLTMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 476b1d54b..577529f38 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -797,7 +797,7 @@ macro(blt_add_executable) get_source_file_property(_lang ${_first} HIP_SOURCE_PROPERTY_FORMAT) if(_lang STREQUAL Fortran) #Don't reset the linker if the NVCC or HIP linker is required - if (CUDA_LINK_WITH_NVCC) + if (NOT CUDA_LINK_WITH_NVCC) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) endif() target_include_directories(${arg_NAME} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}) From 203fc802316a05d93f01760d495d54dfcbd6f6b9 Mon Sep 17 00:00:00 2001 From: Kristi Belcher Date: Mon, 21 Dec 2020 10:55:51 -0800 Subject: [PATCH 162/330] correcting the HIP linker check --- cmake/BLTMacros.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 577529f38..055155ec1 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -794,10 +794,11 @@ macro(blt_add_executable) # CMake wants to load with C++ if any of the libraries are C++. # Force to load with Fortran if the first file is Fortran. list(GET arg_SOURCES 0 _first) - get_source_file_property(_lang ${_first} HIP_SOURCE_PROPERTY_FORMAT) + get_source_file_property(_lang ${_first} LANGUAGE) if(_lang STREQUAL Fortran) + get_source_file_property(_is_hip ${_first} HIP_SOURCE_PROPERTY_FORMAT) #Don't reset the linker if the NVCC or HIP linker is required - if (NOT CUDA_LINK_WITH_NVCC) + if (NOT (CUDA_LINK_WITH_NVCC OR ${_is_hip})) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) endif() target_include_directories(${arg_NAME} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}) From 1c7b9021eb823f098f418cae50c3d24570410094 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 13:29:07 -0800 Subject: [PATCH 163/330] feat: add FRUIT MPI extensions This commit adds the FRUIT MPI extensions to BLT's copy of FRUIT. --- thirdparty_builtin/fruit-3.4.1/fruit_mpi.f90 | 261 +++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 thirdparty_builtin/fruit-3.4.1/fruit_mpi.f90 diff --git a/thirdparty_builtin/fruit-3.4.1/fruit_mpi.f90 b/thirdparty_builtin/fruit-3.4.1/fruit_mpi.f90 new file mode 100644 index 000000000..9cd297a3e --- /dev/null +++ b/thirdparty_builtin/fruit-3.4.1/fruit_mpi.f90 @@ -0,0 +1,261 @@ +module fruit_mpi + use fruit + use mpi + implicit none + private + + integer, parameter :: XML_OPEN = 20 + integer, parameter :: XML_WORK = 21 + character(len = *), parameter :: xml_filename = "result.xml" + integer, parameter :: NUMBER_LENGTH = 10 + integer, parameter :: FN_LENGTH = 50 + + public :: fruit_init_mpi_xml + interface fruit_init_mpi_xml + module procedure fruit_init_mpi_xml_ + end interface + + public :: fruit_finalize_mpi + interface fruit_finalize_mpi + module procedure fruit_finalize_mpi_ + end interface + + public :: fruit_summary_mpi + interface fruit_summary_mpi + module procedure fruit_summary_mpi_ + end interface + + public :: fruit_summary_mpi_xml + interface fruit_summary_mpi_xml + module procedure fruit_summary_mpi_xml_ + end interface +contains + subroutine fruit_init_mpi_xml_(rank) + integer, intent(in) :: rank + character(len = FN_LENGTH) :: xml_filename_work + + write(xml_filename_work, '("result_tmp_", i5.5, ".xml")') rank + call set_xml_filename_work(xml_filename_work) + + call init_fruit_xml(rank) + end subroutine fruit_init_mpi_xml_ + + subroutine fruit_finalize_mpi_(size, rank) + integer, intent(in) :: size, rank + if (size < 0) print *, "size negative" + if (rank < 0) print *, "rank negative" + call fruit_finalize + end subroutine fruit_finalize_mpi_ + + subroutine fruit_summary_mpi_(size, rank) + integer, intent(in) :: size, rank + integer :: fail_assert_sum + integer :: succ_assert_sum + integer :: fail_case_sum + integer :: succ_case_sum + + integer :: fail_assert + integer :: succ_assert + integer :: fail_case + integer :: succ_case + + integer :: message_index + integer :: num_msgs + integer :: num_msgs_sum + integer, allocatable :: num_msgs_rank(:) + + integer :: ierr + integer :: i + integer :: imsg + integer :: status(MPI_STATUS_SIZE) + + integer, parameter :: MSG_LENGTH_HERE = 256 + character(len = MSG_LENGTH_HERE), allocatable :: msgs(:) + character(len = MSG_LENGTH_HERE), allocatable :: msgs_all(:) + + call get_assert_and_case_count(& + & fail_assert, succ_assert, & + & fail_case, succ_case) + + call get_message_index(message_index) + num_msgs = message_index - 1 + allocate(msgs(num_msgs)) + call get_message_array(msgs) + + allocate(num_msgs_rank(size)) + call MPI_Allgather(& + & num_msgs, 1, MPI_INTEGER, & + & num_msgs_rank, 1, MPI_INTEGER, MPI_COMM_WORLD, ierr) + + num_msgs_sum = sum(num_msgs_rank(:)) + allocate(msgs_all(num_msgs_sum)) + + ! array msgs_all: + ! + ! | msgs(:) of rank 0 | msgs(:) of rank 1 | msgs(:) of rank 2 | + ! | | | | + ! | num_msgs_rank(1) | num_msgs_rank(2) | num_msgs_rank(3) | + ! | | | | + ! | | | | + ! A A A + ! | | | + ! sum(num_msgs_rank(1:1))+1 | num_msgs_sum + ! sum(num_msgs_rank(1:2))+1 + + if (rank == 0) then + msgs_all(1:num_msgs) = msgs(1:num_msgs) + do i = 1, size - 1 + imsg = sum(num_msgs_rank(1:i)) + 1 + call MPI_RECV(& + & msgs_all(imsg), & + & num_msgs_rank(i + 1) * MSG_LENGTH_HERE, MPI_CHARACTER, & + & i, 7, MPI_COMM_WORLD, status, ierr) + enddo + else + call MPI_Send(& + & msgs, & + & num_msgs * MSG_LENGTH_HERE , MPI_CHARACTER, & + & 0, 7, MPI_COMM_WORLD, ierr) + endif + + call MPI_REDUCE(& + & fail_assert , & + & fail_assert_sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierr) + + call MPI_REDUCE(& + & succ_assert , & + & succ_assert_sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierr) + + call MPI_REDUCE(& + & fail_case , & + & fail_case_sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierr) + + call MPI_REDUCE(& + & succ_case , & + & succ_case_sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierr) + + if (rank == 0) then + write (*,*) + write (*,*) + write (*,*) ' Start of FRUIT summary: ' + write (*,*) + + if (fail_assert_sum > 0) then + write (*,*) 'Some tests failed!' + else + write (*,*) 'SUCCESSFUL!' + end if + + write (*,*) + write (*,*) ' -- Failed assertion messages:' + + do i = 1, num_msgs_sum + write (*, "(A)") ' '//trim(msgs_all(i)) + end do + + write (*, *) ' -- end of failed assertion messages.' + write (*, *) + + if (succ_assert_sum + fail_assert_sum /= 0) then + call fruit_summary_table(& + & succ_assert_sum, fail_assert_sum, & + & succ_case_sum , fail_case_sum & + &) + endif + write(*, *) ' -- end of FRUIT summary' + endif + end subroutine fruit_summary_mpi_ + + subroutine fruit_summary_mpi_xml_(size, rank) + integer, intent(in) :: size, rank + + character(len = 1000) :: whole_line + character(len = 100) :: full_count + character(len = 100) :: fail_count + character(len = FN_LENGTH) :: xml_filename_work + character(len = FN_LENGTH), allocatable :: xml_filename_work_all(:) + + integer :: fail_assert , succ_assert , fail_case , succ_case + integer :: fail_assert_sum, succ_assert_sum, fail_case_sum , succ_case_sum + integer :: i + integer :: status(MPI_STATUS_SIZE) + integer :: ierr + + call get_xml_filename_work(xml_filename_work) + + allocate(xml_filename_work_all(size)) + + if (rank /= 0) then + call MPI_Send( xml_filename_work, & + & FN_LENGTH, MPI_CHARACTER, 0, 8, MPI_COMM_WORLD, ierr) + endif + if (rank == 0) then + xml_filename_work_all(1) = xml_filename_work + + do i = 1+1, size + call MPI_RECV(xml_filename_work_all(i), & + & FN_LENGTH, MPI_CHARACTER, i - 1, 8, MPI_COMM_WORLD, status, ierr) + enddo + endif + + call get_assert_and_case_count(& + & fail_assert, succ_assert, & + & fail_case, succ_case) + + call MPI_REDUCE(& + & fail_assert , & + & fail_assert_sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierr) + + call MPI_REDUCE(& + & succ_assert , & + & succ_assert_sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierr) + + call MPI_REDUCE(& + & fail_case , & + & fail_case_sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierr) + + call MPI_REDUCE(& + & succ_case , & + & succ_case_sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierr) + + full_count = int_to_str(succ_case_sum + fail_case_sum) + fail_count = int_to_str( fail_case_sum) + + if (rank == 0) then + open (XML_OPEN, file = xml_filename, action ="write", status = "replace") + write(XML_OPEN, '("")') + write(XML_OPEN, '("")') + write(XML_OPEN, '(" ")') + + do i = 1, size + open (XML_WORK, FILE = xml_filename_work_all(i)) + do + read(XML_WORK, '(a)', end = 999) whole_line + write(XML_OPEN, '(a)') trim(whole_line) + enddo + 999 continue + close(XML_WORK) + enddo + + write(XML_OPEN, '(" ")') + write(XML_OPEN, '("")') + close(XML_OPEN) + endif + if (size < 0) print *, "size < 0" + end subroutine fruit_summary_mpi_xml_ + + function int_to_str(i) + integer, intent(in) :: i + character(LEN = NUMBER_LENGTH) :: int_to_str + + write(int_to_str, '(i10)') i + int_to_str = adjustl(int_to_str) + end function int_to_str +end module fruit_mpi From 46408b8db31a4f66874e7c2c13b1eee0615a2f78 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 13:46:04 -0800 Subject: [PATCH 164/330] feat: BLT FRUIT build: add fruit_mpi if using MPI This commit adds the FRUIT MPI extensions to BLT's internal build of FRUIT if MPI is enabled in the project build. --- thirdparty_builtin/fruit-3.4.1/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt b/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt index 6d06a9f99..c9904d879 100644 --- a/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt +++ b/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt @@ -15,3 +15,16 @@ blt_register_library( NAME fruit INCLUDES ${CMAKE_Fortran_MODULE_DIRECTORY} LIBRARIES fruit ) + +if(ENABLE_MPI) # TODO(oxberry1@llnl.gov): Replace with ENABLE_FRUIT_MPI + blt_add_library( + NAME fruit_mpi + SOURCES fruit_mpi.f90 + ) + blt_register_library( NAME fruit_mpi + DEPENDS_ON fruit MPI::Fortran + FORTRAN_MODULES ${CMAKE_Fortran_MODULE_DIRECTORY} + INCLUDES ${CMAKE_Fortran_MODULE_DIRECTORY} + LIBRARIES fruit_mpi + ) +endif() From a25080cfebdd6038e37aa5129dc5564eed055f76 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 14:06:18 -0800 Subject: [PATCH 165/330] feat: TPL build: add fruit_mpi to build This commit adds fruit_mpi to the third party libraries (TPL) build step of BLT. --- thirdparty_builtin/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/thirdparty_builtin/CMakeLists.txt b/thirdparty_builtin/CMakeLists.txt index ce38ab0a2..4256f468f 100644 --- a/thirdparty_builtin/CMakeLists.txt +++ b/thirdparty_builtin/CMakeLists.txt @@ -122,7 +122,10 @@ if(ENABLE_TESTS) if(ENABLE_FRUIT) add_subdirectory(fruit-3.4.1 ${BLT_BUILD_DIR}/thirdparty_builtin/fruit-3.4.1) - list(APPEND _blt_tpl_targets fruit) + list(APPEND _blt_tpl_targets fruit) + if(ENABLE_MPI) # TODO(oxberry1@llnl.gov): Replace with ENABLE_FRUIT_MPI + list(APPEND _blt_tpl_targets fruit_mpi) + endif() endif() endif() From 84d7b1558abdc744c5bb2e6d2866ed4c4b1da698 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 14:13:07 -0800 Subject: [PATCH 166/330] feat: options: add ENABLE_FRUIT_MPI This commit adds an ENABLE_FRUIT_MPI option to BLT as part of eventually exposing FRUIT MPI functionality in BLT. --- cmake/BLTOptions.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index 5baf598c8..d03d90e7d 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -81,6 +81,7 @@ endif() option(ENABLE_GTEST "Enable Google Test testing support (if ENABLE_TESTS=ON)" ${_CXX_enabled}) option(ENABLE_GMOCK "Enable Google Mock testing support (if ENABLE_TESTS=ON)" OFF) option(ENABLE_FRUIT "Enable Fruit testing support (if ENABLE_TESTS=ON and ENABLE_FORTRAN=ON)" ON) +option(ENABLE_FRUIT_MPI "Enable Fruit MPI testing support (if ENABLE_TESTS=ON and ENABLE_FORTRAN=ON and ENABLE_FRUIT=ON and ENABLE_MPI=ON" OFF) option(ENABLE_GBENCHMARK "Enable Google Benchmark support (if ENABLE_TESTS=ON)" ${ENABLE_BENCHMARKS}) From 80086dbe4e4468d5e12870c251d8ef39e0956ee4 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 14:15:53 -0800 Subject: [PATCH 167/330] squash: use ENABLE_FRUIT_MPI to BLT FRUIT build This commit replaces ENABLE_MPI with ENABLE_FRUIT_MPI in the conditional statement used in the FRUIT build part of BLT. Should be rebased & squashed later. --- thirdparty_builtin/fruit-3.4.1/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt b/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt index c9904d879..fe76f2566 100644 --- a/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt +++ b/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt @@ -16,7 +16,7 @@ blt_register_library( NAME fruit LIBRARIES fruit ) -if(ENABLE_MPI) # TODO(oxberry1@llnl.gov): Replace with ENABLE_FRUIT_MPI +if(ENABLE_FRUIT_MPI) blt_add_library( NAME fruit_mpi SOURCES fruit_mpi.f90 From 3b3144a79d1664e5a8f529e61ab32eae3f28c245 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 14:19:45 -0800 Subject: [PATCH 168/330] squash: use ENABLE_FRUIT_MPI in TPL build if stmt This commit replaces ENABLE_MPI with ENABLE_FRUIT_MPI in the conditional for the third-party libraries build part of BLT. Should be squashed later. --- thirdparty_builtin/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty_builtin/CMakeLists.txt b/thirdparty_builtin/CMakeLists.txt index 4256f468f..1312253fa 100644 --- a/thirdparty_builtin/CMakeLists.txt +++ b/thirdparty_builtin/CMakeLists.txt @@ -123,7 +123,7 @@ if(ENABLE_TESTS) add_subdirectory(fruit-3.4.1 ${BLT_BUILD_DIR}/thirdparty_builtin/fruit-3.4.1) list(APPEND _blt_tpl_targets fruit) - if(ENABLE_MPI) # TODO(oxberry1@llnl.gov): Replace with ENABLE_FRUIT_MPI + if(ENABLE_FRUIT_MPI) list(APPEND _blt_tpl_targets fruit_mpi) endif() endif() From 7c347ec3605c3d8dabb3412ef2ae6e9276975941 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 14:25:27 -0800 Subject: [PATCH 169/330] feat: fruit_mpi: add status message This commit adds a status message for the ENABLE_FRUIT_MPI flag in BLT. --- thirdparty_builtin/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/thirdparty_builtin/CMakeLists.txt b/thirdparty_builtin/CMakeLists.txt index 1312253fa..9fa664964 100644 --- a/thirdparty_builtin/CMakeLists.txt +++ b/thirdparty_builtin/CMakeLists.txt @@ -119,6 +119,7 @@ if(ENABLE_TESTS) # Enable Fruit (FortRan UnIT testing) support if (ENABLE_FORTRAN) message(STATUS "Fruit Support is ${ENABLE_FRUIT}") + message(STATUS "Fruit MPI Support is ${ENABLE_FRUIT_MPI}") if(ENABLE_FRUIT) add_subdirectory(fruit-3.4.1 ${BLT_BUILD_DIR}/thirdparty_builtin/fruit-3.4.1) From 915d5a2fdd345c7488cffa0ab82d5f3fb76c26f3 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 14:29:14 -0800 Subject: [PATCH 170/330] feat: TPL build: fruit_mpi: tweak conditional This commit tweaks the conditional for building fruit_mpi to reflect more accurately the documented option text. --- thirdparty_builtin/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty_builtin/CMakeLists.txt b/thirdparty_builtin/CMakeLists.txt index 9fa664964..b58a9eb20 100644 --- a/thirdparty_builtin/CMakeLists.txt +++ b/thirdparty_builtin/CMakeLists.txt @@ -124,7 +124,7 @@ if(ENABLE_TESTS) add_subdirectory(fruit-3.4.1 ${BLT_BUILD_DIR}/thirdparty_builtin/fruit-3.4.1) list(APPEND _blt_tpl_targets fruit) - if(ENABLE_FRUIT_MPI) + if(ENABLE_MPI AND ENABLE_FRUIT_MPI) list(APPEND _blt_tpl_targets fruit_mpi) endif() endif() From 98a8ee33275a75ee99e8c0c7697d8cc3f67e5cc2 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 15:10:55 -0800 Subject: [PATCH 171/330] fix: fruit build: mpi target is MPI::MPI_Fortran This commit fixes a bug in the call to blt_register_library that was added to the FRUIT build for FRUIT MPI. The MPI Fortran component is MPI::MPI_Fortran, not MPI::Fortran; all instances of the latter have been replaced by the former. --- thirdparty_builtin/fruit-3.4.1/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt b/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt index fe76f2566..67a0c12a8 100644 --- a/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt +++ b/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt @@ -22,7 +22,7 @@ if(ENABLE_FRUIT_MPI) SOURCES fruit_mpi.f90 ) blt_register_library( NAME fruit_mpi - DEPENDS_ON fruit MPI::Fortran + DEPENDS_ON fruit MPI::MPI_Fortran FORTRAN_MODULES ${CMAKE_Fortran_MODULE_DIRECTORY} INCLUDES ${CMAKE_Fortran_MODULE_DIRECTORY} LIBRARIES fruit_mpi From 8fd3c2cd8b1eed72636a2a5ebd5e5816a729f33c Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 15:14:23 -0800 Subject: [PATCH 172/330] feat: smoke tests: add FRUIT MPI smoke test This commit adds a Fortran 90 source file that serves as a smoke test for FRUIT MPI capability. The source file was written from scratch, but was copied into its own separate CMake project for debugging before adding to BLT. --- tests/smoke/blt_fruit_mpi_smoke.f90 | 73 +++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 tests/smoke/blt_fruit_mpi_smoke.f90 diff --git a/tests/smoke/blt_fruit_mpi_smoke.f90 b/tests/smoke/blt_fruit_mpi_smoke.f90 new file mode 100644 index 000000000..654941c85 --- /dev/null +++ b/tests/smoke/blt_fruit_mpi_smoke.f90 @@ -0,0 +1,73 @@ +! Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +! other BLT Project Developers. See the top-level COPYRIGHT file for details +! +! SPDX-License-Identifier: (BSD-3-Clause) + +!------------------------------------------------------------------------------ +! +! blt_fruit_smoke.f90 +! +!------------------------------------------------------------------------------ +module fruit_mpi_smoke + use iso_c_binding + use fruit + use mpi + use fruit_mpi + implicit none + +contains +!------------------------------------------------------------------------------ + + subroutine simple_mpi_test(comm) + integer, intent(in) :: comm + integer :: comm_size, comm_rank + integer :: mpi_err_stat + integer, parameter :: first_rank = 0 + + call mpi_comm_size(comm, comm_size, mpi_err_stat) + call mpi_comm_rank(comm, comm_rank, mpi_err_stat) + + call assert_true(comm_rank .ge. first_rank, & + "MPI comm rank is negative; something strange is happening") + call assert_true(comm_rank .lt. comm_size, & + "MPI comm rank is greater than or equal to comm size") + end subroutine simple_mpi_test + + +!---------------------------------------------------------------------- +end module fruit_mpi_smoke +!---------------------------------------------------------------------- + +program fortran_mpi_test + use fruit + use mpi + use fruit_mpi + use fruit_mpi_smoke + implicit none + logical :: ok_on_rank, ok_on_comm + + integer :: mpi_err_stat + integer :: comm_size, comm_rank + integer, parameter :: comm = MPI_COMM_WORLD + + call mpi_init(mpi_err_stat) + call mpi_comm_size(comm, comm_size, mpi_err_stat) + call mpi_comm_rank(comm, comm_rank, mpi_err_stat) + + call init_fruit +!---------- +! Our tests + call simple_mpi_test(comm) +!---------- + + call fruit_summary_mpi(comm_size, comm_rank) + call is_all_successful(ok_on_rank) + call mpi_allreduce(ok_on_rank, ok_on_comm, 1, MPI_LOGICAL, MPI_LAND, comm, mpi_err_stat) + + call fruit_finalize_mpi(comm_size, comm_rank) + call mpi_finalize(mpi_err_stat) + + if (.not. ok_on_comm) then + call exit(1) + endif +end program fortran_mpi_test From 87044f6d336bf164c21b8af85b4e17aa730b5d0c Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 15:41:43 -0800 Subject: [PATCH 173/330] feat: smoke test build: add FRUIT MPI smoke test This commit adds a FRUIT MPI smoke test to the smoke test build script to test the FRUIT MPI capability. --- tests/smoke/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/smoke/CMakeLists.txt b/tests/smoke/CMakeLists.txt index b36e6c0fb..c4e62bf63 100644 --- a/tests/smoke/CMakeLists.txt +++ b/tests/smoke/CMakeLists.txt @@ -65,6 +65,19 @@ if (ENABLE_FORTRAN AND ENABLE_FRUIT) COMMAND blt_fruit_smoke) endif() +############### +# fruit mpi test +############### +if (ENABLE_FORTRAN AND ENABLE_FRUIT AND ENABLE_MPI AND ENABLE_FRUIT_MPI) + blt_add_executable(NAME blt_fruit_mpi_smoke + SOURCES blt_fruit_mpi_smoke.f90 + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON fruit fruit_mpi MPI::MPI_Fortran + FOLDER blt/tests ) + + blt_add_test(NAME blt_fruit_mpi_smoke + COMMAND blt_fruit_mpi_smoke) +endif() ################ # OpenMP test From 216bcac29975ef9ebf03f6eb69ba7c845aea6647 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 15:47:09 -0800 Subject: [PATCH 174/330] feat: FRUIT MPI smoke test: add C++ driver This commit adds a C++ driver for the FRUIT MPI smoke test by analogy to the C++ driver for the FRUIT smoke test. Comments note that no MPI calls should be made in this C++ driver. --- tests/smoke/fortran_mpi_driver.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/smoke/fortran_mpi_driver.cpp diff --git a/tests/smoke/fortran_mpi_driver.cpp b/tests/smoke/fortran_mpi_driver.cpp new file mode 100644 index 000000000..ee47a84cf --- /dev/null +++ b/tests/smoke/fortran_mpi_driver.cpp @@ -0,0 +1,23 @@ +// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// other BLT Project Developers. See the top-level COPYRIGHT file for details +// +// SPDX-License-Identifier: (BSD-3-Clause) + +//---------------------------------------------------------------------- + +/* + fortran_mpi_test manages MPI_Init & MPI_Finalize. Do not put MPI + calls in this driver file -- put these calls in fortran_mpi_test, + which should be defined in blt_fruit_mpi_test.f90. + */ +extern "C" int fortran_mpi_test(); + +int main() +{ + int result = 0; + + // finalized when exiting main scope + result = fortran_mpi_test(); + + return result; +} From d8d739ba099d3948312cceb7ede64b89bb584274 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 15:48:37 -0800 Subject: [PATCH 175/330] feat: FRUIT MPI C++ driver: format using clang This commit adds the FRUIT MPI C++ driver to the list of C++ source files being formatted by clang(-format) in the internal test CMake project. --- tests/internal/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index a836b91af..28e6cc117 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -290,6 +290,7 @@ if(CLANGFORMAT_FOUND) ../smoke/blt_mpi_smoke.cpp ../smoke/blt_openmp_smoke.cpp ../smoke/fortran_driver.cpp + ../smoke/fortran_mpi_driver.cpp ) set(internal_tests_srcs From 948b541dee17646b4ba72d31bdacba83612d95e4 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Tue, 22 Dec 2020 15:51:42 -0800 Subject: [PATCH 176/330] release notes: add note re: FRUIT MPI unit testing This commit adds an item to the release notes about adding FRUIT's MPI unit test reporting to BLT. --- RELEASE-NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0955cc930..69dafa59d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -30,6 +30,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added support for formatting CMake code using cmake-format. - Added an EXPORTABLE option to ``blt_import_library`` that allows imported libraries to be added to an export set and installed. +- Added FRUIT's MPI parallel unit test reporting to BLT's internal copy of FRUIT ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed From 1ef5ca27e6cd977e94cd576bc47a7a23e925dfb8 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 22 Dec 2020 18:19:42 -0600 Subject: [PATCH 177/330] feat: initial attempt to propagate link dependencies --- cmake/BLTMacros.cmake | 14 +++++++++----- cmake/BLTPrivateMacros.cmake | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 055155ec1..48ff46f08 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -796,11 +796,7 @@ macro(blt_add_executable) list(GET arg_SOURCES 0 _first) get_source_file_property(_lang ${_first} LANGUAGE) if(_lang STREQUAL Fortran) - get_source_file_property(_is_hip ${_first} HIP_SOURCE_PROPERTY_FORMAT) - #Don't reset the linker if the NVCC or HIP linker is required - if (NOT (CUDA_LINK_WITH_NVCC OR ${_is_hip})) - set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) - endif() + set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE Fortran ) target_include_directories(${arg_NAME} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}) endif() @@ -808,6 +804,14 @@ macro(blt_add_executable) DEPENDS_ON ${arg_DEPENDS_ON} OBJECT FALSE) + # Override the linker language with BLT_LINKER_LANGUAGE, if applicable + # Will have just been populated by blt_setup_target + get_target_property(_blt_link_lang ${arg_NAME} BLT_LINKER_LANGUAGE) + if(_blt_link_lang) + # This is the final link (b/c executable), so override the actual LINKER_LANGUAGE + set_target_properties(${arg_NAME} PROPERTIES LINKER_LANGUAGE ${_blt_link_lang}) + endif() + # fix the openmp flags for fortran if needed # NOTE: this needs to be called after blt_setup_target() if (_lang STREQUAL Fortran) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index ad10eb86d..a61746d9e 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -319,7 +319,7 @@ macro(blt_setup_target) endforeach() # Add dependency's information - foreach( dependency ${_expanded_DEPENDS_ON} ) + foreach( ${_expanded_DEPENDS_ON} ) string(TOUPPER ${dependency} uppercase_dependency ) if ( NOT arg_OBJECT AND _BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY ) @@ -389,6 +389,14 @@ macro(blt_setup_target) blt_add_target_link_flags(TO ${arg_NAME} FLAGS ${_BLT_${uppercase_dependency}_LINK_FLAGS} ) endif() + # Propagate the overridden linker language, if applicable + if(TARGET ${dependency}) + get_target_property(_blt_link_lang ${dependency} BLT_LINKER_LANGUAGE) + # TODO: Do we need to worry about overwriting? Should only ever be HIP or CUDA + if(_blt_link_lang) + set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE ${_blt_link_lang}) + endif() + endif() endforeach() endmacro(blt_setup_target) @@ -434,6 +442,9 @@ macro(blt_setup_cuda_target) if (${_depends_on_cuda_runtime} OR ${_depends_on_cuda}) if (CUDA_LINK_WITH_NVCC) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE CUDA) + # This will be propagated up to the final executable target, which will + # need the NVCC linker + set_target_properties( ${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE CUDA) endif() endif() @@ -522,6 +533,11 @@ macro(blt_add_hip_library) HIP_SOURCE_PROPERTY_FORMAT TRUE) hip_add_library( ${arg_NAME} ${arg_SOURCES} ${arg_LIBRARY_TYPE} ) + # Link to the hip_runtime target so it gets pulled in by targets + # depending on this target + target_link_libraries(${arg_NAME} PUBLIC hip_runtime) + # An executable depending on this library needs to use the HIP linker + set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE HIP) else() add_library( ${arg_NAME} ${arg_LIBRARY_TYPE} ${arg_SOURCES} ${arg_HEADERS} ) endif() From 77fe7d32da0ed5b1a15d49409cf72bfdebca8553 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 22 Dec 2020 16:35:33 -0800 Subject: [PATCH 178/330] fix: only check non-interface targets --- cmake/BLTPrivateMacros.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index a61746d9e..d7f5ce987 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -319,7 +319,7 @@ macro(blt_setup_target) endforeach() # Add dependency's information - foreach( ${_expanded_DEPENDS_ON} ) + foreach( dependency ${_expanded_DEPENDS_ON} ) string(TOUPPER ${dependency} uppercase_dependency ) if ( NOT arg_OBJECT AND _BLT_${uppercase_dependency}_IS_OBJECT_LIBRARY ) @@ -391,10 +391,13 @@ macro(blt_setup_target) endif() # Propagate the overridden linker language, if applicable if(TARGET ${dependency}) - get_target_property(_blt_link_lang ${dependency} BLT_LINKER_LANGUAGE) - # TODO: Do we need to worry about overwriting? Should only ever be HIP or CUDA - if(_blt_link_lang) - set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE ${_blt_link_lang}) + get_target_property(_dep_type ${dependency} TYPE) + if(NOT "${_dep_type}" STREQUAL "INTERFACE_LIBRARY") + get_target_property(_blt_link_lang ${dependency} BLT_LINKER_LANGUAGE) + # TODO: Do we need to worry about overwriting? Should only ever be HIP or CUDA + if(_blt_link_lang) + set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE ${_blt_link_lang}) + endif() endif() endif() endforeach() From 49edfd2d2d5c264d83dfffcbdfce95cda5be821e Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 28 Dec 2020 15:58:04 -0600 Subject: [PATCH 179/330] docs: update changelog with info on linker language resolution --- RELEASE-NOTES.md | 2 ++ cmake/BLTMacros.cmake | 5 +++-- cmake/BLTPrivateMacros.cmake | 9 +++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0955cc930..0e1e4efaf 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -67,6 +67,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ erroneously marking them as SYSTEM but this is not supported by PGI. - Check added to make sure that if HIP is enabled with fortran, the LINKER LANGUAGE is not changed back to Fortran. +- If an executable needs to be linked with the HIP or CUDA (NVCC) linker, this information + is internally propagated up the dependency graph and used to override the LINK_LANGUAGE ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 48ff46f08..86b040f60 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -804,11 +804,12 @@ macro(blt_add_executable) DEPENDS_ON ${arg_DEPENDS_ON} OBJECT FALSE) - # Override the linker language with BLT_LINKER_LANGUAGE, if applicable + # Override the linker language with BLT_LINKER_LANGUAGE_OVERRIDE, if applicable # Will have just been populated by blt_setup_target - get_target_property(_blt_link_lang ${arg_NAME} BLT_LINKER_LANGUAGE) + get_target_property(_blt_link_lang ${arg_NAME} BLT_LINKER_LANGUAGE_OVERRIDE) if(_blt_link_lang) # This is the final link (b/c executable), so override the actual LINKER_LANGUAGE + # The override will only ever be HIP or CUDA set_target_properties(${arg_NAME} PROPERTIES LINKER_LANGUAGE ${_blt_link_lang}) endif() diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index d7f5ce987..220808e06 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -391,12 +391,13 @@ macro(blt_setup_target) endif() # Propagate the overridden linker language, if applicable if(TARGET ${dependency}) + # If it's an interface library CMake doesn't even allow us to query the property get_target_property(_dep_type ${dependency} TYPE) if(NOT "${_dep_type}" STREQUAL "INTERFACE_LIBRARY") - get_target_property(_blt_link_lang ${dependency} BLT_LINKER_LANGUAGE) + get_target_property(_blt_link_lang ${dependency} BLT_LINKER_LANGUAGE_OVERRIDE) # TODO: Do we need to worry about overwriting? Should only ever be HIP or CUDA if(_blt_link_lang) - set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE ${_blt_link_lang}) + set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE ${_blt_link_lang}) endif() endif() endif() @@ -447,7 +448,7 @@ macro(blt_setup_cuda_target) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE CUDA) # This will be propagated up to the final executable target, which will # need the NVCC linker - set_target_properties( ${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE CUDA) + set_target_properties( ${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE CUDA) endif() endif() @@ -540,7 +541,7 @@ macro(blt_add_hip_library) # depending on this target target_link_libraries(${arg_NAME} PUBLIC hip_runtime) # An executable depending on this library needs to use the HIP linker - set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE HIP) + set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE HIP) else() add_library( ${arg_NAME} ${arg_LIBRARY_TYPE} ${arg_SOURCES} ${arg_HEADERS} ) endif() From e366e0fabf2974e9e2c97bc1298fb78417b0a15a Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 4 Jan 2021 08:19:02 -0800 Subject: [PATCH 180/330] fix: also enable HIP linker for targets depending on hip_runtime --- cmake/BLTPrivateMacros.cmake | 13 +++++++++---- cmake/thirdparty/SetupHIP.cmake | 3 --- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 220808e06..03be8d702 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -446,8 +446,8 @@ macro(blt_setup_cuda_target) if (${_depends_on_cuda_runtime} OR ${_depends_on_cuda}) if (CUDA_LINK_WITH_NVCC) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE CUDA) - # This will be propagated up to the final executable target, which will - # need the NVCC linker + # This will be propagated up to executable targets that depend on this + # library, which will need the HIP linker set_target_properties( ${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE CUDA) endif() endif() @@ -522,6 +522,7 @@ macro(blt_add_hip_library) set(_depends_on_hip_runtime TRUE) endif() + if (${_depends_on_hip}) # if hip is in depends_on, flag each file's language as HIP # instead of leaving it up to CMake to decide @@ -540,12 +541,16 @@ macro(blt_add_hip_library) # Link to the hip_runtime target so it gets pulled in by targets # depending on this target target_link_libraries(${arg_NAME} PUBLIC hip_runtime) - # An executable depending on this library needs to use the HIP linker - set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE HIP) else() add_library( ${arg_NAME} ${arg_LIBRARY_TYPE} ${arg_SOURCES} ${arg_HEADERS} ) endif() + if (${_depends_on_hip_runtime} OR ${_depends_on_hip}) + # This will be propagated up to executable targets that depend on this + # library, which will need the HIP linker + set_target_properties( ${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE HIP) + endif() + endmacro(blt_add_hip_library) ##------------------------------------------------------------------------------ diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index 286cdbc47..dbf5e53c3 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -26,8 +26,6 @@ else() set(HIP_RUNTIME_INCLUDE_DIRS "${HIP_ROOT_DIR}/include" CACHE STRING "") endif() set(HIP_RUNTIME_COMPILE_FLAGS "${HIP_RUNTIME_COMPILE_FLAGS};-D${HIP_RUNTIME_DEFINE};-Wno-unused-parameter") -# set(HIP_RUNTIME_LIBRARIES "${HIP_ROOT_DIR}/hcc/lib") -# set(HIP_RUNTIME_LIBRARIES "${HIP_ROOT_DIR}/hcc/lib") # depend on 'hip', if you need to use hip # headers, link to hip libs, and need to run your source @@ -43,6 +41,5 @@ blt_import_library(NAME hip_runtime INCLUDES ${HIP_RUNTIME_INCLUDE_DIRS} DEFINES ${HIP_RUNTIME_DEFINES} COMPILE_FLAGS ${HIP_RUNTIME_COMPILE_FLAGS} - LIBRARIES ${HIP_RUNTIME_LIBRARIES} TREAT_INCLUDES_AS_SYSTEM ON EXPORTABLE ${BLT_EXPORT_THIRDPARTY}) From 612c3895538da5c73e265389b6eabd0a0d8b1e8b Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 4 Jan 2021 08:22:33 -0800 Subject: [PATCH 181/330] docs: update changelog --- RELEASE-NOTES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0e1e4efaf..fec78d59d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -68,7 +68,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Check added to make sure that if HIP is enabled with fortran, the LINKER LANGUAGE is not changed back to Fortran. - If an executable needs to be linked with the HIP or CUDA (NVCC) linker, this information - is internally propagated up the dependency graph and used to override the LINK_LANGUAGE + is internally propagated up the dependency graph and used to override the LINKER_LANGUAGE + target property for executable targets ## [Version 0.3.6] - Release date 2020-07-27 From 4bbd90ea8f673b7673347d39c1ce62dd73a84929 Mon Sep 17 00:00:00 2001 From: Josh Essman <68349992+joshessman-llnl@users.noreply.github.com> Date: Mon, 4 Jan 2021 10:51:15 -0600 Subject: [PATCH 182/330] docs: update changelog --- RELEASE-NOTES.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index fec78d59d..16ea0caed 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -67,9 +67,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ erroneously marking them as SYSTEM but this is not supported by PGI. - Check added to make sure that if HIP is enabled with fortran, the LINKER LANGUAGE is not changed back to Fortran. -- If an executable needs to be linked with the HIP or CUDA (NVCC) linker, this information - is internally propagated up the dependency graph and used to override the LINKER_LANGUAGE - target property for executable targets +- Executables that link to libraries that depend on `hip`/`cuda`(`_runtime`) will automatically + be linked with the HIP or CUDA (NVCC) linker ## [Version 0.3.6] - Release date 2020-07-27 From 219194845b83dad6b42e369adc4cc748f091bcec Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 4 Jan 2021 14:57:05 -0600 Subject: [PATCH 183/330] docs: clearer explanation of affected targets --- RELEASE-NOTES.md | 4 ++-- cmake/BLTMacros.cmake | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 16ea0caed..0585b6558 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -67,8 +67,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ erroneously marking them as SYSTEM but this is not supported by PGI. - Check added to make sure that if HIP is enabled with fortran, the LINKER LANGUAGE is not changed back to Fortran. -- Executables that link to libraries that depend on `hip`/`cuda`(`_runtime`) will automatically - be linked with the HIP or CUDA (NVCC) linker +- Executables that link to libraries that depend on `hip`/`hip_runtime`/`cuda`/`cuda_runtime` + will automatically be linked with the HIP or CUDA (NVCC) linker ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 86b040f60..4e5a526f4 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -809,7 +809,7 @@ macro(blt_add_executable) get_target_property(_blt_link_lang ${arg_NAME} BLT_LINKER_LANGUAGE_OVERRIDE) if(_blt_link_lang) # This is the final link (b/c executable), so override the actual LINKER_LANGUAGE - # The override will only ever be HIP or CUDA + # BLT currently uses this to override for HIP and CUDA linkers set_target_properties(${arg_NAME} PROPERTIES LINKER_LANGUAGE ${_blt_link_lang}) endif() From af04a48fe84d0f3d7398fe25ffdec2d35787a684 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 4 Jan 2021 15:55:11 -0600 Subject: [PATCH 184/330] fix: BLT_LINKER_LANGUAGE_OVERRIDE -> INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE --- cmake/BLTMacros.cmake | 4 ++-- cmake/BLTPrivateMacros.cmake | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 4e5a526f4..08662a6ec 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -804,9 +804,9 @@ macro(blt_add_executable) DEPENDS_ON ${arg_DEPENDS_ON} OBJECT FALSE) - # Override the linker language with BLT_LINKER_LANGUAGE_OVERRIDE, if applicable + # Override the linker language with INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE, if applicable # Will have just been populated by blt_setup_target - get_target_property(_blt_link_lang ${arg_NAME} BLT_LINKER_LANGUAGE_OVERRIDE) + get_target_property(_blt_link_lang ${arg_NAME} INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE) if(_blt_link_lang) # This is the final link (b/c executable), so override the actual LINKER_LANGUAGE # BLT currently uses this to override for HIP and CUDA linkers diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 03be8d702..c262f00c4 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -394,10 +394,10 @@ macro(blt_setup_target) # If it's an interface library CMake doesn't even allow us to query the property get_target_property(_dep_type ${dependency} TYPE) if(NOT "${_dep_type}" STREQUAL "INTERFACE_LIBRARY") - get_target_property(_blt_link_lang ${dependency} BLT_LINKER_LANGUAGE_OVERRIDE) + get_target_property(_blt_link_lang ${dependency} INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE) # TODO: Do we need to worry about overwriting? Should only ever be HIP or CUDA if(_blt_link_lang) - set_target_properties(${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE ${_blt_link_lang}) + set_target_properties(${arg_NAME} PROPERTIES INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE ${_blt_link_lang}) endif() endif() endif() @@ -448,7 +448,7 @@ macro(blt_setup_cuda_target) set_target_properties( ${arg_NAME} PROPERTIES LINKER_LANGUAGE CUDA) # This will be propagated up to executable targets that depend on this # library, which will need the HIP linker - set_target_properties( ${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE CUDA) + set_target_properties( ${arg_NAME} PROPERTIES INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE CUDA) endif() endif() @@ -548,7 +548,7 @@ macro(blt_add_hip_library) if (${_depends_on_hip_runtime} OR ${_depends_on_hip}) # This will be propagated up to executable targets that depend on this # library, which will need the HIP linker - set_target_properties( ${arg_NAME} PROPERTIES BLT_LINKER_LANGUAGE_OVERRIDE HIP) + set_target_properties( ${arg_NAME} PROPERTIES INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE HIP) endif() endmacro(blt_add_hip_library) From a31eb1bc0c1b6006329dc96ba9247e57ffe56214 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Thu, 7 Jan 2021 13:40:29 -0800 Subject: [PATCH 185/330] feat: add custom command for a device link on object library dependencies --- cmake/BLTPrivateMacros.cmake | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index c262f00c4..9c450c4d1 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -389,17 +389,38 @@ macro(blt_setup_target) blt_add_target_link_flags(TO ${arg_NAME} FLAGS ${_BLT_${uppercase_dependency}_LINK_FLAGS} ) endif() - # Propagate the overridden linker language, if applicable + if(TARGET ${dependency}) # If it's an interface library CMake doesn't even allow us to query the property get_target_property(_dep_type ${dependency} TYPE) if(NOT "${_dep_type}" STREQUAL "INTERFACE_LIBRARY") + # Propagate the overridden linker language, if applicable get_target_property(_blt_link_lang ${dependency} INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE) # TODO: Do we need to worry about overwriting? Should only ever be HIP or CUDA if(_blt_link_lang) set_target_properties(${arg_NAME} PROPERTIES INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE ${_blt_link_lang}) endif() endif() + + # Check if a separate device link is needed + if(ENABLE_CUDA AND "${_dep_type}" STREQUAL "OBJECT_LIBRARY") + get_target_property(_device_link ${dependency} CUDA_RESOLVE_DEVICE_SYMBOLS) + if((_device_link OR BLT_CUDA_RESOLVE_DEVICE_SYMBOLS) AND CUDA_LINK_WITH_NVCC) + set(_dlink_obj "${dependency}_device_link${CMAKE_CUDA_OUTPUT_EXTENSION}") + # Make sure a target wasn't already added + get_source_file_property(_generated ${_dlink_obj} GENERATED) + if(NOT _generated) + # FIXME: Standardize a cuda_arch flag?? + add_custom_command( + OUTPUT ${_dlink_obj} + COMMAND ${CMAKE_CUDA_COMPILER} --device-link $ -o ${_dlink_obj} + DEPENDS $ + COMMAND_EXPAND_LISTS + ) + endif() + target_sources(${arg_NAME} PRIVATE ${_dlink_obj}) + endif() + endif() endif() endforeach() From 99322a95fd471f4d729202d9fd4260758a8d0b44 Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Thu, 7 Jan 2021 14:53:30 -0800 Subject: [PATCH 186/330] fruit_mpi test: remove redundant dependencies This commit removes redundant dependencies from the blt_fruit_mpi_smoke test. There is no need to list explicitly fruit and MPI::MPI_Fortran as dependencies because automatically propagates that dependency information to any targets dependent on fruit_mpi. --- tests/smoke/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/smoke/CMakeLists.txt b/tests/smoke/CMakeLists.txt index c4e62bf63..ab73cef94 100644 --- a/tests/smoke/CMakeLists.txt +++ b/tests/smoke/CMakeLists.txt @@ -72,7 +72,7 @@ if (ENABLE_FORTRAN AND ENABLE_FRUIT AND ENABLE_MPI AND ENABLE_FRUIT_MPI) blt_add_executable(NAME blt_fruit_mpi_smoke SOURCES blt_fruit_mpi_smoke.f90 OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON fruit fruit_mpi MPI::MPI_Fortran + DEPENDS_ON fruit_mpi FOLDER blt/tests ) blt_add_test(NAME blt_fruit_mpi_smoke From ae5b4646bacbd1402be1470142a377c13565de2c Mon Sep 17 00:00:00 2001 From: "Geoffrey M. Oxberry" Date: Thu, 7 Jan 2021 19:01:32 -0800 Subject: [PATCH 187/330] fix: fruit_mpi blt_add_library: add depends_on arg This commit adds a missing DEPENDS_ON argument to the blt_add_library macro invocation for fruit_mpi. Without this argument, CMake will not propagate target dependencies correctly, and users will observe "missing module imports" errors directing them to modify their include directory search path. --- thirdparty_builtin/fruit-3.4.1/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt b/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt index 67a0c12a8..88dd9b67a 100644 --- a/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt +++ b/thirdparty_builtin/fruit-3.4.1/CMakeLists.txt @@ -20,6 +20,7 @@ if(ENABLE_FRUIT_MPI) blt_add_library( NAME fruit_mpi SOURCES fruit_mpi.f90 + DEPENDS_ON fruit MPI::MPI_Fortran ) blt_register_library( NAME fruit_mpi DEPENDS_ON fruit MPI::MPI_Fortran From 17691f614c178bfefcc393248b7957e4305d9459 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 11 Jan 2021 10:19:44 -0600 Subject: [PATCH 188/330] docs: begin documenting new device link option --- cmake/BLTOptions.cmake | 3 +++ cmake/BLTPrivateMacros.cmake | 3 ++- docs/tutorial/creating_execs_and_libs.rst | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index 5baf598c8..8328a82ce 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -57,6 +57,9 @@ option(ENABLE_CLANG_CUDA "Enable Clang's native CUDA support" OFF) mark_as_advanced(ENABLE_CLANG_CUDA) set(BLT_CLANG_CUDA_ARCH "sm_30" CACHE STRING "Compute architecture to use when generating CUDA code with Clang") mark_as_advanced(BLT_CLANG_CUDA_ARCH) +cmake_dependent_option(BLT_CUDA_RESOLVE_DEVICE_SYMBOLS + "Add a manual CUDA device link step for all object libraries" OFF + "ENABLE_CUDA AND CUDA_LINK_WITH_NVCC" OFF) option(ENABLE_HIP "Enable HIP support" OFF) option(ENABLE_HCC "Enable HCC support" OFF) set(BLT_ROCM_ARCH "gfx900" CACHE STRING "gfx architecture to use when generating ROCm code") diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 9c450c4d1..3944a7d49 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -411,9 +411,10 @@ macro(blt_setup_target) get_source_file_property(_generated ${_dlink_obj} GENERATED) if(NOT _generated) # FIXME: Standardize a cuda_arch flag?? + set(_cuda_flags ${CMAKE_CUDA_FLAGS}) add_custom_command( OUTPUT ${_dlink_obj} - COMMAND ${CMAKE_CUDA_COMPILER} --device-link $ -o ${_dlink_obj} + COMMAND ${CMAKE_CUDA_COMPILER} --device-link ${_cuda_flags} $ -o ${_dlink_obj} DEPENDS $ COMMAND_EXPAND_LISTS ) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index 6f02cfa39..e60a136f3 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -122,3 +122,16 @@ the linker removing unused symbols in the larger library. Due to record keeping on BLT's part to make object libraries as easy to use as possible, you need to define object libraries before you use them if you need their inheritable information to be correct. + +If you are using separable CUDA compilation (relocatable device code) in your +object library, users of that library will be required to use NVCC to link their +executables - in general, only NVCC can perform the "device link" step. To remove +this restriction, you can enable the ``CUDA_RESOLVE_DEVICE_SYMBOLS`` property on +an object library: + +.. code-block:: cmake + + set_target_properties(myObjectLibrary PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON) + +To enable this device linking step for all object libraries in your project, you +can set the ``BLT_CUDA_RESOLVE_DEVICE_SYMBOLS`` option to ``ON``. From 7881c61266fbfa4ef965c9b063750023aba28bca Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 11 Jan 2021 08:39:31 -0800 Subject: [PATCH 189/330] fix: convert cuda flags to ;-list --- cmake/BLTPrivateMacros.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 3944a7d49..f8415922b 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -410,8 +410,8 @@ macro(blt_setup_target) # Make sure a target wasn't already added get_source_file_property(_generated ${_dlink_obj} GENERATED) if(NOT _generated) - # FIXME: Standardize a cuda_arch flag?? - set(_cuda_flags ${CMAKE_CUDA_FLAGS}) + # Convert string to list as it will be expanded + string(REPLACE " " ";" _cuda_flags ${CMAKE_CUDA_FLAGS}) add_custom_command( OUTPUT ${_dlink_obj} COMMAND ${CMAKE_CUDA_COMPILER} --device-link ${_cuda_flags} $ -o ${_dlink_obj} From 41862f50475b912ff1db87d9c38d2dc20b0b73ba Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 11 Jan 2021 10:49:24 -0600 Subject: [PATCH 190/330] docs: further clarification on how object library device linking works --- docs/tutorial/creating_execs_and_libs.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index e60a136f3..e767dfc07 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -135,3 +135,9 @@ an object library: To enable this device linking step for all object libraries in your project, you can set the ``BLT_CUDA_RESOLVE_DEVICE_SYMBOLS`` option to ``ON``. + +.. note:: + These options only apply when an object library in your project is linked later + into a shared or static library, in which case a separate object file containing + device symbols is created and added to the "final" library. Object libraries + provided directly to users of your project will still require a device link step. From f30aa014fda7a8f5edfacd97d3bd6a628fd91265 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 11 Jan 2021 11:25:28 -0600 Subject: [PATCH 191/330] docs: update changelog --- RELEASE-NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0585b6558..0eea306af 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -30,6 +30,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added support for formatting CMake code using cmake-format. - Added an EXPORTABLE option to ``blt_import_library`` that allows imported libraries to be added to an export set and installed. +- CUDA device links for object libraries can be enabled with the ``CUDA_RESOLVE_DEVICE_SYMBOLS`` + target property or the global ``BLT_CUDA_RESOLVE_DEVICE_SYMBOLS`` option. ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed From 8bf98cf0748e8a64a66c087bc80a73553a1375ca Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Mon, 11 Jan 2021 16:42:38 -0600 Subject: [PATCH 192/330] docs: add snippet on defaults for device link --- docs/tutorial/creating_execs_and_libs.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index e767dfc07..d52a28c2f 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -141,3 +141,6 @@ can set the ``BLT_CUDA_RESOLVE_DEVICE_SYMBOLS`` option to ``ON``. into a shared or static library, in which case a separate object file containing device symbols is created and added to the "final" library. Object libraries provided directly to users of your project will still require a device link step. + +The ``CUDA_RESOLVE_DEVICE_SYMBOLS`` property is also supported for static and shared libraries. +By default, it is enabled for shared libraries but disabled for static libraries. From d695a9df9b3384092c780573c18f653e76111cac Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 11 Jan 2021 20:50:33 -0800 Subject: [PATCH 193/330] Update copyright for 2021 --- LICENSE | 2 +- SetupBLT.cmake | 2 +- azure-pipelines.yml | 2 +- cmake/BLTGitMacros.cmake | 2 +- cmake/BLTMacros.cmake | 2 +- cmake/BLTOptions.cmake | 2 +- cmake/BLTPrivateMacros.cmake | 2 +- cmake/SetupCodeChecks.cmake | 2 +- cmake/SetupCodeMetrics.cmake | 2 +- cmake/SetupCompilerOptions.cmake | 2 +- cmake/SetupDocs.cmake | 2 +- cmake/WrapAstyle.cmake.in | 2 +- cmake/clang-query-wrapper.py | 2 +- cmake/thirdparty/FindHIP.cmake | 2 +- cmake/thirdparty/FindHIP/run_hipcc.cmake | 2 +- cmake/thirdparty/FindHIP/run_make2cmake.cmake | 2 +- cmake/thirdparty/FindROCm.cmake | 2 +- cmake/thirdparty/SetupCUDA.cmake | 2 +- cmake/thirdparty/SetupHCC.cmake | 2 +- cmake/thirdparty/SetupHIP.cmake | 2 +- cmake/thirdparty/SetupMPI.cmake | 2 +- cmake/thirdparty/SetupOpenMP.cmake | 2 +- cmake/thirdparty/SetupThirdParty.cmake | 2 +- docs/CMakeLists.txt | 2 +- docs/api/code_check.rst | 2 +- docs/api/documentation.rst | 2 +- docs/api/git.rst | 2 +- docs/api/index.rst | 2 +- docs/api/target.rst | 2 +- docs/api/target_properties.rst | 2 +- docs/api/utility.rst | 2 +- docs/conf.py | 4 ++-- docs/index.rst | 2 +- docs/tutorial/creating_documentation.rst | 2 +- docs/tutorial/creating_execs_and_libs.rst | 2 +- docs/tutorial/exporting_blt_targets.rst | 2 +- docs/tutorial/external_dependencies.rst | 2 +- docs/tutorial/index.rst | 2 +- docs/tutorial/recommendations.rst | 2 +- docs/tutorial/setup_blt.rst | 2 +- docs/tutorial/unit_testing.rst | 2 +- docs/tutorial/using_flags.rst | 2 +- host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake | 2 +- .../clang@upstream_link_with_nvcc.cmake | 2 +- .../blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake | 2 +- .../clang@upstream_nvcc_c++17_no_separable.cmake | 2 +- .../llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake | 2 +- host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake | 2 +- host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake | 2 +- .../llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake | 2 +- host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake | 2 +- host-configs/llnl/toss_3_x86_64_ib/pgi@18.5.cmake | 2 +- host-configs/llnl/windows/sqa-uno-msvc@15.cmake | 2 +- host-configs/other/hcc.cmake | 2 +- host-configs/other/hip.cmake | 2 +- .../other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake | 2 +- tests/internal/CMakeLists.txt | 2 +- tests/internal/src/Example.cpp | 2 +- tests/internal/src/Example.hpp | 2 +- tests/internal/src/Example_Exports.h | 2 +- tests/internal/src/HeaderOnly.hpp | 2 +- tests/internal/src/combine_static_library_test/CMakeLists.txt | 2 +- tests/internal/src/combine_static_library_test/Foo1.cpp | 2 +- tests/internal/src/combine_static_library_test/Foo1.hpp | 2 +- tests/internal/src/combine_static_library_test/Foo2.cpp | 2 +- tests/internal/src/combine_static_library_test/Foo2.hpp | 2 +- tests/internal/src/combine_static_library_test/Foo3.cpp | 2 +- tests/internal/src/combine_static_library_test/Foo3.hpp | 2 +- .../blt_combine_static_libraries_shared_smoke.cpp | 2 +- .../blt_combine_static_libraries_static_smoke.cpp | 2 +- tests/internal/src/combine_static_library_test/main.cpp | 2 +- tests/internal/src/object_library_test/CMakeLists.txt | 2 +- tests/internal/src/object_library_test/base_object.cpp | 2 +- tests/internal/src/object_library_test/base_object.hpp | 2 +- .../src/object_library_test/inherited_base/CMakeLists.txt | 2 +- .../src/object_library_test/inherited_base/inherited_base.cpp | 2 +- .../src/object_library_test/inherited_base/inherited_base.hpp | 2 +- tests/internal/src/object_library_test/main.cpp | 2 +- tests/internal/src/object_library_test/object.cpp | 2 +- tests/internal/src/object_library_test/object.hpp | 2 +- tests/internal/src/static_analysis/CMakeLists.txt | 2 +- tests/internal/src/static_analysis/subtle_error_source.cpp | 2 +- tests/internal/src/static_analysis/well_analyzed_source.cpp | 2 +- tests/internal/src/t_example_compile_definitions.cpp | 2 +- tests/internal/src/t_example_smoke.cpp | 2 +- tests/internal/src/t_git_macros_smoke.cpp.in | 2 +- tests/internal/src/t_header_only_smoke.cpp | 2 +- tests/internal/src/test_cmake_format_conformant.cmake | 2 +- tests/internal/src/test_cmake_format_nonconformant.cmake | 2 +- .../src/test_cuda_device_call_from_kernel/CMakeLists.txt | 2 +- .../internal/src/test_cuda_device_call_from_kernel/Child.cpp | 2 +- .../internal/src/test_cuda_device_call_from_kernel/Child.hpp | 2 +- .../src/test_cuda_device_call_from_kernel/CudaTests.cpp | 2 +- .../internal/src/test_cuda_device_call_from_kernel/Parent.cpp | 2 +- .../internal/src/test_cuda_device_call_from_kernel/Parent.hpp | 2 +- tests/internal/src/test_cuda_mpi.cpp | 2 +- tests/smoke/CMakeLists.txt | 2 +- tests/smoke/blt_cuda_gtest_smoke.cpp | 2 +- tests/smoke/blt_cuda_mpi_smoke.cpp | 2 +- tests/smoke/blt_cuda_openmp_smoke.cpp | 2 +- tests/smoke/blt_cuda_runtime_smoke.cpp | 2 +- tests/smoke/blt_cuda_smoke.cpp | 2 +- tests/smoke/blt_fruit_mpi_smoke.f90 | 2 +- tests/smoke/blt_fruit_smoke.f90 | 2 +- tests/smoke/blt_gbenchmark_smoke.cpp | 2 +- tests/smoke/blt_gmock_smoke.cpp | 2 +- tests/smoke/blt_gtest_smoke.cpp | 2 +- tests/smoke/blt_hcc_runtime_smoke.cpp | 2 +- tests/smoke/blt_hcc_smoke.cpp | 2 +- tests/smoke/blt_hip_gtest_smoke.cpp | 2 +- tests/smoke/blt_hip_runtime_smoke.cpp | 2 +- tests/smoke/blt_hip_smoke.cpp | 2 +- tests/smoke/blt_mpi_smoke.cpp | 2 +- tests/smoke/blt_openmp_smoke.cpp | 2 +- tests/smoke/fortran_driver.cpp | 2 +- tests/smoke/fortran_mpi_driver.cpp | 2 +- thirdparty_builtin/CMakeLists.txt | 2 +- 117 files changed, 118 insertions(+), 118 deletions(-) diff --git a/LICENSE b/LICENSE index a7d513ff3..f08c6273a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC. +Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/SetupBLT.cmake b/SetupBLT.cmake index 255bb89b9..46707ad89 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d6ff65ae4..1914cf3e3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/BLTGitMacros.cmake b/cmake/BLTGitMacros.cmake index 051ef0888..014228d50 100644 --- a/cmake/BLTGitMacros.cmake +++ b/cmake/BLTGitMacros.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 08662a6ec..4c182270c 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index d03d90e7d..f400d5561 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index c262f00c4..58f60bf06 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index c188ca43e..012662c27 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/SetupCodeMetrics.cmake b/cmake/SetupCodeMetrics.cmake index 720136094..1dfef7274 100644 --- a/cmake/SetupCodeMetrics.cmake +++ b/cmake/SetupCodeMetrics.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/SetupCompilerOptions.cmake b/cmake/SetupCompilerOptions.cmake index 57bef7439..513bb4634 100644 --- a/cmake/SetupCompilerOptions.cmake +++ b/cmake/SetupCompilerOptions.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/SetupDocs.cmake b/cmake/SetupDocs.cmake index 6b99b0769..2cf26f3ea 100644 --- a/cmake/SetupDocs.cmake +++ b/cmake/SetupDocs.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/WrapAstyle.cmake.in b/cmake/WrapAstyle.cmake.in index 1e2ac8f3b..a4fd3c231 100644 --- a/cmake/WrapAstyle.cmake.in +++ b/cmake/WrapAstyle.cmake.in @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/clang-query-wrapper.py b/cmake/clang-query-wrapper.py index 005d4ef58..13aa13112 100644 --- a/cmake/clang-query-wrapper.py +++ b/cmake/clang-query-wrapper.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index 03bce824a..1c624d00c 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/FindHIP/run_hipcc.cmake b/cmake/thirdparty/FindHIP/run_hipcc.cmake index 5a862426e..7f0c02b5a 100644 --- a/cmake/thirdparty/FindHIP/run_hipcc.cmake +++ b/cmake/thirdparty/FindHIP/run_hipcc.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/FindHIP/run_make2cmake.cmake b/cmake/thirdparty/FindHIP/run_make2cmake.cmake index 22c9790e3..30bf5930a 100644 --- a/cmake/thirdparty/FindHIP/run_make2cmake.cmake +++ b/cmake/thirdparty/FindHIP/run_make2cmake.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/FindROCm.cmake b/cmake/thirdparty/FindROCm.cmake index 56b5deb9f..0b80fb841 100644 --- a/cmake/thirdparty/FindROCm.cmake +++ b/cmake/thirdparty/FindROCm.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index 292a6143b..b1346a44c 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupHCC.cmake b/cmake/thirdparty/SetupHCC.cmake index f82524d9a..48372b81e 100644 --- a/cmake/thirdparty/SetupHCC.cmake +++ b/cmake/thirdparty/SetupHCC.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index dbf5e53c3..408ae6a9f 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupMPI.cmake b/cmake/thirdparty/SetupMPI.cmake index 8e438d40a..12c32abfe 100644 --- a/cmake/thirdparty/SetupMPI.cmake +++ b/cmake/thirdparty/SetupMPI.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupOpenMP.cmake b/cmake/thirdparty/SetupOpenMP.cmake index ba02689c9..efd68c2a9 100644 --- a/cmake/thirdparty/SetupOpenMP.cmake +++ b/cmake/thirdparty/SetupOpenMP.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupThirdParty.cmake b/cmake/thirdparty/SetupThirdParty.cmake index 1c97ff86e..f632888ec 100644 --- a/cmake/thirdparty/SetupThirdParty.cmake +++ b/cmake/thirdparty/SetupThirdParty.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 2d70ebc48..7fb4e38c7 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index b4742aa85..a5b5e205b 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/documentation.rst b/docs/api/documentation.rst index f1b521cd9..2bea5c3b9 100644 --- a/docs/api/documentation.rst +++ b/docs/api/documentation.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/git.rst b/docs/api/git.rst index dade2986d..8fcb4c6d7 100644 --- a/docs/api/git.rst +++ b/docs/api/git.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/index.rst b/docs/api/index.rst index a599d0f87..7eba026d0 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/target.rst b/docs/api/target.rst index 155553e85..cba90146c 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index be34158f6..75803acfe 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/utility.rst b/docs/api/utility.rst index f9eb6e977..3ff692e8c 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/conf.py b/docs/conf.py index 1134ebf06..fafcd2467 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) @@ -47,7 +47,7 @@ # General information about the project. project = u'BLT: Build, Link, and Test' -copyright = u'2017-2019, BLT Development Team' +copyright = u'2017-2021, BLT Development Team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/docs/index.rst b/docs/index.rst index aad69cf40..70c420b5f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/creating_documentation.rst b/docs/tutorial/creating_documentation.rst index fa1068d7f..247ad1577 100644 --- a/docs/tutorial/creating_documentation.rst +++ b/docs/tutorial/creating_documentation.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index 6f02cfa39..61ae55026 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/exporting_blt_targets.rst b/docs/tutorial/exporting_blt_targets.rst index 90bcd849f..5478b2944 100644 --- a/docs/tutorial/exporting_blt_targets.rst +++ b/docs/tutorial/exporting_blt_targets.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 7c8c6ada9..ce7719201 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index e129d6423..33ad851a7 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/recommendations.rst b/docs/tutorial/recommendations.rst index 6f55becdf..5452e81d8 100644 --- a/docs/tutorial/recommendations.rst +++ b/docs/tutorial/recommendations.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index 645db8b2f..c4bf0a500 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/unit_testing.rst b/docs/tutorial/unit_testing.rst index 5a4d1a3b7..d6a58427b 100644 --- a/docs/tutorial/unit_testing.rst +++ b/docs/tutorial/unit_testing.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/using_flags.rst b/docs/tutorial/using_flags.rst index 787692603..ef62320a4 100644 --- a/docs/tutorial/using_flags.rst +++ b/docs/tutorial/using_flags.rst @@ -1,4 +1,4 @@ -.. # Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake b/host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake index 995ecbfb0..27634a054 100644 --- a/host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake +++ b/host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake index 13e109399..76cbaf74e 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake index 3acf91548..55167440b 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2020, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake index a4774cf7a..ade71e75b 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2020, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake index 478393d07..7d88d5db2 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake index 2179cdffb..79e879d56 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake b/host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake index e34094a6c..1e9b92ee1 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake b/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake index 7fa73fbed..34ad8a24e 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake index 061a12928..ce4605d6b 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/pgi@18.5.cmake b/host-configs/llnl/toss_3_x86_64_ib/pgi@18.5.cmake index 336c3c11d..9f96108b6 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/pgi@18.5.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/pgi@18.5.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/windows/sqa-uno-msvc@15.cmake b/host-configs/llnl/windows/sqa-uno-msvc@15.cmake index efbafd339..655281f85 100644 --- a/host-configs/llnl/windows/sqa-uno-msvc@15.cmake +++ b/host-configs/llnl/windows/sqa-uno-msvc@15.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/other/hcc.cmake b/host-configs/other/hcc.cmake index 429f4489b..19605e361 100644 --- a/host-configs/other/hcc.cmake +++ b/host-configs/other/hcc.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/other/hip.cmake b/host-configs/other/hip.cmake index 21d2537b5..f626b36e4 100644 --- a/host-configs/other/hip.cmake +++ b/host-configs/other/hip.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake b/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake index 0cb0a2623..0cd3b2693 100644 --- a/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake +++ b/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 28e6cc117..93c4f154f 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/Example.cpp b/tests/internal/src/Example.cpp index 0aa0b2070..da2da41a2 100644 --- a/tests/internal/src/Example.cpp +++ b/tests/internal/src/Example.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/Example.hpp b/tests/internal/src/Example.hpp index d39936e64..47e0620f6 100644 --- a/tests/internal/src/Example.hpp +++ b/tests/internal/src/Example.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/Example_Exports.h b/tests/internal/src/Example_Exports.h index 6c5c9413c..327aebc7b 100644 --- a/tests/internal/src/Example_Exports.h +++ b/tests/internal/src/Example_Exports.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/HeaderOnly.hpp b/tests/internal/src/HeaderOnly.hpp index 727d3be27..0ee71714c 100644 --- a/tests/internal/src/HeaderOnly.hpp +++ b/tests/internal/src/HeaderOnly.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/CMakeLists.txt b/tests/internal/src/combine_static_library_test/CMakeLists.txt index 8c097da3f..2ad633fca 100644 --- a/tests/internal/src/combine_static_library_test/CMakeLists.txt +++ b/tests/internal/src/combine_static_library_test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo1.cpp b/tests/internal/src/combine_static_library_test/Foo1.cpp index 22b5e4df9..3613a21f7 100644 --- a/tests/internal/src/combine_static_library_test/Foo1.cpp +++ b/tests/internal/src/combine_static_library_test/Foo1.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo1.hpp b/tests/internal/src/combine_static_library_test/Foo1.hpp index a6763fdbf..bae74edf7 100644 --- a/tests/internal/src/combine_static_library_test/Foo1.hpp +++ b/tests/internal/src/combine_static_library_test/Foo1.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo2.cpp b/tests/internal/src/combine_static_library_test/Foo2.cpp index 0075b7b67..fb1e339d6 100644 --- a/tests/internal/src/combine_static_library_test/Foo2.cpp +++ b/tests/internal/src/combine_static_library_test/Foo2.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo2.hpp b/tests/internal/src/combine_static_library_test/Foo2.hpp index d8a4b5199..094589a4e 100644 --- a/tests/internal/src/combine_static_library_test/Foo2.hpp +++ b/tests/internal/src/combine_static_library_test/Foo2.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo3.cpp b/tests/internal/src/combine_static_library_test/Foo3.cpp index b500b77da..4f95c4dad 100644 --- a/tests/internal/src/combine_static_library_test/Foo3.cpp +++ b/tests/internal/src/combine_static_library_test/Foo3.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo3.hpp b/tests/internal/src/combine_static_library_test/Foo3.hpp index e4aa72a43..67cfe2676 100644 --- a/tests/internal/src/combine_static_library_test/Foo3.hpp +++ b/tests/internal/src/combine_static_library_test/Foo3.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_shared_smoke.cpp b/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_shared_smoke.cpp index 01149851b..9c8858290 100644 --- a/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_shared_smoke.cpp +++ b/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_shared_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_static_smoke.cpp b/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_static_smoke.cpp index 01149851b..9c8858290 100644 --- a/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_static_smoke.cpp +++ b/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_static_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/main.cpp b/tests/internal/src/combine_static_library_test/main.cpp index 3f0b0ce35..911f2b639 100644 --- a/tests/internal/src/combine_static_library_test/main.cpp +++ b/tests/internal/src/combine_static_library_test/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/CMakeLists.txt b/tests/internal/src/object_library_test/CMakeLists.txt index f370b1e22..8089e1f1c 100644 --- a/tests/internal/src/object_library_test/CMakeLists.txt +++ b/tests/internal/src/object_library_test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/base_object.cpp b/tests/internal/src/object_library_test/base_object.cpp index 8db69bc10..cb232df26 100644 --- a/tests/internal/src/object_library_test/base_object.cpp +++ b/tests/internal/src/object_library_test/base_object.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/base_object.hpp b/tests/internal/src/object_library_test/base_object.hpp index 472df43e1..1988e20fe 100644 --- a/tests/internal/src/object_library_test/base_object.hpp +++ b/tests/internal/src/object_library_test/base_object.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/inherited_base/CMakeLists.txt b/tests/internal/src/object_library_test/inherited_base/CMakeLists.txt index c9add8f5b..7924031d7 100644 --- a/tests/internal/src/object_library_test/inherited_base/CMakeLists.txt +++ b/tests/internal/src/object_library_test/inherited_base/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/inherited_base/inherited_base.cpp b/tests/internal/src/object_library_test/inherited_base/inherited_base.cpp index cae6480fb..8cd7f85e2 100644 --- a/tests/internal/src/object_library_test/inherited_base/inherited_base.cpp +++ b/tests/internal/src/object_library_test/inherited_base/inherited_base.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/inherited_base/inherited_base.hpp b/tests/internal/src/object_library_test/inherited_base/inherited_base.hpp index 36f978ebd..f623548e4 100644 --- a/tests/internal/src/object_library_test/inherited_base/inherited_base.hpp +++ b/tests/internal/src/object_library_test/inherited_base/inherited_base.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/main.cpp b/tests/internal/src/object_library_test/main.cpp index dc0c31c65..9850db148 100644 --- a/tests/internal/src/object_library_test/main.cpp +++ b/tests/internal/src/object_library_test/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/object.cpp b/tests/internal/src/object_library_test/object.cpp index 0997719e8..aa32d50be 100644 --- a/tests/internal/src/object_library_test/object.cpp +++ b/tests/internal/src/object_library_test/object.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/object.hpp b/tests/internal/src/object_library_test/object.hpp index b8dcaf497..91d28bdc6 100644 --- a/tests/internal/src/object_library_test/object.hpp +++ b/tests/internal/src/object_library_test/object.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/static_analysis/CMakeLists.txt b/tests/internal/src/static_analysis/CMakeLists.txt index d9337fbb6..e1e100d79 100644 --- a/tests/internal/src/static_analysis/CMakeLists.txt +++ b/tests/internal/src/static_analysis/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/static_analysis/subtle_error_source.cpp b/tests/internal/src/static_analysis/subtle_error_source.cpp index 27a3a9851..582a29def 100644 --- a/tests/internal/src/static_analysis/subtle_error_source.cpp +++ b/tests/internal/src/static_analysis/subtle_error_source.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/static_analysis/well_analyzed_source.cpp b/tests/internal/src/static_analysis/well_analyzed_source.cpp index ab7f6edd0..9de872b0e 100644 --- a/tests/internal/src/static_analysis/well_analyzed_source.cpp +++ b/tests/internal/src/static_analysis/well_analyzed_source.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/t_example_compile_definitions.cpp b/tests/internal/src/t_example_compile_definitions.cpp index 3d0b185df..82a18ffde 100644 --- a/tests/internal/src/t_example_compile_definitions.cpp +++ b/tests/internal/src/t_example_compile_definitions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/t_example_smoke.cpp b/tests/internal/src/t_example_smoke.cpp index caa2d17d9..48cdc5aaf 100644 --- a/tests/internal/src/t_example_smoke.cpp +++ b/tests/internal/src/t_example_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/t_git_macros_smoke.cpp.in b/tests/internal/src/t_git_macros_smoke.cpp.in index 327c8141f..6b50487a4 100644 --- a/tests/internal/src/t_git_macros_smoke.cpp.in +++ b/tests/internal/src/t_git_macros_smoke.cpp.in @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/t_header_only_smoke.cpp b/tests/internal/src/t_header_only_smoke.cpp index 2aef8efc9..c7d01bb4c 100644 --- a/tests/internal/src/t_header_only_smoke.cpp +++ b/tests/internal/src/t_header_only_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cmake_format_conformant.cmake b/tests/internal/src/test_cmake_format_conformant.cmake index 9cba56c9f..1e94279ba 100644 --- a/tests/internal/src/test_cmake_format_conformant.cmake +++ b/tests/internal/src/test_cmake_format_conformant.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and other +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and other # BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cmake_format_nonconformant.cmake b/tests/internal/src/test_cmake_format_nonconformant.cmake index b36044366..37407d8dd 100644 --- a/tests/internal/src/test_cmake_format_nonconformant.cmake +++ b/tests/internal/src/test_cmake_format_nonconformant.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and other +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and other # BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/CMakeLists.txt b/tests/internal/src/test_cuda_device_call_from_kernel/CMakeLists.txt index 5e242f732..2de20fd8a 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/CMakeLists.txt +++ b/tests/internal/src/test_cuda_device_call_from_kernel/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp b/tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp index 03009801e..7664ae266 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp b/tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp index e148050bd..ba9dd5bfa 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/CudaTests.cpp b/tests/internal/src/test_cuda_device_call_from_kernel/CudaTests.cpp index 2ee6aa53d..5b5b69865 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/CudaTests.cpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/CudaTests.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp b/tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp index 0ca76ce8a..239a507dd 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp b/tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp index eb10ee708..7d7a79b11 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_mpi.cpp b/tests/internal/src/test_cuda_mpi.cpp index 975cc3439..37524518b 100644 --- a/tests/internal/src/test_cuda_mpi.cpp +++ b/tests/internal/src/test_cuda_mpi.cpp @@ -1,5 +1,5 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/CMakeLists.txt b/tests/smoke/CMakeLists.txt index ab73cef94..eab0eb153 100644 --- a/tests/smoke/CMakeLists.txt +++ b/tests/smoke/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_gtest_smoke.cpp b/tests/smoke/blt_cuda_gtest_smoke.cpp index 43404a2ea..7536f3324 100644 --- a/tests/smoke/blt_cuda_gtest_smoke.cpp +++ b/tests/smoke/blt_cuda_gtest_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_mpi_smoke.cpp b/tests/smoke/blt_cuda_mpi_smoke.cpp index d1f0ed0e4..b18a6867a 100644 --- a/tests/smoke/blt_cuda_mpi_smoke.cpp +++ b/tests/smoke/blt_cuda_mpi_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_openmp_smoke.cpp b/tests/smoke/blt_cuda_openmp_smoke.cpp index d1532cb5e..979462408 100644 --- a/tests/smoke/blt_cuda_openmp_smoke.cpp +++ b/tests/smoke/blt_cuda_openmp_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_runtime_smoke.cpp b/tests/smoke/blt_cuda_runtime_smoke.cpp index ccff05c56..154596852 100644 --- a/tests/smoke/blt_cuda_runtime_smoke.cpp +++ b/tests/smoke/blt_cuda_runtime_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_smoke.cpp b/tests/smoke/blt_cuda_smoke.cpp index a2c3d4e75..0bf7b3c2c 100644 --- a/tests/smoke/blt_cuda_smoke.cpp +++ b/tests/smoke/blt_cuda_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_fruit_mpi_smoke.f90 b/tests/smoke/blt_fruit_mpi_smoke.f90 index 654941c85..e61c842fd 100644 --- a/tests/smoke/blt_fruit_mpi_smoke.f90 +++ b/tests/smoke/blt_fruit_mpi_smoke.f90 @@ -1,4 +1,4 @@ -! Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +! Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and ! other BLT Project Developers. See the top-level COPYRIGHT file for details ! ! SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_fruit_smoke.f90 b/tests/smoke/blt_fruit_smoke.f90 index ad3b25c69..a7b342aa2 100644 --- a/tests/smoke/blt_fruit_smoke.f90 +++ b/tests/smoke/blt_fruit_smoke.f90 @@ -1,4 +1,4 @@ -! Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +! Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and ! other BLT Project Developers. See the top-level COPYRIGHT file for details ! ! SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_gbenchmark_smoke.cpp b/tests/smoke/blt_gbenchmark_smoke.cpp index 357d99654..1db7cb056 100644 --- a/tests/smoke/blt_gbenchmark_smoke.cpp +++ b/tests/smoke/blt_gbenchmark_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_gmock_smoke.cpp b/tests/smoke/blt_gmock_smoke.cpp index c7fbc1320..8d7d22ecb 100644 --- a/tests/smoke/blt_gmock_smoke.cpp +++ b/tests/smoke/blt_gmock_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_gtest_smoke.cpp b/tests/smoke/blt_gtest_smoke.cpp index 6047be56b..16f3afe6f 100644 --- a/tests/smoke/blt_gtest_smoke.cpp +++ b/tests/smoke/blt_gtest_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hcc_runtime_smoke.cpp b/tests/smoke/blt_hcc_runtime_smoke.cpp index b45a08f34..8c7113df0 100644 --- a/tests/smoke/blt_hcc_runtime_smoke.cpp +++ b/tests/smoke/blt_hcc_runtime_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hcc_smoke.cpp b/tests/smoke/blt_hcc_smoke.cpp index 48c2ceb08..fe21cf88a 100644 --- a/tests/smoke/blt_hcc_smoke.cpp +++ b/tests/smoke/blt_hcc_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hip_gtest_smoke.cpp b/tests/smoke/blt_hip_gtest_smoke.cpp index 3ca73838d..f9bf6a13d 100644 --- a/tests/smoke/blt_hip_gtest_smoke.cpp +++ b/tests/smoke/blt_hip_gtest_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hip_runtime_smoke.cpp b/tests/smoke/blt_hip_runtime_smoke.cpp index e908f1f0b..914fd51b9 100644 --- a/tests/smoke/blt_hip_runtime_smoke.cpp +++ b/tests/smoke/blt_hip_runtime_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hip_smoke.cpp b/tests/smoke/blt_hip_smoke.cpp index 702ff2b2d..5983485fc 100644 --- a/tests/smoke/blt_hip_smoke.cpp +++ b/tests/smoke/blt_hip_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_mpi_smoke.cpp b/tests/smoke/blt_mpi_smoke.cpp index 967ed1f88..cef0cd98c 100644 --- a/tests/smoke/blt_mpi_smoke.cpp +++ b/tests/smoke/blt_mpi_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_openmp_smoke.cpp b/tests/smoke/blt_openmp_smoke.cpp index 74a5f0d68..abd0fd8be 100644 --- a/tests/smoke/blt_openmp_smoke.cpp +++ b/tests/smoke/blt_openmp_smoke.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/fortran_driver.cpp b/tests/smoke/fortran_driver.cpp index 489009785..5f966ab0c 100644 --- a/tests/smoke/fortran_driver.cpp +++ b/tests/smoke/fortran_driver.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/fortran_mpi_driver.cpp b/tests/smoke/fortran_mpi_driver.cpp index ee47a84cf..cee1a8d41 100644 --- a/tests/smoke/fortran_mpi_driver.cpp +++ b/tests/smoke/fortran_mpi_driver.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and // other BLT Project Developers. See the top-level COPYRIGHT file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/thirdparty_builtin/CMakeLists.txt b/thirdparty_builtin/CMakeLists.txt index b58a9eb20..d8031dde9 100644 --- a/thirdparty_builtin/CMakeLists.txt +++ b/thirdparty_builtin/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and # other BLT Project Developers. See the top-level COPYRIGHT file for details # # SPDX-License-Identifier: (BSD-3-Clause) From edd91a054473db7eaacfb2755491ac7e1215ec2a Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 12 Jan 2021 07:07:08 -0600 Subject: [PATCH 194/330] feat: add logic to expand dependencies, use it to detect depends_on_hip --- cmake/BLTPrivateMacros.cmake | 73 ++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 15 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 58f60bf06..4869ceec3 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -272,6 +272,44 @@ macro(blt_inherit_target_info) endmacro(blt_inherit_target_info) +##------------------------------------------------------------------------------ +## blt_expand_depends( DEPENDS_ON [dep1 ...] +## RESULT [variable] ) +##------------------------------------------------------------------------------ +macro(blt_expand_depends) + set(options) + set(singleValueArgs RESULT) + set(multiValueArgs DEPENDS_ON) + + # Parse the arguments + cmake_parse_arguments(arg "${options}" "${singleValueArgs}" + "${multiValueArgs}" ${ARGN} ) + + # Expand dependency list + set(_already_proccessed_depends) + set(_expanded_DEPENDS_ON ${arg_DEPENDS_ON}) + foreach( i RANGE 50 ) + foreach( dependency ${_expanded_DEPENDS_ON} ) + # Avoid "visiting" the same dependency multiple times + if(NOT ${dependency} IN_LIST _already_proccessed_depends) + list(APPEND _already_proccessed_depends ${dependency}) + string(TOUPPER ${dependency} uppercase_dependency ) + + if ( DEFINED _BLT_${uppercase_dependency}_DEPENDS_ON ) + foreach(new_dependency ${_BLT_${uppercase_dependency}_DEPENDS_ON}) + if (NOT ${new_dependency} IN_LIST _expanded_DEPENDS_ON) + list(APPEND _expanded_DEPENDS_ON ${new_dependency}) + endif() + endforeach() + endif() + endif() + endforeach() + endforeach() + + # Write the output to the requested variable + set(${arg_RESULT} ${_expanded_DEPENDS_ON}) +endmacro() + ##------------------------------------------------------------------------------ ## blt_setup_target( NAME [name] @@ -302,21 +340,11 @@ macro(blt_setup_target) set(_public_scope INTERFACE) endif() - # Expand dependency list - set(_expanded_DEPENDS_ON ${arg_DEPENDS_ON}) - foreach( i RANGE 50 ) - foreach( dependency ${_expanded_DEPENDS_ON} ) - string(TOUPPER ${dependency} uppercase_dependency ) - - if ( DEFINED _BLT_${uppercase_dependency}_DEPENDS_ON ) - foreach(new_dependency ${_BLT_${uppercase_dependency}_DEPENDS_ON}) - if (NOT ${new_dependency} IN_LIST _expanded_DEPENDS_ON) - list(APPEND _expanded_DEPENDS_ON ${new_dependency}) - endif() - endforeach() - endif() - endforeach() - endforeach() + # Expand dependency list - avoid "recalculating" if the information already exists + get_target_property(_expanded_DEPENDS_ON ${arg_NAME} BLT_EXPANDED_DEPENDENCIES) + if(NOT _expanded_DEPENDS_ON) + blt_expand_depends(DEPENDS_ON ${arg_DEPENDS_ON} RESULT _expanded_DEPENDS_ON) + endif() # Add dependency's information foreach( dependency ${_expanded_DEPENDS_ON} ) @@ -522,6 +550,21 @@ macro(blt_add_hip_library) set(_depends_on_hip_runtime TRUE) endif() + blt_expand_depends(DEPENDS_ON ${arg_DEPENDS_ON} RESULT _expanded_DEPENDS_ON) + foreach( dependency ${_expanded_DEPENDS_ON} ) + if(TARGET ${dependency}) + get_target_property(_dep_type ${dependency} TYPE) + if(NOT "${_dep_type}" STREQUAL "INTERFACE_LIBRARY") + # Propagate the overridden linker language, if applicable + get_target_property(_blt_link_lang ${dependency} INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE) + # TODO: Do we need to worry about overwriting? Should only ever be HIP or CUDA + if(_blt_link_lang STREQUAL "HIP") + set(_depends_on_hip_runtime TRUE) + endif() + endif() + endif() + endforeach() + if (${_depends_on_hip}) # if hip is in depends_on, flag each file's language as HIP From 30a5cdc03ad1c91aee7954aad52cf364938caa7e Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 12 Jan 2021 05:14:59 -0800 Subject: [PATCH 195/330] fix: move new logic to hip_add_executable, save computed dependencies --- cmake/BLTPrivateMacros.cmake | 39 ++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 4869ceec3..2754026bd 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -341,7 +341,10 @@ macro(blt_setup_target) endif() # Expand dependency list - avoid "recalculating" if the information already exists - get_target_property(_expanded_DEPENDS_ON ${arg_NAME} BLT_EXPANDED_DEPENDENCIES) + set(_expanded_DEPENDS_ON) + if(NOT "${_target_type}" STREQUAL "INTERFACE_LIBRARY") + get_target_property(_expanded_DEPENDS_ON ${arg_NAME} BLT_EXPANDED_DEPENDENCIES) + endif() if(NOT _expanded_DEPENDS_ON) blt_expand_depends(DEPENDS_ON ${arg_DEPENDS_ON} RESULT _expanded_DEPENDS_ON) endif() @@ -550,22 +553,6 @@ macro(blt_add_hip_library) set(_depends_on_hip_runtime TRUE) endif() - blt_expand_depends(DEPENDS_ON ${arg_DEPENDS_ON} RESULT _expanded_DEPENDS_ON) - foreach( dependency ${_expanded_DEPENDS_ON} ) - if(TARGET ${dependency}) - get_target_property(_dep_type ${dependency} TYPE) - if(NOT "${_dep_type}" STREQUAL "INTERFACE_LIBRARY") - # Propagate the overridden linker language, if applicable - get_target_property(_blt_link_lang ${dependency} INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE) - # TODO: Do we need to worry about overwriting? Should only ever be HIP or CUDA - if(_blt_link_lang STREQUAL "HIP") - set(_depends_on_hip_runtime TRUE) - endif() - endif() - endif() - endforeach() - - if (${_depends_on_hip}) # if hip is in depends_on, flag each file's language as HIP # instead of leaving it up to CMake to decide @@ -633,6 +620,20 @@ macro(blt_add_hip_executable) set(_depends_on_hip_runtime TRUE) endif() + blt_expand_depends(DEPENDS_ON ${arg_DEPENDS_ON} RESULT _expanded_DEPENDS_ON) + foreach( dependency ${_expanded_DEPENDS_ON} ) + if(TARGET ${dependency}) + get_target_property(_dep_type ${dependency} TYPE) + if(NOT "${_dep_type}" STREQUAL "INTERFACE_LIBRARY") + # Propagate the overridden linker language, if applicable + get_target_property(_blt_link_lang ${dependency} INTERFACE_BLT_LINKER_LANGUAGE_OVERRIDE) + if(_blt_link_lang STREQUAL "HIP") + set(_depends_on_hip_runtime TRUE) + endif() + endif() + endif() + endforeach() + if (${_depends_on_hip} OR ${_depends_on_hip_runtime}) # if hip is in depends_on, flag each file's language as HIP # instead of leaving it up to CMake to decide @@ -652,6 +653,10 @@ macro(blt_add_hip_executable) add_executable( ${arg_NAME} ${arg_SOURCES} ${arg_HEADERS}) endif() + # Save the expanded dependencies to avoid recalculating later + set_target_properties(${arg_NAME} PROPERTIES + BLT_EXPANDED_DEPENDENCIES "${_expanded_DEPENDS_ON}") + endmacro(blt_add_hip_executable) ##------------------------------------------------------------------------------ From 8a525cb6391d756a2482561f6a90a359bf5af151 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 12 Jan 2021 08:38:12 -0800 Subject: [PATCH 196/330] refactor: remove hardcoded iteration count from dependency expansion --- cmake/BLTPrivateMacros.cmake | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 2754026bd..c181f1e30 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -286,25 +286,27 @@ macro(blt_expand_depends) "${multiValueArgs}" ${ARGN} ) # Expand dependency list - set(_already_proccessed_depends) + set(_deps_to_process ${arg_DEPENDS_ON}) set(_expanded_DEPENDS_ON ${arg_DEPENDS_ON}) - foreach( i RANGE 50 ) - foreach( dependency ${_expanded_DEPENDS_ON} ) - # Avoid "visiting" the same dependency multiple times - if(NOT ${dependency} IN_LIST _already_proccessed_depends) - list(APPEND _already_proccessed_depends ${dependency}) - string(TOUPPER ${dependency} uppercase_dependency ) - - if ( DEFINED _BLT_${uppercase_dependency}_DEPENDS_ON ) - foreach(new_dependency ${_BLT_${uppercase_dependency}_DEPENDS_ON}) - if (NOT ${new_dependency} IN_LIST _expanded_DEPENDS_ON) - list(APPEND _expanded_DEPENDS_ON ${new_dependency}) - endif() - endforeach() - endif() + while(_deps_to_process) + # Copy the current set of dependencies to process + set(_current_deps_to_process ${_deps_to_process}) + # and add them to the full expanded list + list(APPEND _expanded_DEPENDS_ON ${_deps_to_process}) + # Then clear it so we can check if new ones were added + set(_deps_to_process) + foreach( dependency ${_current_deps_to_process} ) + string(TOUPPER ${dependency} uppercase_dependency ) + if ( DEFINED _BLT_${uppercase_dependency}_DEPENDS_ON ) + foreach(new_dependency ${_BLT_${uppercase_dependency}_DEPENDS_ON}) + # Don't add duplicates + if (NOT ${new_dependency} IN_LIST _expanded_DEPENDS_ON) + list(APPEND _deps_to_process ${new_dependency}) + endif() + endforeach() endif() endforeach() - endforeach() + endwhile() # Write the output to the requested variable set(${arg_RESULT} ${_expanded_DEPENDS_ON}) From b7e2bdcae5bd9f8250d05581d57dcfdf608bacd0 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 13 Jan 2021 08:24:47 -0600 Subject: [PATCH 197/330] fix: don't duplicate dependencies --- cmake/BLTPrivateMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index c181f1e30..ccc48d20e 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -287,7 +287,7 @@ macro(blt_expand_depends) # Expand dependency list set(_deps_to_process ${arg_DEPENDS_ON}) - set(_expanded_DEPENDS_ON ${arg_DEPENDS_ON}) + set(_expanded_DEPENDS_ON) while(_deps_to_process) # Copy the current set of dependencies to process set(_current_deps_to_process ${_deps_to_process}) From 4b28b07f6a9ff66874577dda3a968b3a1dc62674 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 13 Jan 2021 14:30:29 -0600 Subject: [PATCH 198/330] refactor: replace BLT_CUDA_RESOLVE... -> CMAKE_CUDA_RESOLVE... --- RELEASE-NOTES.md | 4 ++-- cmake/BLTPrivateMacros.cmake | 8 +++++++- docs/tutorial/creating_execs_and_libs.rst | 8 ++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 1f4822d8d..80a3cbdfc 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -31,8 +31,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added an EXPORTABLE option to ``blt_import_library`` that allows imported libraries to be added to an export set and installed. - Added FRUIT's MPI parallel unit test reporting to BLT's internal copy of FRUIT -- CUDA device links for object libraries can be enabled with the ``CUDA_RESOLVE_DEVICE_SYMBOLS`` - target property or the global ``BLT_CUDA_RESOLVE_DEVICE_SYMBOLS`` option. +- CUDA device links for object libraries can be enabled with the existing ``CUDA_RESOLVE_DEVICE_SYMBOLS`` + target property. ### Changed - MPI Support when using CMake 3.13 and newer: MPI linker flags are now passed diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index b37a432fc..ba474a7ff 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -438,7 +438,7 @@ macro(blt_setup_target) # Check if a separate device link is needed if(ENABLE_CUDA AND "${_dep_type}" STREQUAL "OBJECT_LIBRARY") get_target_property(_device_link ${dependency} CUDA_RESOLVE_DEVICE_SYMBOLS) - if((_device_link OR BLT_CUDA_RESOLVE_DEVICE_SYMBOLS) AND CUDA_LINK_WITH_NVCC) + if(_device_link AND CUDA_LINK_WITH_NVCC) set(_dlink_obj "${dependency}_device_link${CMAKE_CUDA_OUTPUT_EXTENSION}") # Make sure a target wasn't already added get_source_file_property(_generated ${_dlink_obj} GENERATED) @@ -536,6 +536,12 @@ macro(blt_setup_cuda_target) CMAKE_CUDA_CREATE_STATIC_LIBRARY OFF) endif() endif() + + # Replicate the behavior of CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS + if(${CMAKE_VERSION} VERSION_LESS "3.16.0" AND CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS) + set_target_properties( ${arg_NAME} PROPERTIES + CUDA_RESOLVE_DEVICE_SYMBOLS ON) + endif() endif() endmacro(blt_setup_cuda_target) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index 647537104..04f5939c5 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -133,8 +133,12 @@ an object library: set_target_properties(myObjectLibrary PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON) -To enable this device linking step for all object libraries in your project, you -can set the ``BLT_CUDA_RESOLVE_DEVICE_SYMBOLS`` option to ``ON``. +To enable this device linking step for all libraries in your project (including object libraries), you +can set the ``CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS`` option to ``ON``. This defaults the +``CUDA_RESOLVE_DEVICE_SYMBOLS`` target property to ``ON`` for all targets created by BLT. + +You can read more about this property in the +`CMake documentation `_. .. note:: These options only apply when an object library in your project is linked later From 0361611f53f07b01098da8b48195e2cfb40abfce Mon Sep 17 00:00:00 2001 From: Josh Essman <68349992+joshessman-llnl@users.noreply.github.com> Date: Thu, 14 Jan 2021 16:27:15 -0600 Subject: [PATCH 199/330] cleanup: remove BLT_CUDA_RESOLVE_DEVICE_SYMBOLS option --- cmake/BLTOptions.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index 59e62b4cf..f400d5561 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -57,9 +57,6 @@ option(ENABLE_CLANG_CUDA "Enable Clang's native CUDA support" OFF) mark_as_advanced(ENABLE_CLANG_CUDA) set(BLT_CLANG_CUDA_ARCH "sm_30" CACHE STRING "Compute architecture to use when generating CUDA code with Clang") mark_as_advanced(BLT_CLANG_CUDA_ARCH) -cmake_dependent_option(BLT_CUDA_RESOLVE_DEVICE_SYMBOLS - "Add a manual CUDA device link step for all object libraries" OFF - "ENABLE_CUDA AND CUDA_LINK_WITH_NVCC" OFF) option(ENABLE_HIP "Enable HIP support" OFF) option(ENABLE_HCC "Enable HCC support" OFF) set(BLT_ROCM_ARCH "gfx900" CACHE STRING "gfx architecture to use when generating ROCm code") From f0bc1130370d6949354a115df55275ebc045baf7 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 26 Jan 2021 06:59:19 -0800 Subject: [PATCH 200/330] fix: added private macro to remove DEFINEs genexpr from HIP_HIPCC_FLAGS --- RELEASE-NOTES.md | 2 ++ cmake/BLTPrivateMacros.cmake | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 30ecfe7a1..cf2c92197 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -70,6 +70,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ is not changed back to Fortran. - Executables that link to libraries that depend on `hip`/`hip_runtime`/`cuda`/`cuda_runtime` will automatically be linked with the HIP or CUDA (NVCC) linker +- Patched an issue with the FindHIP macros that added the inclusive scan of specified + DEFINEs to compile commands ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index ccc48d20e..1ad484c48 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -517,6 +517,38 @@ macro(blt_setup_cuda_target) endif() endmacro(blt_setup_cuda_target) +##------------------------------------------------------------------------------ +## blt_cleanup_hip_globals(FROM_TARGET ) +## +## Needed as the SetupHIP macros (specifically, HIP_PREPARE_TARGET_COMMANDS) +## "pollutes" the global HIP_HIPCC_FLAGS with target-specific options. This +## macro removes the target-specific generator expressions from the global flags +## which have already been copied to source-file-specific instances of the +## run_hipcc script. Other global flags in HIP_HIPCC_FLAGS, e.g., those set by +## the user, are left untouched. +##------------------------------------------------------------------------------ +macro(blt_cleanup_hip_globals) + set(options) + set(singleValueArgs FROM_TARGET) + set(multiValueArgs) + + # Parse the arguments + cmake_parse_arguments(arg "${options}" "${singleValueArgs}" + "${multiValueArgs}" ${ARGN} ) + + # Check arguments + if ( NOT DEFINED arg_FROM_TARGET ) + message( FATAL_ERROR "Must provide a FROM_TARGET argument to the 'blt_cleanup_hip_globals' macro") + endif() + + # Remove the compile definitions generator expression + # This must be copied verbatim from HIP_PREPARE_TARGET_COMMANDS, + # which would have just added it to HIP_HIPCC_FLAGS + set(_defines_genexpr "$") + set(_defines_flags_genexpr "$<$:-D$>") + list(REMOVE_ITEM HIP_HIPCC_FLAGS ${_defines_flags_genexpr}) +endmacro(blt_cleanup_hip_globals) + ##------------------------------------------------------------------------------ ## blt_add_hip_library(NAME ## SOURCES [source1 [source2 ...]] @@ -570,6 +602,7 @@ macro(blt_add_hip_library) HIP_SOURCE_PROPERTY_FORMAT TRUE) hip_add_library( ${arg_NAME} ${arg_SOURCES} ${arg_LIBRARY_TYPE} ) + blt_cleanup_hip_globals(FROM_TARGET ${arg_NAME}) # Link to the hip_runtime target so it gets pulled in by targets # depending on this target target_link_libraries(${arg_NAME} PUBLIC hip_runtime) @@ -651,6 +684,7 @@ macro(blt_add_hip_executable) HIP_SOURCE_PROPERTY_FORMAT TRUE) hip_add_executable( ${arg_NAME} ${arg_SOURCES} ) + blt_cleanup_hip_globals(FROM_TARGET ${arg_NAME}) else() add_executable( ${arg_NAME} ${arg_SOURCES} ${arg_HEADERS}) endif() From beb5895f3f28893ddceba46621e7853b60c46b12 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Tue, 26 Jan 2021 07:30:20 -0800 Subject: [PATCH 201/330] tests: add new test for HIP defines fix: whitespace style --- tests/internal/CMakeLists.txt | 9 ++++++ .../src/hip_defines_test/CMakeLists.txt | 28 +++++++++++++++++++ tests/internal/src/hip_defines_test/bar.cpp | 13 +++++++++ tests/internal/src/hip_defines_test/foo.cpp | 13 +++++++++ 4 files changed, 63 insertions(+) create mode 100644 tests/internal/src/hip_defines_test/CMakeLists.txt create mode 100644 tests/internal/src/hip_defines_test/bar.cpp create mode 100644 tests/internal/src/hip_defines_test/foo.cpp diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 93c4f154f..27725c6fb 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -269,6 +269,10 @@ if(ENABLE_CLANGQUERY OR ENABLE_CLANGTIDY) add_subdirectory(src/static_analysis) endif() +if(ENABLE_HIP) + add_subdirectory(src/hip_defines_test) +endif() + #------------------------------------------------------------------------------ # Format the testing code using ClangFormat #------------------------------------------------------------------------------ @@ -278,6 +282,7 @@ if(CLANGFORMAT_FOUND) ../smoke/blt_cuda_mpi_smoke.cpp ../smoke/blt_cuda_openmp_smoke.cpp ../smoke/blt_cuda_runtime_smoke.cpp + ../smoke/blt_cuda_gtest_smoke.cpp ../smoke/blt_cuda_smoke.cpp ../smoke/blt_fruit_smoke.f90 ../smoke/blt_gbenchmark_smoke.cpp @@ -286,6 +291,7 @@ if(CLANGFORMAT_FOUND) ../smoke/blt_hcc_runtime_smoke.cpp ../smoke/blt_hcc_smoke.cpp ../smoke/blt_hip_runtime_smoke.cpp + ../smoke/blt_hip_gtest_smoke.cpp ../smoke/blt_hip_smoke.cpp ../smoke/blt_mpi_smoke.cpp ../smoke/blt_openmp_smoke.cpp @@ -330,6 +336,9 @@ if(CLANGFORMAT_FOUND) src/test_cuda_device_call_from_kernel/CudaTests.cpp src/test_cuda_device_call_from_kernel/Parent.cpp src/test_cuda_device_call_from_kernel/Parent.hpp + + src/hip_defines_test/foo.cpp + src/hip_defines_test/bar.cpp ) # Specify the major version for astyle diff --git a/tests/internal/src/hip_defines_test/CMakeLists.txt b/tests/internal/src/hip_defines_test/CMakeLists.txt new file mode 100644 index 000000000..ec1e621de --- /dev/null +++ b/tests/internal/src/hip_defines_test/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) + +############################################################################### +# +# Tests to make sure that definitions from one target do not propagate to another +# +############################################################################### + +blt_add_executable(NAME blt_hip_defines_test_foo + SOURCES foo.cpp + DEFINES FOO_ONLY + DEPENDS_ON hip) + +blt_add_executable(NAME blt_hip_defines_test_bar + SOURCES bar.cpp + DEFINES BAR_ONLY + DEPENDS_ON hip) + +blt_add_test( NAME blt_test_hip_defines_first + COMMAND blt_hip_defines_test_foo + ) + +blt_add_test( NAME blt_test_hip_defines_second + COMMAND blt_hip_defines_test_bar + ) diff --git a/tests/internal/src/hip_defines_test/bar.cpp b/tests/internal/src/hip_defines_test/bar.cpp new file mode 100644 index 000000000..95746f245 --- /dev/null +++ b/tests/internal/src/hip_defines_test/bar.cpp @@ -0,0 +1,13 @@ +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +// other BLT Project Developers. See the top-level COPYRIGHT file for details +// +// SPDX-License-Identifier: (BSD-3-Clause) + +int main() +{ + #if !defined(FOO_ONLY) && defined(BAR_ONLY) + return 0; + #else + return 1; + #endif +} diff --git a/tests/internal/src/hip_defines_test/foo.cpp b/tests/internal/src/hip_defines_test/foo.cpp new file mode 100644 index 000000000..9a8e0f55b --- /dev/null +++ b/tests/internal/src/hip_defines_test/foo.cpp @@ -0,0 +1,13 @@ +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +// other BLT Project Developers. See the top-level COPYRIGHT file for details +// +// SPDX-License-Identifier: (BSD-3-Clause) + +int main() +{ + #if defined(FOO_ONLY) && !defined(BAR_ONLY) + return 0; + #else + return 1; + #endif +} From b45095985590009b9dc74ce576eb8a17e66a9210 Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 1 Feb 2021 20:17:58 -0800 Subject: [PATCH 202/330] Add ctest to junit xsl and docs on how to use it --- docs/tutorial/unit_testing.rst | 26 ++++++++++++++ tests/ctest-to-junit.xsl | 62 ++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 tests/ctest-to-junit.xsl diff --git a/docs/tutorial/unit_testing.rst b/docs/tutorial/unit_testing.rst index d6a58427b..8eaec0d9b 100644 --- a/docs/tutorial/unit_testing.rst +++ b/docs/tutorial/unit_testing.rst @@ -249,3 +249,29 @@ are working, for example. -VV (Very verbose) Dump test output to stdout + +Converting CTest XML to JUnit +----------------------------- + +It is often useful to convert CTest's XML output to JUnit for various +reporting tools such as CI. This is a two step process. + +First run your test suite with one of the following commands to output with +CTest's XML and to turn off compressed output: + +.. code-block:: bash + + make CTEST_OUTPUT_ON_FAILURE=1 test ARGS="--no-compress-output -T Test -VV -j8" + ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 + +Then convert the CTest XML file to JUnit's format with the XSL file included +in BLT. This can be done in many ways, but most *nix machines come with +a program called ``xsltproc`` + + +.. code-block:: bash + + cd build-dir + xsltproc -o junit.xml path/to/blt/tests/ctest-to-junit.xsl Testing/*/Test.xml + +Then point the reporting tool to the outputted ``junit.xml`` file. diff --git a/tests/ctest-to-junit.xsl b/tests/ctest-to-junit.xsl new file mode 100644 index 000000000..aef7f11ec --- /dev/null +++ b/tests/ctest-to-junit.xsl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5a917577c99ebb7570bfb5aec7fa2fa104ce6f9a Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 1 Feb 2021 20:56:46 -0800 Subject: [PATCH 203/330] Fix xml format --- tests/ctest-to-junit.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ctest-to-junit.xsl b/tests/ctest-to-junit.xsl index aef7f11ec..b6a00b9ee 100644 --- a/tests/ctest-to-junit.xsl +++ b/tests/ctest-to-junit.xsl @@ -1,3 +1,4 @@ + - From 595a3462de3a993b14efbd809648ca123c806c5b Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Wed, 3 Feb 2021 09:59:27 -0800 Subject: [PATCH 204/330] Clarified comment in RELEASE-NOTES related to BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE variable --- RELEASE-NOTES.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index cf2c92197..9a800569b 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,14 +10,12 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd ## Added -- Added variable BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE to allow removing - implicit link directories added to CUDA executables by CMake. See the following example host-config: - host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake +- Added variable ``BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE`` for filtering + link directories implicitly added by CMake. See the following example host-config: + ``host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake`` - Added support for clang-tidy static analysis check - Added ability to change the output name of an executable via the OUTPUT_NAME parameter of blt_add_executable -- Added variable BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE that will be used to filter - implicit link directories for all languages - Added user option for enforcing specific versions of autoformatters - the new options are ``BLT_REQUIRED_ASTYLE_VERSION``, ``BLT_REQUIRED_CLANGFORMAT_VERSION``, and ``BLT_REQUIRED_UNCRUSTIFY_VERSION`` - Added ``HEADERS`` to ``blt_add_executable``. This is important for build system dependency tracking @@ -50,8 +48,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Turn off system includes for registered libraries when using the PGI compiler - Removed unneeded SYSTEM includes added by googletest that was causing problems in PGI builds (BLT was adding them already to the register library calls) -- Removed variable BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE, functionality now - provided for all languages using BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE variable +- Removed variable ``BLT_CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE``, functionality now + provided for all languages using ``BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE`` variable - ClangQuery was being auto-enabled in cases where no checker directories where defined. This caused a crash. blt_add_clang_query_target learned parameter CHECKER_DIRECTORIES and blt_add_code_checks learned parameter CLANGQUERY_CHECKER_DIRECTORIES. Both still From fefb67eef03bba1b94ee51d40acfb77b50318740 Mon Sep 17 00:00:00 2001 From: Keith Healy Date: Wed, 3 Feb 2021 15:18:18 -0800 Subject: [PATCH 205/330] Add new gitlab ci files --- .gitlab-ci.yml | 53 ++++++++++++++++++ gitlab/scripts/build_and_test.sh | 93 ++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100755 gitlab/scripts/build_and_test.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..e7facb847 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,53 @@ +# This file defines the CI for running on LLNL CZ and RZ machines. +# Currently only runs on Toss machines. BlueOS will be enabled next. + +before_script: + - echo "Before script section" + - python2 -V # Print out python version for debugging + - python3 -V # Print out python version for debugging + +after_script: + - echo "After script section" + +build_and_test_cz: + extends: + - .cz_job + - .build_and_test_script + +build_and_test_rz: + extends: + - .rz_job + - .build_and_test_script + +# Templates +.build_and_test_script: + stage: build + script: +# Build and test blt + - gitlab/scripts/build_and_test.sh > buildandtest.txt + - gitlab/scripts/convertToJunit.sh > converttests.txt + artifacts: + paths: + - buildandtest.txt + - converttests.txt + - ./Artifacts/*.* + reports: + junit: + - ./testresults.xml + +.cz_job: + variables: + LLNL_SLURM_SCHEDULER_PARAMETERS: "--nodes=1 -p pdebug" + tags: + - quartz + - shell + rules: + - if: '$LC_ZONE == "CZ"' # run only if ... + +.rz_job: + tags: + - rzgenie + - shell + rules: + - if: '$LC_ZONE == "RZ"' # run only if ... + diff --git a/gitlab/scripts/build_and_test.sh b/gitlab/scripts/build_and_test.sh new file mode 100755 index 000000000..e67674db1 --- /dev/null +++ b/gitlab/scripts/build_and_test.sh @@ -0,0 +1,93 @@ +#!/bin/bash +set -x +rm -rf build_* +rm -rf install_* + +BBD=`pwd` +suffix=".cmake" +module="" +host="" +alloc="" +display="true" + +# Iterate through host-configs: ./host-configs/llnl/SYS_TYPE/.cmake +for path in ./host-configs/llnl/*; do + + [ -d "${path}" ] || continue # if not a directory, skip + sys="$(basename "${path}")" + # echo -e "--\nSys: $sys" + + if [[ "$sys" == "toss_3_x86_64_ib" ]]; then + + if [[ "$LC_ZONE" == "CZ" ]]; then + host=quartz + elif [[ "$LC_ZONE" == "RZ" ]]; then + host=rzgenie + else + echo "LC Zone not recognized" + continue + fi + alloc="salloc -N1 --exclusive -p pdebug --mpibind=off" + elif [[ "$sys" == "blueos_3_ppc64le_ib" ]]; then + alloc="lalloc 1 -W 60 -G guests" + display="setenv DISPLAY ':0.0'" + if [[ "$LC_ZONE" == "CZ" ]]; then + host=ray + elif [[ "$LC_ZONE" == "RZ" ]]; then + host=rzmanta + else + echo "LC Zone not recognized" + continue + fi + elif [[ "$sys" == "blueos_3_ppc64le_ib_p9" ]]; then + alloc="lalloc 1 -W 60 -G guests" + display="setenv DISPLAY ':0.0'" + if [[ "$LC_ZONE" == "CZ" ]]; then + host=lassen + elif [[ "$LC_ZONE" == "RZ" ]]; then + host=rzansel + else + echo "LC Zone not recognized" + continue + fi + else + echo "OS not recognized" + continue + fi + + echo "[Testing host-configs for $sys]" + + for file in ./host-configs/llnl/$sys/*; do + hc_path="$BBD/$file" + # echo " File: $hc_path" + [ -f "${hc_path}" ] || continue # if not a file, skip + + hc="$(basename "${file}")" + compiler=${hc%$suffix} + module="module load cmake/3.9.2" + # override module for CUDA C++17 support + if [[ $hc =~ "nvcc_c++17" ]]; + then + module="module load cmake/3.18.0 cuda/11.0.2" + fi + + echo "[Testing $compiler on $sys with $host]" + echo "[host-config = $hc]" + echo "[Module = $module]" + echo "[Path = $path]" + echo "[alloc = $alloc]" + + mkdir build_$compiler + mkdir install_$compiler + cd build_$compiler + CUR_DIR=`pwd` + + ssh $host "cd $CUR_DIR && $module && $display && \ + $alloc cmake -C $hc_path -D CMAKE_INSTALL_PREFIX=../install_$compiler ../tests/internal && \ + $alloc make && \ + $alloc ctest" + + cd $BBD + echo "--" + done +done From 8a266c4d1a8a7f9d47256025582a4c3c570cad0d Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 15:24:16 -0800 Subject: [PATCH 206/330] update mailmap --- .mailmap | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.mailmap b/.mailmap index bf5068254..781ba0da1 100644 --- a/.mailmap +++ b/.mailmap @@ -2,11 +2,19 @@ Alfredo Metere Alfredo Metere metere1llnl <51676123+metere1llnl@users.noreply.github.com> Benjamin Curtice Corbett Ben Corbett <32752943+corbett5@users.noreply.github.com> Burl M. Hall BurlMHall <47543546+BurlMHall@users.noreply.github.com> +Daniel Taller Danny Taller <66029857+dtaller@users.noreply.github.com> +Geoffrey Oxberry Geoffrey M Oxberry +Geoffrey Oxberry Geoffrey M. Oxberry George Zagaris George Zagaris Jason Burmark Jason Burmark +Josh Essman Josh Essman <68349992+joshessman-llnl@users.noreply.github.com> +Keith Healy keithhealy <50376825+keithhealy@users.noreply.github.com> Kenneth Weiss Kenny Weiss Kenneth Weiss Kenny Weiss Kenneth Weiss Kenneth Weiss +Kristi Belcher Kristi Belcher +Kristi Belcher Kristi Belcher +Kristi Belcher Kristi Marty McFadden Marty McFadden Peter B. Robinson robinson96 Peter B. Robinson robinspb From 11ad581a87bb9856e2865cf01b6b2cb0ad5d7442 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 18:16:52 -0800 Subject: [PATCH 207/330] Convert to JUnit output --- .gitlab-ci.yml | 5 +---- gitlab/scripts/build_and_test.sh | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7facb847..3be3a46a1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,15 +25,12 @@ build_and_test_rz: script: # Build and test blt - gitlab/scripts/build_and_test.sh > buildandtest.txt - - gitlab/scripts/convertToJunit.sh > converttests.txt artifacts: paths: - buildandtest.txt - - converttests.txt - - ./Artifacts/*.* reports: junit: - - ./testresults.xml + - build_*/junit.xml .cz_job: variables: diff --git a/gitlab/scripts/build_and_test.sh b/gitlab/scripts/build_and_test.sh index e67674db1..e11c28e8b 100755 --- a/gitlab/scripts/build_and_test.sh +++ b/gitlab/scripts/build_and_test.sh @@ -85,7 +85,8 @@ for path in ./host-configs/llnl/*; do ssh $host "cd $CUR_DIR && $module && $display && \ $alloc cmake -C $hc_path -D CMAKE_INSTALL_PREFIX=../install_$compiler ../tests/internal && \ $alloc make && \ - $alloc ctest" + $alloc ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 && \ + xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" cd $BBD echo "--" From f3f30df37210e3a9be87a6386d4e515e37797d0a Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 18:40:18 -0800 Subject: [PATCH 208/330] remove rz logic --- .gitlab-ci.yml | 13 ------------- gitlab/scripts/build_and_test.sh | 17 +++++------------ 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3be3a46a1..0fd15f5e1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,11 +14,6 @@ build_and_test_cz: - .cz_job - .build_and_test_script -build_and_test_rz: - extends: - - .rz_job - - .build_and_test_script - # Templates .build_and_test_script: stage: build @@ -40,11 +35,3 @@ build_and_test_rz: - shell rules: - if: '$LC_ZONE == "CZ"' # run only if ... - -.rz_job: - tags: - - rzgenie - - shell - rules: - - if: '$LC_ZONE == "RZ"' # run only if ... - diff --git a/gitlab/scripts/build_and_test.sh b/gitlab/scripts/build_and_test.sh index e11c28e8b..256e5c2c2 100755 --- a/gitlab/scripts/build_and_test.sh +++ b/gitlab/scripts/build_and_test.sh @@ -18,41 +18,34 @@ for path in ./host-configs/llnl/*; do # echo -e "--\nSys: $sys" if [[ "$sys" == "toss_3_x86_64_ib" ]]; then - + alloc="salloc -N1 --exclusive -p pdebug --mpibind=off" if [[ "$LC_ZONE" == "CZ" ]]; then host=quartz - elif [[ "$LC_ZONE" == "RZ" ]]; then - host=rzgenie else echo "LC Zone not recognized" - continue + exit 5 fi - alloc="salloc -N1 --exclusive -p pdebug --mpibind=off" elif [[ "$sys" == "blueos_3_ppc64le_ib" ]]; then alloc="lalloc 1 -W 60 -G guests" display="setenv DISPLAY ':0.0'" if [[ "$LC_ZONE" == "CZ" ]]; then host=ray - elif [[ "$LC_ZONE" == "RZ" ]]; then - host=rzmanta else echo "LC Zone not recognized" - continue + exit 5 fi elif [[ "$sys" == "blueos_3_ppc64le_ib_p9" ]]; then alloc="lalloc 1 -W 60 -G guests" display="setenv DISPLAY ':0.0'" if [[ "$LC_ZONE" == "CZ" ]]; then host=lassen - elif [[ "$LC_ZONE" == "RZ" ]]; then - host=rzansel else echo "LC Zone not recognized" - continue + exit 5 fi else echo "OS not recognized" - continue + exit 6 fi echo "[Testing host-configs for $sys]" From c9a9463e47b4d95ec6646f6fdd17a45098616d8e Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 19:06:44 -0800 Subject: [PATCH 209/330] Skip windows --- gitlab/scripts/build_and_test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gitlab/scripts/build_and_test.sh b/gitlab/scripts/build_and_test.sh index 256e5c2c2..9414c33ec 100755 --- a/gitlab/scripts/build_and_test.sh +++ b/gitlab/scripts/build_and_test.sh @@ -43,8 +43,11 @@ for path in ./host-configs/llnl/*; do echo "LC Zone not recognized" exit 5 fi + elif [[ "$sys" == "windows" ]]; then + echo "Skipping windows" + continue else - echo "OS not recognized" + echo "OS not supported for this CI" exit 6 fi From 6c69812b55cd5d08415ec48535dc809980976e51 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 21:54:43 -0800 Subject: [PATCH 210/330] Split jobs into individual jobs and runners --- .gitlab-ci.yml | 79 ++++++++++++++++++++++++++--------------- gitlab/build_lassen.yml | 56 +++++++++++++++++++++++++++++ gitlab/build_quartz.yml | 67 ++++++++++++++++++++++++++++++++++ 3 files changed, 173 insertions(+), 29 deletions(-) create mode 100644 gitlab/build_lassen.yml create mode 100644 gitlab/build_quartz.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0fd15f5e1..ae13a2d2a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,37 +1,58 @@ -# This file defines the CI for running on LLNL CZ and RZ machines. -# Currently only runs on Toss machines. BlueOS will be enabled next. +############################################################################## +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and BLT +# project contributors. See the LICENSE file for details. +############################################################################## -before_script: - - echo "Before script section" - - python2 -V # Print out python version for debugging - - python3 -V # Print out python version for debugging +variables: + PROJECT_ALLOC_NAME: ${CI_PROJECT_NAME}_ci_${CI_PIPELINE_ID} + BUILD_ROOT: ${CI_PROJECT_DIR} -after_script: - - echo "After script section" +stages: + - l_build + - q_allocate_resources + - q_build + - q_release_resources -build_and_test_cz: - extends: - - .cz_job - - .build_and_test_script +#### +# Template +.srun_build_script: + script: + #Use pre-existing allocation if any + - JOBID=$(squeue -h --name=${PROJECT_ALLOC_NAME} --format=%A) + - ASSIGN_ID=$(if [[ -n "${JOBID}" ]]; then echo "--jobid=${JOBID}"; fi) + - EXEC_PREFIX="srun -p pdebug ${ASSIGN_ID} -t 10 -N 1" + #BUILD + TEST + - echo -e "section_start:$(date +%s):build_and_test\r\e[0K + Build and test ${CI_PROJECT_NAME}" + - mkdir ${BUILD_DIR} && cd ${BUILD_DIR} + - ${EXEC_PREFIX} cmake -C ${HOST_CONFIG} ../tests/internal + - ${EXEC_PREFIX} make -j8 + - ${EXEC_PREFIX} ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 + - xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" + - echo -e "section_end:$(date +%s):build_and_test\r\e[0K" + artifacts: + reports: + junit: */junit.xml -# Templates -.build_and_test_script: - stage: build + +.build_blueos_3_ppc64le_ib_p9_script: script: -# Build and test blt - - gitlab/scripts/build_and_test.sh > buildandtest.txt + - EXEC_PREFIX="lalloc 1 -W 10 -q pdebug" + #BUILD + TEST + - echo -e "section_start:$(date +%s):build_and_test\r\e[0K + Build and test ${CI_PROJECT_NAME}" + - mkdir ${BUILD_DIR} && cd ${BUILD_DIR} + - ${EXEC_PREFIX} cmake -C ${HOST_CONFIG} ../tests/internal + - ${EXEC_PREFIX} make -j8 + - ${EXEC_PREFIX} ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 + - xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" + - echo -e "section_end:$(date +%s):build_and_test\r\e[0K" artifacts: - paths: - - buildandtest.txt reports: - junit: - - build_*/junit.xml + junit: */junit.xml + -.cz_job: - variables: - LLNL_SLURM_SCHEDULER_PARAMETERS: "--nodes=1 -p pdebug" - tags: - - quartz - - shell - rules: - - if: '$LC_ZONE == "CZ"' # run only if ... +# This is where jobs are included +include: + - local: .gitlab/build_quartz.yml + - local: .gitlab/build_lassen.yml diff --git a/gitlab/build_lassen.yml b/gitlab/build_lassen.yml new file mode 100644 index 000000000..7e5cbbf65 --- /dev/null +++ b/gitlab/build_lassen.yml @@ -0,0 +1,56 @@ +#### +# This is the share configuration of jobs for lassen +.on_lassen: + variables: + tags: + - shell + - lassen + rules: + - if: '$CI_COMMIT_BRANCH =~ /_lnone/ || $ON_LASSEN == "OFF"' #run except if ... + when: never + - when: on_success + +#### +# Load required CUDA module +.with_cuda: + before_script: + - module load cuda/11.1.1 + +#### +# Template +.build_on_lassen: + stage: l_build + extends: [.build_blueos_3_ppc64le_ib_p9_script, .on_lassen] + needs: [] + +#### +# Build jobs +clang_upstream_link_with_nvcc (lassen): + variables: + BUILD_DIR: "build_clang_upstream_link_with_nvcc" + HOST_CONFIG: "clang@upstream_link_with_nvcc.cmake" + extends: [.build_on_lassen, .with_cuda] + +clang_upstream_nvcc_c++17 (lassen): + variables: + BUILD_DIR: "build_clang_upstream_nvcc_c++17" + HOST_CONFIG: "clang@upstream_nvcc_c++17.cmake" + extends: [.build_on_lassen, .with_cuda] + +clang_upstream_nvcc_c++17_no_separable (lassen): + variables: + BUILD_DIR: "build_clang_upstream_nvcc_c++17_no_separable" + HOST_CONFIG: "clang@upstream_nvcc_c++17_no_separable.cmake" + extends: [.build_on_lassen, .with_cuda] + +clang_upstream_nvcc_xlf (lassen): + variables: + BUILD_DIR: "build_clang_upstream_nvcc_xlf" + HOST_CONFIG: "clang@upstream_nvcc_xlf.cmake" + extends: [.build_on_lassen, .with_cuda] + +pgi_20.4_nvcc (lassen): + variables: + BUILD_DIR: "build_clang_upstream_link_with_nvcc" + HOST_CONFIG: "pgi@20.4_nvcc.cmake" + extends: [.build_on_lassen, .with_cuda] diff --git a/gitlab/build_quartz.yml b/gitlab/build_quartz.yml new file mode 100644 index 000000000..7a007d90e --- /dev/null +++ b/gitlab/build_quartz.yml @@ -0,0 +1,67 @@ +#### +# This is the share configuration of jobs for quartz +.on_quartz: + tags: + - shell + - quartz + rules: + - if: '$CI_COMMIT_BRANCH =~ /_qnone/ || $ON_QUARTZ == "OFF"' #run except if ... + when: never + - if: '$CI_JOB_NAME =~ /release_resources/' + when: always + - when: on_success + +#### +# In pre-build phase, allocate a node for builds +allocate_resources_build_quartz: + variables: + GIT_STRATEGY: none + extends: [.on_quartz] + stage: q_allocate_resources + script: + - salloc -p pdebug -N 1 -c 36 -t 30 --no-shell --job-name=${PROJECT_ALLOC_NAME} + needs: [] + +#### +# In post-build phase, deallocate resources +# Note : make sure this is run even on build phase failure +release_resources_build_quartz: + variables: + GIT_STRATEGY: none + extends: [.on_quartz] + stage: q_release_resources + script: + - export JOBID=$(squeue -h --name=${PROJECT_ALLOC_NAME} --format=%A) + - if [[ -n "${JOBID}" ]]; then scancel ${JOBID}; fi + +#### +# Template +.build_on_quartz: + stage: q_build + extends: [.srun_build_script, .on_quartz] + +#### +# Build jobs +clang_4_0_0_libcxx (quartz): + variables: + BUILD_DIR: "build_clang_4_0_0_libcxx" + HOST_CONFIG: "clang@4.0.0-libcxx.cmake" + extends: [.build_on_quartz] + +clang_6_0_0_static_analysis (quartz): + variables: + BUILD_DIR: "build_clang_6_0_0_static_analysis" + HOST_CONFIG: "clang@6.0.0-static-analysis.cmake" + extends: [.build_on_quartz] + +gcc_4_9_3 (quartz): + variables: + BUILD_DIR: "build_gcc_4_9_3" + HOST_CONFIG: "gcc@4.9.3.cmake" + extends: [.build_on_quartz] + +pgi_18_5 (quartz): + variables: + BUILD_DIR: "build_pgi_18_5" + HOST_CONFIG: "pgi@18.5.cmake" + extends: [.build_on_quartz] From 6fd68697576089ddbf6eecc2bc54bcad8e6586e5 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 21:55:18 -0800 Subject: [PATCH 211/330] Remove no longer needed script --- gitlab/scripts/build_and_test.sh | 90 -------------------------------- 1 file changed, 90 deletions(-) delete mode 100755 gitlab/scripts/build_and_test.sh diff --git a/gitlab/scripts/build_and_test.sh b/gitlab/scripts/build_and_test.sh deleted file mode 100755 index 9414c33ec..000000000 --- a/gitlab/scripts/build_and_test.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -set -x -rm -rf build_* -rm -rf install_* - -BBD=`pwd` -suffix=".cmake" -module="" -host="" -alloc="" -display="true" - -# Iterate through host-configs: ./host-configs/llnl/SYS_TYPE/.cmake -for path in ./host-configs/llnl/*; do - - [ -d "${path}" ] || continue # if not a directory, skip - sys="$(basename "${path}")" - # echo -e "--\nSys: $sys" - - if [[ "$sys" == "toss_3_x86_64_ib" ]]; then - alloc="salloc -N1 --exclusive -p pdebug --mpibind=off" - if [[ "$LC_ZONE" == "CZ" ]]; then - host=quartz - else - echo "LC Zone not recognized" - exit 5 - fi - elif [[ "$sys" == "blueos_3_ppc64le_ib" ]]; then - alloc="lalloc 1 -W 60 -G guests" - display="setenv DISPLAY ':0.0'" - if [[ "$LC_ZONE" == "CZ" ]]; then - host=ray - else - echo "LC Zone not recognized" - exit 5 - fi - elif [[ "$sys" == "blueos_3_ppc64le_ib_p9" ]]; then - alloc="lalloc 1 -W 60 -G guests" - display="setenv DISPLAY ':0.0'" - if [[ "$LC_ZONE" == "CZ" ]]; then - host=lassen - else - echo "LC Zone not recognized" - exit 5 - fi - elif [[ "$sys" == "windows" ]]; then - echo "Skipping windows" - continue - else - echo "OS not supported for this CI" - exit 6 - fi - - echo "[Testing host-configs for $sys]" - - for file in ./host-configs/llnl/$sys/*; do - hc_path="$BBD/$file" - # echo " File: $hc_path" - [ -f "${hc_path}" ] || continue # if not a file, skip - - hc="$(basename "${file}")" - compiler=${hc%$suffix} - module="module load cmake/3.9.2" - # override module for CUDA C++17 support - if [[ $hc =~ "nvcc_c++17" ]]; - then - module="module load cmake/3.18.0 cuda/11.0.2" - fi - - echo "[Testing $compiler on $sys with $host]" - echo "[host-config = $hc]" - echo "[Module = $module]" - echo "[Path = $path]" - echo "[alloc = $alloc]" - - mkdir build_$compiler - mkdir install_$compiler - cd build_$compiler - CUR_DIR=`pwd` - - ssh $host "cd $CUR_DIR && $module && $display && \ - $alloc cmake -C $hc_path -D CMAKE_INSTALL_PREFIX=../install_$compiler ../tests/internal && \ - $alloc make && \ - $alloc ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 && \ - xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" - - cd $BBD - echo "--" - done -done From 82827dfba33050932b6dcb5940a9e0e82a53da01 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 22:22:00 -0800 Subject: [PATCH 212/330] Move build commands into script --- .gitlab-ci.yml | 16 ++++------------ gitlab/build_and_test.sh | 12 ++++++++++++ gitlab/build_lassen.yml | 5 ----- gitlab/build_quartz.yml | 4 ---- 4 files changed, 16 insertions(+), 21 deletions(-) create mode 100644 gitlab/build_and_test.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae13a2d2a..68fc168ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,15 +24,11 @@ stages: #BUILD + TEST - echo -e "section_start:$(date +%s):build_and_test\r\e[0K Build and test ${CI_PROJECT_NAME}" - - mkdir ${BUILD_DIR} && cd ${BUILD_DIR} - - ${EXEC_PREFIX} cmake -C ${HOST_CONFIG} ../tests/internal - - ${EXEC_PREFIX} make -j8 - - ${EXEC_PREFIX} ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 - - xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" + - ${EXEC_PREFIX} gitlab/build_and_test.sh - echo -e "section_end:$(date +%s):build_and_test\r\e[0K" artifacts: reports: - junit: */junit.xml + junit: build/junit.xml .build_blueos_3_ppc64le_ib_p9_script: @@ -41,15 +37,11 @@ stages: #BUILD + TEST - echo -e "section_start:$(date +%s):build_and_test\r\e[0K Build and test ${CI_PROJECT_NAME}" - - mkdir ${BUILD_DIR} && cd ${BUILD_DIR} - - ${EXEC_PREFIX} cmake -C ${HOST_CONFIG} ../tests/internal - - ${EXEC_PREFIX} make -j8 - - ${EXEC_PREFIX} ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 - - xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" + - ${EXEC_PREFIX} gitlab/build_and_test.sh - echo -e "section_end:$(date +%s):build_and_test\r\e[0K" artifacts: reports: - junit: */junit.xml + junit: build/junit.xml # This is where jobs are included diff --git a/gitlab/build_and_test.sh b/gitlab/build_and_test.sh new file mode 100644 index 000000000..b1d866b97 --- /dev/null +++ b/gitlab/build_and_test.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +rm -rf build +mkdir build +cd build + +cmake -C $HOST_CONFIG ../tests/internal +make -j8 +ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 +xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" diff --git a/gitlab/build_lassen.yml b/gitlab/build_lassen.yml index 7e5cbbf65..8fce51c47 100644 --- a/gitlab/build_lassen.yml +++ b/gitlab/build_lassen.yml @@ -27,30 +27,25 @@ # Build jobs clang_upstream_link_with_nvcc (lassen): variables: - BUILD_DIR: "build_clang_upstream_link_with_nvcc" HOST_CONFIG: "clang@upstream_link_with_nvcc.cmake" extends: [.build_on_lassen, .with_cuda] clang_upstream_nvcc_c++17 (lassen): variables: - BUILD_DIR: "build_clang_upstream_nvcc_c++17" HOST_CONFIG: "clang@upstream_nvcc_c++17.cmake" extends: [.build_on_lassen, .with_cuda] clang_upstream_nvcc_c++17_no_separable (lassen): variables: - BUILD_DIR: "build_clang_upstream_nvcc_c++17_no_separable" HOST_CONFIG: "clang@upstream_nvcc_c++17_no_separable.cmake" extends: [.build_on_lassen, .with_cuda] clang_upstream_nvcc_xlf (lassen): variables: - BUILD_DIR: "build_clang_upstream_nvcc_xlf" HOST_CONFIG: "clang@upstream_nvcc_xlf.cmake" extends: [.build_on_lassen, .with_cuda] pgi_20.4_nvcc (lassen): variables: - BUILD_DIR: "build_clang_upstream_link_with_nvcc" HOST_CONFIG: "pgi@20.4_nvcc.cmake" extends: [.build_on_lassen, .with_cuda] diff --git a/gitlab/build_quartz.yml b/gitlab/build_quartz.yml index 7a007d90e..45f5ad4f6 100644 --- a/gitlab/build_quartz.yml +++ b/gitlab/build_quartz.yml @@ -44,24 +44,20 @@ release_resources_build_quartz: # Build jobs clang_4_0_0_libcxx (quartz): variables: - BUILD_DIR: "build_clang_4_0_0_libcxx" HOST_CONFIG: "clang@4.0.0-libcxx.cmake" extends: [.build_on_quartz] clang_6_0_0_static_analysis (quartz): variables: - BUILD_DIR: "build_clang_6_0_0_static_analysis" HOST_CONFIG: "clang@6.0.0-static-analysis.cmake" extends: [.build_on_quartz] gcc_4_9_3 (quartz): variables: - BUILD_DIR: "build_gcc_4_9_3" HOST_CONFIG: "gcc@4.9.3.cmake" extends: [.build_on_quartz] pgi_18_5 (quartz): variables: - BUILD_DIR: "build_pgi_18_5" HOST_CONFIG: "pgi@18.5.cmake" extends: [.build_on_quartz] From f1fa7db7bce9a6ceacf3798d86323376f9654790 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 23:13:34 -0800 Subject: [PATCH 213/330] fix dir name --- {gitlab => .gitlab}/build_and_test.sh | 0 {gitlab => .gitlab}/build_lassen.yml | 0 {gitlab => .gitlab}/build_quartz.yml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {gitlab => .gitlab}/build_and_test.sh (100%) rename {gitlab => .gitlab}/build_lassen.yml (100%) rename {gitlab => .gitlab}/build_quartz.yml (100%) diff --git a/gitlab/build_and_test.sh b/.gitlab/build_and_test.sh similarity index 100% rename from gitlab/build_and_test.sh rename to .gitlab/build_and_test.sh diff --git a/gitlab/build_lassen.yml b/.gitlab/build_lassen.yml similarity index 100% rename from gitlab/build_lassen.yml rename to .gitlab/build_lassen.yml diff --git a/gitlab/build_quartz.yml b/.gitlab/build_quartz.yml similarity index 100% rename from gitlab/build_quartz.yml rename to .gitlab/build_quartz.yml From 939527b494ea6e3c16557dbd0b8b01f717ce2e67 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 23:41:57 -0800 Subject: [PATCH 214/330] Fix path --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 68fc168ce..ceda3d715 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ stages: #BUILD + TEST - echo -e "section_start:$(date +%s):build_and_test\r\e[0K Build and test ${CI_PROJECT_NAME}" - - ${EXEC_PREFIX} gitlab/build_and_test.sh + - ${EXEC_PREFIX} .gitlab/build_and_test.sh - echo -e "section_end:$(date +%s):build_and_test\r\e[0K" artifacts: reports: @@ -37,7 +37,7 @@ stages: #BUILD + TEST - echo -e "section_start:$(date +%s):build_and_test\r\e[0K Build and test ${CI_PROJECT_NAME}" - - ${EXEC_PREFIX} gitlab/build_and_test.sh + - ${EXEC_PREFIX} .gitlab/build_and_test.sh - echo -e "section_end:$(date +%s):build_and_test\r\e[0K" artifacts: reports: From df5f2c32055fc5b35f187b8f2c4f0a1cdd90caea Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 3 Feb 2021 23:54:09 -0800 Subject: [PATCH 215/330] make executable --- .gitlab/build_and_test.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .gitlab/build_and_test.sh diff --git a/.gitlab/build_and_test.sh b/.gitlab/build_and_test.sh old mode 100644 new mode 100755 From 79919ddb157cd1308c6e1b57032b816ada230327 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 00:00:49 -0800 Subject: [PATCH 216/330] fix host-config path --- .gitlab/build_and_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/build_and_test.sh b/.gitlab/build_and_test.sh index b1d866b97..3cb4cc037 100755 --- a/.gitlab/build_and_test.sh +++ b/.gitlab/build_and_test.sh @@ -6,7 +6,7 @@ rm -rf build mkdir build cd build -cmake -C $HOST_CONFIG ../tests/internal +cmake -C host-configs/llnl/$SYS_TYPE/$HOST_CONFIG ../tests/internal make -j8 ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" From d5fd640e72ed9c8a130b079edb15a11e10729919 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 11:16:38 -0800 Subject: [PATCH 217/330] Add diagnostic echos --- .gitlab/build_and_test.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitlab/build_and_test.sh b/.gitlab/build_and_test.sh index 3cb4cc037..08512bde0 100755 --- a/.gitlab/build_and_test.sh +++ b/.gitlab/build_and_test.sh @@ -2,11 +2,23 @@ set -e -rm -rf build -mkdir build -cd build +BUILD_DIR=`pwd`/build + +echo "~~~~~~~~~~ START:build_and_test.sh ~~~~~~~~~~~" +echo "CWD="`pwd` +echo "BUILD_DIR="$BUILD_DIR +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR +cd $BUILD_DIR cmake -C host-configs/llnl/$SYS_TYPE/$HOST_CONFIG ../tests/internal make -j8 ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" + +echo "~~~~~~~~~~ END:build_and_test.sh ~~~~~~~~~~~~~" +echo "CWD="`pwd` +echo "BUILD_DIR="$BUILD_DIR +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" From b714bbead60158c233e0c40d9cb0ef2a96e12a5b Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 11:17:04 -0800 Subject: [PATCH 218/330] Fix path --- .gitlab/build_and_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/build_and_test.sh b/.gitlab/build_and_test.sh index 08512bde0..fde541721 100755 --- a/.gitlab/build_and_test.sh +++ b/.gitlab/build_and_test.sh @@ -13,7 +13,7 @@ rm -rf $BUILD_DIR mkdir $BUILD_DIR cd $BUILD_DIR -cmake -C host-configs/llnl/$SYS_TYPE/$HOST_CONFIG ../tests/internal +cmake -C ../host-configs/llnl/$SYS_TYPE/$HOST_CONFIG ../tests/internal make -j8 ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" From 0df0649ab53fe4f752070d97596178812204bf04 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 11:29:23 -0800 Subject: [PATCH 219/330] Fix offending quote --- .gitlab/build_and_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/build_and_test.sh b/.gitlab/build_and_test.sh index fde541721..fcbc595c0 100755 --- a/.gitlab/build_and_test.sh +++ b/.gitlab/build_and_test.sh @@ -16,7 +16,7 @@ cd $BUILD_DIR cmake -C ../host-configs/llnl/$SYS_TYPE/$HOST_CONFIG ../tests/internal make -j8 ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 -xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml" +xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml echo "~~~~~~~~~~ END:build_and_test.sh ~~~~~~~~~~~~~" echo "CWD="`pwd` From 599e56dfee1c8331a4ac2ed41aab7caef210ecca Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 11:46:56 -0800 Subject: [PATCH 220/330] Load cmake module --- .gitlab/build_lassen.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab/build_lassen.yml b/.gitlab/build_lassen.yml index 8fce51c47..0cd35459e 100644 --- a/.gitlab/build_lassen.yml +++ b/.gitlab/build_lassen.yml @@ -11,9 +11,10 @@ - when: on_success #### -# Load required CUDA module +# Load required modules .with_cuda: before_script: + - module load cmake/3.18.0 - module load cuda/11.1.1 #### From 1dd6189b30c66c6bf8ee26f510206790a6d24fdb Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 12:30:39 -0800 Subject: [PATCH 221/330] attempt to fix omp error --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ceda3d715..efdc38131 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,7 @@ stages: #Use pre-existing allocation if any - JOBID=$(squeue -h --name=${PROJECT_ALLOC_NAME} --format=%A) - ASSIGN_ID=$(if [[ -n "${JOBID}" ]]; then echo "--jobid=${JOBID}"; fi) - - EXEC_PREFIX="srun -p pdebug ${ASSIGN_ID} -t 10 -N 1" + - EXEC_PREFIX="srun -p pdebug ${ASSIGN_ID} -t 10 -N 1 --mpibind=off" #BUILD + TEST - echo -e "section_start:$(date +%s):build_and_test\r\e[0K Build and test ${CI_PROJECT_NAME}" From ac1143eaef91d58a22675a048ee56d04506f6f28 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 13:11:01 -0800 Subject: [PATCH 222/330] Add another mpibind and turn off job slots for tests since they are so fast anyways --- .gitlab/build_and_test.sh | 2 +- .gitlab/build_quartz.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/build_and_test.sh b/.gitlab/build_and_test.sh index fcbc595c0..cd6130187 100755 --- a/.gitlab/build_and_test.sh +++ b/.gitlab/build_and_test.sh @@ -15,7 +15,7 @@ cd $BUILD_DIR cmake -C ../host-configs/llnl/$SYS_TYPE/$HOST_CONFIG ../tests/internal make -j8 -ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 +ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV xsltproc -o junit.xml ../tests/ctest-to-junit.xsl Testing/*/Test.xml echo "~~~~~~~~~~ END:build_and_test.sh ~~~~~~~~~~~~~" diff --git a/.gitlab/build_quartz.yml b/.gitlab/build_quartz.yml index 45f5ad4f6..0c146106e 100644 --- a/.gitlab/build_quartz.yml +++ b/.gitlab/build_quartz.yml @@ -19,7 +19,7 @@ allocate_resources_build_quartz: extends: [.on_quartz] stage: q_allocate_resources script: - - salloc -p pdebug -N 1 -c 36 -t 30 --no-shell --job-name=${PROJECT_ALLOC_NAME} + - salloc -p pdebug -N 1 -c 36 -t 30 --no-shell --job-name=${PROJECT_ALLOC_NAME} --mpibind=off needs: [] #### From ddb77254da92df884cf6eb4c004ffc8c364ebdf9 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 18:45:17 -0800 Subject: [PATCH 223/330] upgrade pgi compiler --- .gitlab/build_quartz.yml | 4 ++-- .../toss_3_x86_64_ib/{pgi@18.5.cmake => pgi@20.1.cmake} | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename host-configs/llnl/toss_3_x86_64_ib/{pgi@18.5.cmake => pgi@20.1.cmake} (92%) diff --git a/.gitlab/build_quartz.yml b/.gitlab/build_quartz.yml index 0c146106e..9b3b922ac 100644 --- a/.gitlab/build_quartz.yml +++ b/.gitlab/build_quartz.yml @@ -57,7 +57,7 @@ gcc_4_9_3 (quartz): HOST_CONFIG: "gcc@4.9.3.cmake" extends: [.build_on_quartz] -pgi_18_5 (quartz): +pgi_20_1 (quartz): variables: - HOST_CONFIG: "pgi@18.5.cmake" + HOST_CONFIG: "pgi@20.1.cmake" extends: [.build_on_quartz] diff --git a/host-configs/llnl/toss_3_x86_64_ib/pgi@18.5.cmake b/host-configs/llnl/toss_3_x86_64_ib/pgi@20.1.cmake similarity index 92% rename from host-configs/llnl/toss_3_x86_64_ib/pgi@18.5.cmake rename to host-configs/llnl/toss_3_x86_64_ib/pgi@20.1.cmake index 9f96108b6..78f024677 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/pgi@18.5.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/pgi@20.1.cmake @@ -4,10 +4,10 @@ # SPDX-License-Identifier: (BSD-3-Clause) #------------------------------------------------------------------------------ -# Example pgi@18.5 host-config for LLNL toss3 machines +# Example pgi@20.1 host-config for LLNL toss3 machines #------------------------------------------------------------------------------ -set(COMPILER_HOME "/usr/tce/packages/pgi/pgi-18.5") +set(COMPILER_HOME "/usr/tce/packages/pgi/pgi-20.1") # c compiler set(CMAKE_C_COMPILER "${COMPILER_HOME}/bin/pgcc" CACHE PATH "") @@ -34,7 +34,7 @@ set(ENABLE_OPENMP ON CACHE BOOL "") set(ENABLE_MPI ON CACHE BOOL "") -set(MPI_HOME "/usr/tce/packages/mvapich2/mvapich2-2.2-pgi-18.5") +set(MPI_HOME "/usr/tce/packages/mvapich2/mvapich2-2.3-pgi-20.1") set(MPI_C_COMPILER "${MPI_HOME}/bin/mpicc" CACHE PATH "") set(MPI_CXX_COMPILER "${MPI_HOME}/bin/mpicxx" CACHE PATH "") From a2bada63ac1dc7743d87133ecd48c79cf4ea6870 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 4 Feb 2021 23:23:02 -0800 Subject: [PATCH 224/330] Bump gcc compiler --- .gitlab/build_quartz.yml | 4 ++-- .../toss_3_x86_64_ib/{gcc@4.9.3.cmake => gcc@8.3.1.cmake} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename host-configs/llnl/toss_3_x86_64_ib/{gcc@4.9.3.cmake => gcc@8.3.1.cmake} (97%) diff --git a/.gitlab/build_quartz.yml b/.gitlab/build_quartz.yml index 9b3b922ac..f9cc757d4 100644 --- a/.gitlab/build_quartz.yml +++ b/.gitlab/build_quartz.yml @@ -52,9 +52,9 @@ clang_6_0_0_static_analysis (quartz): HOST_CONFIG: "clang@6.0.0-static-analysis.cmake" extends: [.build_on_quartz] -gcc_4_9_3 (quartz): +gcc_8_3_1 (quartz): variables: - HOST_CONFIG: "gcc@4.9.3.cmake" + HOST_CONFIG: "gcc@8.3.1.cmake" extends: [.build_on_quartz] pgi_20_1 (quartz): diff --git a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake similarity index 97% rename from host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake rename to host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake index ce4605d6b..e39bc62ae 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake @@ -13,10 +13,10 @@ #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ -# gcc@4.9.3 compilers +# gcc@8.3.1 compilers #------------------------------------------------------------------------------ -set(GCC_VERSION "gcc-4.9.3") +set(GCC_VERSION "gcc-8.3.1") set(GCC_HOME "/usr/tce/packages/gcc/${GCC_VERSION}") # c compiler From 28eeedf4e846201409a8e8b762762f34e6a208bf Mon Sep 17 00:00:00 2001 From: Geoffrey M Oxberry Date: Mon, 8 Feb 2021 11:29:17 -0800 Subject: [PATCH 225/330] docs: add SPHINX_EXECUTABLE prereq to sphinx tgt --- docs/api/documentation.rst | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/api/documentation.rst b/docs/api/documentation.rst index 2bea5c3b9..e027a6c61 100644 --- a/docs/api/documentation.rst +++ b/docs/api/documentation.rst @@ -1,6 +1,6 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and .. # other BLT Project Developers. See the top-level COPYRIGHT file for details -.. # +.. # .. # SPDX-License-Identifier: (BSD-3-Clause) Documenation Macros @@ -14,11 +14,11 @@ blt_add_doxygen_target blt_add_doxygen_target(doxygen_target_name) -Creates a build target for invoking doxygen to generate docs. Expects to -find a Doxyfile.in in the directory the macro is called in. +Creates a build target for invoking doxygen to generate docs. Expects to +find a Doxyfile.in in the directory the macro is called in. -This macro sets up the doxygen paths so that the doc builds happen -out of source. For ``make install``, this will place the resulting docs in +This macro sets up the doxygen paths so that the doc builds happen +out of source. For ``make install``, this will place the resulting docs in docs/doxygen/. @@ -29,14 +29,16 @@ blt_add_sphinx_target blt_add_sphinx_target(sphinx_target_name) -Creates a build target for invoking sphinx to generate docs. Expects to -find a conf.py or conf.py.in in the directory the macro is called in. +Creates a build target for invoking sphinx to generate docs. Expects +to find a conf.py or conf.py.in in the directory the macro is called +in. Requires that a CMake variable named ``SPHINX_EXECUTABLE`` +contains the path to the ``sphinx-build`` executable. If conf.py is found, it is directly used as input to sphinx. If conf.py.in is found, this macro uses CMake's configure_file() command to generate a conf.py, which is then used as input to sphinx. -This macro sets up the sphinx paths so that the doc builds happen -out of source. For ``make install``, this will place the resulting docs in +This macro sets up the sphinx paths so that the doc builds happen +out of source. For ``make install``, this will place the resulting docs in docs/sphinx/. From a5f658c384524f6cb570447d14b62f962eba6231 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 10 Feb 2021 07:38:30 -0800 Subject: [PATCH 226/330] fix: re-add old openMP patching logic --- RELEASE-NOTES.md | 1 + cmake/BLTPrivateMacros.cmake | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 9a800569b..1adf02376 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -70,6 +70,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ will automatically be linked with the HIP or CUDA (NVCC) linker - Patched an issue with the FindHIP macros that added the inclusive scan of specified DEFINEs to compile commands +- Re-added previous OpenMP flag patching logic to maintain compatibility with BLT-registered libraries ## [Version 0.3.6] - Release date 2020-07-27 diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 1ad484c48..32c3b5b2e 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -124,6 +124,29 @@ function(blt_fix_fortran_openmp_flags target_name) LINK_LIBRARIES "${target_link_libs}" ) endif() + # OpenMP is an interface library which doesn't have a LINK_FLAGS property + # in versions < 3.13 + set(_property_name INTERFACE_LINK_LIBRARIES) + if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) + # In CMake 3.13+, LINK_FLAGS was converted to LINK_OPTIONS. + set(_property_name LINK_OPTIONS) + endif() + + get_target_property(target_link_flags ${target_name} ${_property_name}) + if ( target_link_flags ) + + message(STATUS "Fixing OpenMP Flags for target[${target_name}]") + message(STATUS "Detected link flags are: ${target_link_flags}") + message(STATUS "Replacing ${OpenMP_CXX_FLAGS} with ${OpenMP_Fortran_FLAGS}") + + string( REPLACE "${OpenMP_CXX_FLAGS}" "${OpenMP_Fortran_FLAGS}" + correct_link_flags + "${target_link_flags}" + ) + message(STATUS "Fixed link flags are: ${correct_link_flags}") + set_target_properties( ${target_name} PROPERTIES ${_property_name} + "${correct_link_flags}" ) + endif() endif() endif() From feaef30c897e3f81a9718bb59087f5c1cecad435 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 10 Feb 2021 12:25:43 -0800 Subject: [PATCH 227/330] Fix case where link flag was being recognized as a link library and would end up as '-lSHELL:-fopenmp' --- cmake/BLTPrivateMacros.cmake | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 32c3b5b2e..4231af9bb 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -92,6 +92,7 @@ endfunction() function(blt_fix_fortran_openmp_flags target_name) if (ENABLE_FORTRAN AND ENABLE_OPENMP AND BLT_OPENMP_FLAGS_DIFFER) + # The OpenMP interface library will have been added as a direct # link dependency instead of via flags get_target_property(target_link_libs ${target_name} LINK_LIBRARIES) @@ -101,12 +102,19 @@ function(blt_fix_fortran_openmp_flags target_name) # the DAG. Only the link flags need to be modified. list(FIND target_link_libs "openmp" _omp_index) if(${_omp_index} GREATER -1) + message(STATUS "Fixing OpenMP Flags for target[${target_name}]") + + # Remove openmp from libraries list(REMOVE_ITEM target_link_libs "openmp") + set_target_properties( ${target_name} PROPERTIES + LINK_LIBRARIES "${target_link_libs}" ) - # Copy the compile flags verbatim + # Add openmp compile flags verbatim w/ generator expression get_target_property(omp_compile_flags openmp INTERFACE_COMPILE_OPTIONS) target_compile_options(${target_name} PUBLIC ${omp_compile_flags}) + # Change CXX flags to Fortran flags + # These are set through blt_add_target_link_flags which needs to use # the link_libraries for interface libraries in CMake < 3.13 if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) @@ -114,36 +122,30 @@ function(blt_fix_fortran_openmp_flags target_name) else() get_target_property(omp_link_flags openmp INTERFACE_LINK_LIBRARIES) endif() - + string( REPLACE "${OpenMP_CXX_FLAGS}" "${OpenMP_Fortran_FLAGS}" correct_omp_link_flags "${omp_link_flags}" ) - list(APPEND target_link_libs "${correct_omp_link_flags}") - set_target_properties( ${target_name} PROPERTIES - LINK_LIBRARIES "${target_link_libs}" ) + target_link_options(${target_name} PRIVATE "${correct_omp_link_flags}") endif() + # Handle registered library general case + # OpenMP is an interface library which doesn't have a LINK_FLAGS property # in versions < 3.13 - set(_property_name INTERFACE_LINK_LIBRARIES) + set(_property_name LINK_FLAGS) if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) # In CMake 3.13+, LINK_FLAGS was converted to LINK_OPTIONS. set(_property_name LINK_OPTIONS) endif() - get_target_property(target_link_flags ${target_name} ${_property_name}) if ( target_link_flags ) - message(STATUS "Fixing OpenMP Flags for target[${target_name}]") - message(STATUS "Detected link flags are: ${target_link_flags}") - message(STATUS "Replacing ${OpenMP_CXX_FLAGS} with ${OpenMP_Fortran_FLAGS}") - string( REPLACE "${OpenMP_CXX_FLAGS}" "${OpenMP_Fortran_FLAGS}" correct_link_flags "${target_link_flags}" ) - message(STATUS "Fixed link flags are: ${correct_link_flags}") set_target_properties( ${target_name} PROPERTIES ${_property_name} "${correct_link_flags}" ) endif() From 3596a378495861a48463f577208c443e1e6c1723 Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 10 Feb 2021 15:52:37 -0600 Subject: [PATCH 228/330] fix: don't use target_link_options pre 3.13 --- cmake/BLTPrivateMacros.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 4231af9bb..7d01d9a6c 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -127,7 +127,11 @@ function(blt_fix_fortran_openmp_flags target_name) correct_omp_link_flags "${omp_link_flags}" ) - target_link_options(${target_name} PRIVATE "${correct_omp_link_flags}") + if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) + target_link_options(${target_name} PRIVATE "${correct_omp_link_flags}") + else() + set_property(TARGET ${target_name} APPEND PROPERTY LINK_FLAGS "${correct_omp_link_flags}") + endif() endif() # Handle registered library general case From 4e630c9aab0a4228c3ce5f9744d84a2329a12d6c Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 12:08:36 -0700 Subject: [PATCH 229/330] Use literal include for cuda settings --- docs/tutorial/external_dependencies.rst | 29 ++++++++----------- .../clang@upstream_nvcc_xlf.cmake | 7 +++-- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index ce7719201..f7a244a97 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -183,15 +183,10 @@ compile each source file with ``nvcc``. Some other useful CUDA flags are: -.. code-block:: cmake - - # Enable separable compilation of all CUDA files for given target or all following targets - set(CUDA_SEPARABLE_COMPILIATION ON CACHE BOOL “”) - set(CUDA_ARCH “sm_60” CACHE STRING “”) - set(CMAKE_CUDA_FLAGS “-restrict –arch ${CUDA_ARCH} –std=c++11” CACHE STRING “”) - set(CMAKE_CUDA_LINK_FLAGS “-Xlinker –rpath –Xlinker /path/to/mpi” CACHE STRING “”) - # Needed when you have CUDA decorations exposed in libraries - set(CUDA_LINK_WITH_NVCC ON CACHE BOOL “”) +.. literalinclude:: ../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake + :start-after: _blt_tutorial_useful_cuda_flags_start + :end-before: _blt_tutorial_useful_cuda_flags_end + :language: cmake OpenMP @@ -203,10 +198,10 @@ executable's ``DEPENDS_ON`` list. Here is an example of how to add an OpenMP enabled executable: - .. literalinclude:: ../../tests/smoke/CMakeLists.txt - :start-after: _blt_tutorial_openmp_executable_start - :end-before: _blt_tutorial_openmp_executable_end - :language: cmake +.. literalinclude:: ../../tests/smoke/CMakeLists.txt + :start-after: _blt_tutorial_openmp_executable_start + :end-before: _blt_tutorial_openmp_executable_end + :language: cmake .. note:: While we have tried to ensure that BLT chooses the correct compile and link flags for @@ -221,10 +216,10 @@ Here is an example of how to add an OpenMP enabled executable: Here is an example of how to add an OpenMP enabled test that sets the amount of threads used: - .. literalinclude:: ../../tests/smoke/CMakeLists.txt - :start-after: _blt_tutorial_openmp_test_start - :end-before: _blt_tutorial_openmp_test_end - :language: cmake +.. literalinclude:: ../../tests/smoke/CMakeLists.txt + :start-after: _blt_tutorial_openmp_test_start + :end-before: _blt_tutorial_openmp_test_end + :language: cmake Example Host-configs diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake index 7d88d5db2..85144a17e 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake @@ -60,18 +60,19 @@ set(BLT_FORTRAN_FLAGS "-WF,-C!" CACHE PATH "Converts C-style comments to Fortran #------------------------------------------------------------------------------ # CUDA support #------------------------------------------------------------------------------ - +#_blt_tutorial_useful_cuda_flags_start set(ENABLE_CUDA ON CACHE BOOL "") set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") set(CMAKE_CUDA_HOST_COMPILER "${MPI_CXX_COMPILER}" CACHE PATH "") -set(_cuda_arch "sm_70") +set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") +set(_cuda_arch "sm_${CMAKE_CUDA_ARCHITECTURES}") set(CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-lambda -G" CACHE STRING "") set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "" ) # nvcc does not like gtest's 'pthreads' flag set(gtest_disable_pthreads ON CACHE BOOL "") - +#_blt_tutorial_useful_cuda_flags_end From e23a29dcb17bd2e19590212e2fd71da4534bced0 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 13:18:41 -0700 Subject: [PATCH 230/330] Update paths in surface host-config --- ...-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake b/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake index 0cd3b2693..84f51fc3e 100644 --- a/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake +++ b/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake @@ -15,12 +15,13 @@ # gcc@4.9.3 compilers #------------------------------------------------------------------------------ # _blt_tutorial_surface_compiler_config_start -set(CMAKE_C_COMPILER "/usr/apps/gnu/4.9.3/bin/gcc" CACHE PATH "") -set(CMAKE_CXX_COMPILER "/usr/apps/gnu/4.9.3/bin/g++" CACHE PATH "") +set(GCC_HOME "/usr/tce") +set(CMAKE_C_COMPILER "${GCC_HOME}/bin/gcc" CACHE PATH "") +set(CMAKE_CXX_COMPILER "${GCC_HOME}/bin/g++" CACHE PATH "") # Fortran support set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/usr/apps/gnu/4.9.3/bin/gfortran" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "${GCC_HOME}/gfortran" CACHE PATH "") # _blt_tutorial_surface_compiler_config_end #------------------------------------------------------------------------------ @@ -29,11 +30,12 @@ set(CMAKE_Fortran_COMPILER "/usr/apps/gnu/4.9.3/bin/gfortran" CACHE PATH "") # _blt_tutorial_surface_mpi_config_start set(ENABLE_MPI ON CACHE BOOL "") -set(MPI_C_COMPILER "/usr/local/tools/mvapich2-gnu-2.0/bin/mpicc" CACHE PATH "") +set(MPI_HOME "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-4.9.3/") +set(MPI_C_COMPILER "${MPI_HOME}/bin/mpicc" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/local/tools/mvapich2-gnu-2.0/bin/mpicc" CACHE PATH "") +set(MPI_CXX_COMPILER "${MPI_HOME}/bin/mpicxx" CACHE PATH "") -set(MPI_Fortran_COMPILER "/usr/local/tools/mvapich2-gnu-2.0/bin/mpif90" CACHE PATH "") +set(MPI_Fortran_COMPILER "${MPI_HOME}/bin/mpif90" CACHE PATH "") # _blt_tutorial_surface_mpi_config_end #------------------------------------------------------------------------------ @@ -42,9 +44,15 @@ set(MPI_Fortran_COMPILER "/usr/local/tools/mvapich2-gnu-2.0/bin/mpif90" CACHE PA # _blt_tutorial_surface_cuda_config_start set(ENABLE_CUDA ON CACHE BOOL "") -set(CUDA_TOOLKIT_ROOT_DIR "/opt/cudatoolkit-8.0" CACHE PATH "") -set(CMAKE_CUDA_COMPILER "/opt/cudatoolkit-8.0/bin/nvcc" CACHE PATH "") +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.2.89" CACHE PATH "") +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "") + +set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") +set(_cuda_arch "sm_${CMAKE_CUDA_ARCHITECTURES}") +set(CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-lambda -G" CACHE STRING "") + set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") + # _blt_tutorial_surface_cuda_config_end From 64b78a21fab5071234cccd504d3b18243643d4c6 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 13:34:40 -0700 Subject: [PATCH 231/330] Move surface host-config under proper directory, remove now unneeded module load for cmake on surface --- docs/tutorial/external_dependencies.rst | 14 ++++++-------- docs/tutorial/setup_blt.rst | 2 +- .../toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake} | 0 3 files changed, 7 insertions(+), 9 deletions(-) rename host-configs/{other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake => llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake} (100%) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index f7a244a97..3eac26380 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -99,7 +99,7 @@ which uses MPI to parallelize the calculation over the integration intervals. To enable MPI, we set ``ENABLE_MPI``, ``MPI_C_COMPILER``, and ``MPI_CXX_COMPILER`` in our host config file. Here is a snippet with these settings for LLNL's Surface Cluster: -.. literalinclude:: ../../host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake +.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake :start-after: _blt_tutorial_surface_mpi_config_start :end-before: _blt_tutorial_surface_mpi_config_end :language: cmake @@ -162,7 +162,7 @@ for you and enable the CUDA language. Here is a snippet with these settings for LLNL's Surface Cluster: -.. literalinclude:: ../../host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake +.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake :start-after: _blt_tutorial_surface_cuda_config_start :end-before: _blt_tutorial_surface_cuda_config_end :language: cmake @@ -227,11 +227,11 @@ Example Host-configs Here are the full example host-config files that use gcc 4.9.3 for LLNL's Surface, Ray and Quartz Clusters. -:download:`llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake <../../host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake>` +:download:`llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake <../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake>` -:download:`llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf <../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake>` +:download:`llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake <../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake>` -:download:`llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake <../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3.cmake>` +:download:`llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake <../../host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake>` .. note:: Quartz does not have GPUs, so CUDA is not enabled in the Quartz host-config. @@ -247,13 +247,11 @@ Here is how you can use the host-config file to configure a build of the ``calc_ .. code-block:: bash - # load new cmake b/c default on surface is too old - ml cmake/3.9.2 # create build dir mkdir build cd build # configure using host-config - cmake -C ../../host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake \ + cmake -C ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake \ -DBLT_SOURCE_DIR=../../../../blt .. After building (``make``), you can run ``make test`` on a batch node (where the GPUs reside) diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index c4bf0a500..322ee5716 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -219,7 +219,7 @@ These files use standard CMake commands. CMake ``set()`` commands need to specif Here is a snippet from a host-config file that specifies compiler details for using gcc 4.9.3 on LLNL's surface cluster. -.. literalinclude:: ../../host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake +.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake :start-after: _blt_tutorial_surface_compiler_config_start :end-before: _blt_tutorial_surface_compiler_config_end :language: cmake diff --git a/host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake similarity index 100% rename from host-configs/other/llnl-surface-chaos_5_x86_64_ib-gcc@4.9.3.cmake rename to host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake From 54d12e7869b81534b2b07e2c857097ec3bacc2cf Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 14:06:24 -0700 Subject: [PATCH 232/330] Add CUDA driver and runtime version smoke test --- tests/smoke/CMakeLists.txt | 9 ++++++ tests/smoke/blt_cuda_version_smoke.cpp | 42 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/smoke/blt_cuda_version_smoke.cpp diff --git a/tests/smoke/CMakeLists.txt b/tests/smoke/CMakeLists.txt index eab0eb153..46b5cc475 100644 --- a/tests/smoke/CMakeLists.txt +++ b/tests/smoke/CMakeLists.txt @@ -21,6 +21,7 @@ if(ENABLE_GTEST) COMMAND blt_gtest_smoke) endif() + ################ # gmock test ################ @@ -136,6 +137,14 @@ if (ENABLE_CUDA) blt_add_test(NAME blt_cuda_runtime_smoke COMMAND blt_cuda_runtime_smoke) + blt_add_executable(NAME blt_cuda_version_smoke + SOURCES blt_cuda_version_smoke.cpp + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON cuda_runtime + FOLDER blt/tests ) + + blt_add_test(NAME blt_cuda_version_smoke + COMMAND blt_cuda_version_smoke) if (ENABLE_OPENMP) blt_add_executable(NAME blt_cuda_openmp_smoke SOURCES blt_cuda_openmp_smoke.cpp diff --git a/tests/smoke/blt_cuda_version_smoke.cpp b/tests/smoke/blt_cuda_version_smoke.cpp new file mode 100644 index 000000000..6eb94cda2 --- /dev/null +++ b/tests/smoke/blt_cuda_version_smoke.cpp @@ -0,0 +1,42 @@ +// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +// other BLT Project Developers. See the top-level COPYRIGHT file for details +// +// SPDX-License-Identifier: (BSD-3-Clause) + +//----------------------------------------------------------------------------- +// +// file: blt_cuda_version_smoke.cpp +// +//----------------------------------------------------------------------------- + +#include +#include "cuda_runtime_api.h" + + +int main() +{ + int driverVersion = 0; + int runtimeVersion = 0; + cudaError_t error_id; + + error_id = cudaDriverGetVersion(&driverVersion); + if (error_id != cudaSuccess) { + std::string msg = "cudaDriverGetVersion returned CUDA Error (" + std::to_string(error_id) + + "): " + cudaGetErrorString(error_id) + "\n"; + std::cerr << msg; + return 1; + } + std::cout << "CUDA driver version: " << driverVersion << std::endl; + + error_id = cudaRuntimeGetVersion(&runtimeVersion); + if (error_id != cudaSuccess) { + std::string msg = "cudaDriverGetVersion returned CUDA Error (" + std::to_string(error_id) + + "): " + cudaGetErrorString(error_id) + "\n"; + std::cerr << msg; + return 2; + } + std::cout << "CUDA runtime version: " << runtimeVersion << std::endl; + + return 0; +} + From 5fa02c454c27e1244dcc868dfca47a8f393f4f49 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 14:09:52 -0700 Subject: [PATCH 233/330] Fix fortran path --- host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake index 84f51fc3e..278368904 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake @@ -21,7 +21,7 @@ set(CMAKE_CXX_COMPILER "${GCC_HOME}/bin/g++" CACHE PATH "") # Fortran support set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "${GCC_HOME}/gfortran" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "${GCC_HOME}/bin/gfortran" CACHE PATH "") # _blt_tutorial_surface_compiler_config_end #------------------------------------------------------------------------------ From 7b960ccdeec474df9df2fdbcc17906d3437784fc Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 15:20:36 -0700 Subject: [PATCH 234/330] change cuda version --- host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake index 278368904..d702390dd 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake @@ -44,7 +44,7 @@ set(MPI_Fortran_COMPILER "${MPI_HOME}/bin/mpif90" CACHE PATH "") # _blt_tutorial_surface_cuda_config_start set(ENABLE_CUDA ON CACHE BOOL "") -set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.2.89" CACHE PATH "") +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "") From 396dc27632447d37fa7382910dadadd31f7931ac Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 15:58:52 -0700 Subject: [PATCH 235/330] remove bgq reference --- tests/internal/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 27725c6fb..a5ba5b9b1 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -94,10 +94,6 @@ if(ENABLE_GTEST) set(_try_combine_static_libs OFF) endif() - if ("$ENV{SYS_TYPE}" STREQUAL "bgqos_0") - set(_try_combine_static_libs OFF) - endif() - if ( ${_try_combine_static_libs} ) add_subdirectory( src/combine_static_library_test ) endif () From 7318782f1db7618a3c6cee1eedcc26956b4e88fc Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 16:28:41 -0700 Subject: [PATCH 236/330] Remove reference to surface --- docs/tutorial/external_dependencies.rst | 21 ++++++++++--------- docs/tutorial/setup_blt.rst | 6 +++--- .../toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake | 15 +++++++------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 3eac26380..4669ba325 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -97,11 +97,12 @@ Our next example, ``test_2``, builds and tests the ``calc_pi_mpi`` library, which uses MPI to parallelize the calculation over the integration intervals. -To enable MPI, we set ``ENABLE_MPI``, ``MPI_C_COMPILER``, and ``MPI_CXX_COMPILER`` in our host config file. Here is a snippet with these settings for LLNL's Surface Cluster: +To enable MPI, we set ``ENABLE_MPI``, ``MPI_C_COMPILER``, and ``MPI_CXX_COMPILER`` +in our host config file. Here is a snippet with these settings for LLNL's Pascal Cluster: .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake - :start-after: _blt_tutorial_surface_mpi_config_start - :end-before: _blt_tutorial_surface_mpi_config_end + :start-after: _blt_tutorial_mpi_config_start + :end-before: _blt_tutorial_mpi_config_end :language: cmake @@ -160,11 +161,11 @@ or ``CUDA_HOST_COMPILER`` in previous versions. If you do not call ``enable_language(CUDA)``, BLT will set the appropriate host compiler variable for you and enable the CUDA language. -Here is a snippet with these settings for LLNL's Surface Cluster: +Here is a snippet with these settings for LLNL's Pascal Cluster: .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake - :start-after: _blt_tutorial_surface_cuda_config_start - :end-before: _blt_tutorial_surface_cuda_config_end + :start-after: _blt_tutorial_cuda_config_start + :end-before: _blt_tutorial_cuda_config_end :language: cmake Here, you can see how ``calc_pi_cuda`` and ``test_3`` use ``DEPENDS_ON``: @@ -225,7 +226,7 @@ Here is an example of how to add an OpenMP enabled test that sets the amount of Example Host-configs ~~~~~~~~~~~~~~~~~~~~ -Here are the full example host-config files that use gcc 4.9.3 for LLNL's Surface, Ray and Quartz Clusters. +Here are the full example host-config files that use gcc 4.9.3 for LLNL's Pascal, Ray, and Quartz Clusters. :download:`llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake <../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake>` @@ -240,10 +241,10 @@ Here is a full example host-config file for an OSX laptop, using a set of depend :download:`darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake <../../host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake>` -Building and testing on Surface -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Building and testing on Pascal +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA enabled on Surface: +Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA enabled on Pascal: .. code-block:: bash diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index 322ee5716..e5c2eb2bc 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -217,11 +217,11 @@ These files use standard CMake commands. CMake ``set()`` commands need to specif set(CMAKE_VARIABLE_NAME {VALUE} CACHE PATH "") Here is a snippet from a host-config file that specifies compiler details for -using gcc 4.9.3 on LLNL's surface cluster. +using gcc 4.9.3 on LLNL's Pascal cluster. .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake - :start-after: _blt_tutorial_surface_compiler_config_start - :end-before: _blt_tutorial_surface_compiler_config_end + :start-after: _blt_tutorial_compiler_config_start + :end-before: _blt_tutorial_compiler_config_end :language: cmake diff --git a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake index d702390dd..3c0b90498 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake @@ -4,9 +4,8 @@ # SPDX-License-Identifier: (BSD-3-Clause) #------------------------------------------------------------------------------ -# Example host-config file for the surface cluster at LLNL +# Example host-config file for the Pascal cluster at LLNL #------------------------------------------------------------------------------ -# # This file provides CMake with paths / details for: # C,C++, & Fortran compilers + MPI & CUDA #------------------------------------------------------------------------------ @@ -14,7 +13,7 @@ #------------------------------------------------------------------------------ # gcc@4.9.3 compilers #------------------------------------------------------------------------------ -# _blt_tutorial_surface_compiler_config_start +# _blt_tutorial_compiler_config_start set(GCC_HOME "/usr/tce") set(CMAKE_C_COMPILER "${GCC_HOME}/bin/gcc" CACHE PATH "") set(CMAKE_CXX_COMPILER "${GCC_HOME}/bin/g++" CACHE PATH "") @@ -22,12 +21,12 @@ set(CMAKE_CXX_COMPILER "${GCC_HOME}/bin/g++" CACHE PATH "") # Fortran support set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "${GCC_HOME}/bin/gfortran" CACHE PATH "") -# _blt_tutorial_surface_compiler_config_end +# _blt_tutorial_compiler_config_end #------------------------------------------------------------------------------ # MPI Support #------------------------------------------------------------------------------ -# _blt_tutorial_surface_mpi_config_start +# _blt_tutorial_mpi_config_start set(ENABLE_MPI ON CACHE BOOL "") set(MPI_HOME "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-4.9.3/") @@ -36,12 +35,12 @@ set(MPI_C_COMPILER "${MPI_HOME}/bin/mpicc" CACHE PATH "") set(MPI_CXX_COMPILER "${MPI_HOME}/bin/mpicxx" CACHE PATH "") set(MPI_Fortran_COMPILER "${MPI_HOME}/bin/mpif90" CACHE PATH "") -# _blt_tutorial_surface_mpi_config_end +# _blt_tutorial_mpi_config_end #------------------------------------------------------------------------------ # CUDA support #------------------------------------------------------------------------------ -# _blt_tutorial_surface_cuda_config_start +# _blt_tutorial_cuda_config_start set(ENABLE_CUDA ON CACHE BOOL "") set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") @@ -54,5 +53,5 @@ set(CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-l set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") -# _blt_tutorial_surface_cuda_config_end +# _blt_tutorial_cuda_config_end From 73752015e3e8ddb76ad63992fdd353c53c148292 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:09:51 -0700 Subject: [PATCH 237/330] update the readme --- README.md | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index eaa445281..b56eb0225 100644 --- a/README.md +++ b/README.md @@ -60,27 +60,21 @@ Questions Any questions can be sent to blt-dev@llnl.gov. If you are an LLNL employee or collaborator, we have an internal Microsoft Teams group chat named "BLT" as well. -Authors -------- +Contributions +------------- + +We welcome all kinds of contributions: new features, bug fixes, documentation edits. -Developers include: +To contribute, make a [pull request](https://github.com/LLNL/blt/pulls), with `develop` +as the destination branch. We use CI testing and your branch must pass these tests before +being merged. - * Chris White, LLNL - * Kenneth Weiss, LLNL - * David A. Beckingsale, LLNL - * Josh Essman, LLNL - * Cyrus Harrison, LLNL - * George Zagaris, LLNL - * Lee Taylor, LLNL - * Aaron Black, LLNL - * Richard Hornung, LLNL - * Randolph Settgast, LLNL +For more information, see the [contributing guide](https://github.com/LLNL/blt/blob/develop/CONTRIBUTING.md). -Please see our [contributing guide](https://github.com/LLNL/blt/blob/develop/CONTRIBUTING.md) -for details about how to contribute to the project. +Authors +------- -The full list of project contributors can be found on the -[BLT Contributors Page](https://github.com/LLNL/BLT/graphs/contributors). +Thanks to all of BLT's [contributors](https://github.com/LLNL/blt/graphs/contributors). Open-Source Projects using BLT ------------------------------ @@ -91,6 +85,8 @@ Open-Source Projects using BLT * [CARE](https://github.com/LLNL/CARE): CHAI and RAJA extensions * [CHAI](https://github.com/LLNL/CHAI): Copy-hiding array abstraction to automatically migrate data between memory spaces * [Conduit](https://github.com/LLNL/conduit): Simplified data exchange for HPC simulations + * [Comb](https://github.com/LLNL/Comb): Communication performance benchmarking tool + * [ExaCMech](https://github.com/LLNL/ExaCMech): GPU-friendly library of constitutive models * [Kripke](https://github.com/LLNL/Kripke): Simple, scalable, 3D Sn deterministic particle transport code * [RAJA](https://github.com/LLNL/raja): Performance portability layer for HPC * [SAMRAI](https://github.com/LLNL/SAMRAI): Structured Adaptive Mesh Refinement Application Infrastructure @@ -98,6 +94,7 @@ Open-Source Projects using BLT * [Spheral](https://github.com/LLNL/spheral): Steerable parallel environment for performing coupled hydrodynamical & gravitational numerical simulations * [Umpire](https://github.com/LLNL/Umpire): Application-focused API for memory management on NUMA and GPU architectures * [VTK-h](https://github.com/Alpine-DAV/vtk-h): Scientific visualization algorithms for emerging processor architectures + * [WCS](https://github.com/LLNL/wcs): Computational environment for simulating a whole cell model If you would like to add a library to this list, please let us know via [email](mailto:blt-dev@llnl.gov) or by submitting an [issue](https://github.com/LLNL/blt/issues) or [pull-request](https://github.com/LLNL/blt/pulls). From 6af100a21bec047462a2e15471407699c491e335 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:10:10 -0700 Subject: [PATCH 238/330] Update sphinx docs main page --- docs/index.rst | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 70c420b5f..dd6fee465 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,7 +12,7 @@ BLT is a composition of CMake macros and several widely used open source tools assembled to simplify HPC software development. BLT was released by Lawrence Livermore National Laboratory (LLNL) under a BSD-style open source license. -It is developed on github under LLNL's github organization: https://github.com/llnl/blt +It is developed on GitHub under `LLNL's GitHub organization `_. .. note:: BLT officially supports CMake 3.8 and above. However we only print a warning if you @@ -34,7 +34,7 @@ BLT at a Glance * Batteries included - * Built-in support for HPC Basics: MPI, OpenMP, and CUDA + * Built-in support for HPC Basics: MPI, OpenMP, CUDA, and HIP * Built-in support for unit testing in C/C++ and Fortran * Streamlines development processes @@ -44,19 +44,30 @@ BLT at a Glance * Runtime and static analysis, benchmarking -Developers -~~~~~~~~~~ - - * Chris White (white238@llnl.gov) - * Cyrus Harrison (harrison37@llnl.gov) - * George Zagaris (zagaris2@llnl.gov) - * Kenneth Weiss (kweiss@llnl.gov) - * Lee Taylor (taylor16@llnl.gov) - * Aaron Black (black27@llnl.gov) - * David A. Beckingsale (beckingsale1@llnl.gov) - * Richard Hornung (hornung1@llnl.gov) - * Randolph Settgast (settgast1@llnl.gov) - * Peter Robinson (robinson96@llnl.gov) + +Questions +--------- + +Any questions can be sent to blt-dev@llnl.gov. If you are an LLNL employee or collaborator, we have an +internal Microsoft Teams group chat named "BLT" as well. + + +Contributions +------------- + +We welcome all kinds of contributions: new features, bug fixes, documentation edits. + +To contribute, make a `pull request `_, with ``develop`` +as the destination branch. We use CI testing and your branch must pass these tests before +being merged. + +For more information, see the `contributing guide `_. + + +Authors +------- + +Thanks to all of BLT's `contributors `_. Documentation From 34bf110534d12afdf8a33476eb0f9703f2864053 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:10:17 -0700 Subject: [PATCH 239/330] oxford comma --- docs/tutorial/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 33ad851a7..c9ad9b9bd 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -21,7 +21,7 @@ integration. The code is adapted from: https://www.mcs.anl.gov/research/projects/mpi/usingmpi/examples-usingmpi/simplempi/cpi_c.html. The tutorial requires a C++ compiler and CMake, we recommend using CMake 3.8.0 or newer. -Parts of the tutorial also require MPI, CUDA, Sphinx and Doxygen. +Parts of the tutorial also require MPI, CUDA, Sphinx, and Doxygen. .. toctree:: From 422c3743d4c2a4f308eee79c9736ea852c2fff43 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:14:31 -0700 Subject: [PATCH 240/330] Fix inconsistently sized sections headers --- docs/index.rst | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index dd6fee465..178d794fc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,10 +3,8 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -BLT -=== - -**Build, Link, and Test** +BLT: Build, Link, and Test +========================== BLT is a composition of CMake macros and several widely used open source tools assembled to simplify HPC software development. @@ -20,7 +18,7 @@ It is developed on GitHub under `LLNL's GitHub organization `_. -Documentation -~~~~~~~~~~~~~ - .. toctree:: + :Table of Contents: :maxdepth: 2 User Tutorial From 924c946213b9f9c39a900eefe1222ab629e57370 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:17:43 -0700 Subject: [PATCH 241/330] remove another contributor list and directly link github's page --- CONTRIBUTING.md | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 90f60f897..b88232e17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,17 +15,6 @@ The BLT project uses git's commit history to track contributions from individual Since we want everyone to feel they are getting the proper attribution for their contributions, please add your name to the list below as part of your commit. -# Contributors (In Alphabetical Order) - -* Izaak Beekman -* Robert Blake, LLNL -* Jason Burmark, LLNL -* Ben Corbett, LLNL -* Johann Dahm -* Chip Freitag, AMD, Inc. -* Elsa Gonsiorowski, LLNL -* Burl Hall, LLNL -* Matt Larsen, LLNL -* Martin McFadden, LLNL -* Mark Miller, LLNL -* David Poliakoff, Sandia National Laboratories +# Contributors + +Thanks to all of BLT's [contributors](https://github.com/LLNL/blt/graphs/contributors). From 6a536a5dd484f8cebc698389480b9f788149ae9e Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:19:20 -0700 Subject: [PATCH 242/330] Fix toc caption --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 178d794fc..c27da10c4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -69,7 +69,7 @@ Thanks to all of BLT's `contributors From b95043ed4d1572ebbdfb5dd7d8941ba3a3dd8e50 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:22:01 -0700 Subject: [PATCH 243/330] hide link --- docs/tutorial/index.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index c9ad9b9bd..db5da051a 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -17,8 +17,7 @@ This tutorial provides instructions for: The tutorial provides several examples that calculate the value of :math:`\pi` by approximating the integral :math:`f(x) = \int_0^14/(1+x^2)` using numerical -integration. The code is adapted from: -https://www.mcs.anl.gov/research/projects/mpi/usingmpi/examples-usingmpi/simplempi/cpi_c.html. +integration. The code is adapted from ANL `here `_. The tutorial requires a C++ compiler and CMake, we recommend using CMake 3.8.0 or newer. Parts of the tutorial also require MPI, CUDA, Sphinx, and Doxygen. From 3a0d9a123e750952ae769e5048588f8b8972eb13 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:40:07 -0700 Subject: [PATCH 244/330] Fix relative path to root --- docs/CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 7fb4e38c7..a2c5217f6 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -7,16 +7,26 @@ cmake_minimum_required(VERSION 3.8) project( blt_docs ) -############################################################################### +#------------------------------------------------------------------------------ # Setup BLT -############################################################################### +#------------------------------------------------------------------------------ +# Set BLT_SOURCE_DIR to default location, if not set by user if(NOT BLT_SOURCE_DIR) - set(BLT_SOURCE_DIR "blt") + set(BLT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../..") endif() include(${BLT_SOURCE_DIR}/SetupBLT.cmake) +#------------------------------------------------------------------------------ +# Calc PI Tutorial +#------------------------------------------------------------------------------ +add_subdirectory(calc_pi) + +#------------------------------------------------------------------------------ +# Docs +#------------------------------------------------------------------------------ + if (SPHINX_FOUND) blt_add_sphinx_target(blt_sphinx_tutorial_docs) endif() From 6470dbcb612c15c6763183a76f7fd6a053eb58ab Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 17:51:10 -0700 Subject: [PATCH 245/330] Streamline setup blt tutorial page --- docs/tutorial/setup_blt.rst | 54 +++++++++++++++---------------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index e5c2eb2bc..b77c19cd8 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -4,28 +4,19 @@ .. # SPDX-License-Identifier: (BSD-3-Clause) Setup BLT in your CMake Project -================================= +=============================== BLT is easy to include in your CMake project whether it is an existing project or -you are starting from scratch. You simply pull it into your project using a CMake -``include()`` command. +you are starting from scratch. This tutorial assumes you are using git but those +commands can easily changed or ignored. -.. code-block:: cmake - - include(path/to/blt/SetupBLT.cmake) -You can include the BLT source in your repository or pass the location -of BLT at CMake configure time through the optional ``BLT_SOURCE_DIR`` -CMake variable. +Include BLT in your Git Repository +---------------------------------- There are two standard choices for including the BLT source in your repository: -1. Add BLT as a git submodule -2. Copy BLT into a subdirectory in your repository - - -BLT as a Git Submodule --------------------------- +**Add BLT as a git submodule** This example adds BLT as a submodule, commits, and pushes the changes to your repository. @@ -36,8 +27,7 @@ This example adds BLT as a submodule, commits, and pushes the changes to your re git commit -m "Adding BLT" git push -Copy BLT into your repository ------------------------------ +**Copy BLT into a subdirectory in your repository** This example will clone BLT into your repository and remove the unneeded git files from the clone. It then commits and pushes the changes to your @@ -52,8 +42,8 @@ repository. git push -Include BLT in your project ---------------------------- +Include BLT in your CMake Project +--------------------------------- In most projects, including BLT is as simple as including the following CMake line in your base ``CMakeLists.txt`` after your ``project()`` call. @@ -73,15 +63,9 @@ is recommended: :language: cmake This is a robust way of setting up BLT and supports an optional external BLT source -directory. This allows the use of a common BLT across large projects. There are some -helpful error messages if the BLT submodule is missing as well as the commands to solve -it. - -.. note:: - Throughout this tutorial, we pass the path to BLT using ``BLT_SOURCE_DIR`` since - our tutorial is part of the blt repository and we want this project to be - automatically tested using a single clone of our repository. - +directory via the command line option ``BLT_SOURCE_DIR``. This allows the use of a common +BLT across large projects. There are some helpful error messages if the BLT submodule +is missing as well as the commands to solve it. Running CMake @@ -106,6 +90,7 @@ If you are using BLT outside of your project pass the location of BLT as follows cd build cmake -DBLT_SOURCE_DIR="path/to/blt" .. + Example: blank_project ---------------------- @@ -114,8 +99,13 @@ features. It demonstrates the bare minimum required for testing purposes. Here is the entire CMakeLists.txt file for ``blank_project``: -.. literalinclude:: blank_project/CMakeLists.txt - :language: cmake +.. code-block:: cmake + + cmake_minimum_required(VERSION 3.8) + project( blank ) + + include(/path/to/blt/SetupBLT.cmake) + BLT also enforces some best practices for building, such as not allowing in-source builds. This means that BLT prevents you from generating a @@ -126,7 +116,7 @@ For example if you run the following commands: .. code-block:: bash cd /docs/tutorial/blank_project - cmake -DBLT_SOURCE_DIR=../.. + cmake . you will get the following error: @@ -148,7 +138,7 @@ To correctly run cmake, create a build directory and run cmake from there: cd /docs/blank_project mkdir build cd build - cmake -DBLT_SOURCE_DIR=../../.. .. + cmake .. This will generate a configured ``Makefile`` in your build directory to build ``blank_project``. The generated makefile includes gtest and several built-in From 45965424e2df30e13476b37def7b9ed33b22a94d Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 18:10:52 -0700 Subject: [PATCH 246/330] Clarify caveat with object libraries --- docs/api/target.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/api/target.rst b/docs/api/target.rst index cba90146c..17548a3c1 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -215,9 +215,10 @@ object libraries you do not have to use the ``$>`` synt use with BLT macros. Unless you have a good reason don't use Object libraries. .. note:: - BLT Object libraries do not follow CMake's normal transitivity rules. Due to CMake requiring - you install the individual object files if you install the target that uses them. BLT manually - adds the INTERFACE target properties to get around this. + Due to necessary record keeping, BLT Object libraries need to be defined by `blt_add_library` before + they are used in any `DEPENDS_ON` list. They also do not follow CMake's normal transitivity rules. + This is due to CMake requiring you install the individual object files if you install the + target that uses them. BLT manually adds the INTERFACE target properties to get around this. This macro uses the BUILD_SHARED_LIBS, which is defaulted to OFF, to determine whether the library will be built as shared or static. The optional boolean From c3ac9f4b60e556c7015763b732884a4d000c8533 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 19:49:29 -0700 Subject: [PATCH 247/330] Fix casing --- docs/tutorial/setup_blt.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index b77c19cd8..f89cee000 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -179,7 +179,7 @@ If everything went correctly, you should have the following output: Note that the default options for ``blank_project`` only include a single test ``blt_gtest_smoke``. As we will see later on, BLT includes additional smoke tests that are activated when BLT is configured with other options enabled, -like Fortran, MPI, OpenMP, and Cuda. +like Fortran, MPI, OpenMP, and CUDA. Host-configs ------------ From c86c09b45efc7348a2fad65031e5137df4a292f9 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 19:51:08 -0700 Subject: [PATCH 248/330] commas --- docs/tutorial/creating_execs_and_libs.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index 04f5939c5..e4b4ee61e 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -9,14 +9,15 @@ Creating Libraries and Executables ================================== In the previous section, we learned the basics about how to create a CMake -project with BLT, how to configure the project and how to build and test BLT's built-in third party libraries. +project with BLT, how to configure the project and how to build, and test +BLT's built-in third party libraries. We now move on to creating libraries and executables using two of BLT's core macros: ``blt_add_library()`` and ``blt_add_executable()``. -We begin with a simple executable that calculates :math:`\pi` by numerical integration -(``example_1``). We will then extract that code into a library, which we link -into a new executable (``example_2``). +We begin with a simple executable that calculates :math:`\pi` by numerical integration, +``example_1``. We will then extract that code into a library, which we link +into a new executable, ``example_2``. Example 1: Basic executable From 9682eb83cb6db4d651b185405b314e3671b75e38 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 24 Mar 2021 19:57:36 -0700 Subject: [PATCH 249/330] more formatting --- docs/tutorial/creating_execs_and_libs.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index e4b4ee61e..35cbcd264 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -25,6 +25,7 @@ Example 1: Basic executable This example is as basic as it gets. After setting up a BLT CMake project, like ``blank_project`` in the previous section, we can start using BLT's macros. + Creating an executable is as simple as calling the following macro: .. literalinclude:: calc_pi/CMakeLists.txt @@ -32,13 +33,13 @@ Creating an executable is as simple as calling the following macro: :end-before: _blt_tutorial_example_executable_end :language: cmake -This tells CMake to create an executable named ``example_1`` with one source file -(``example_1.cpp``). +This tells CMake to create an executable, named ``example_1``, with one source file, +``example_1.cpp``. You can create this project yourself or you can run the already provided ``tutorial/calc_pi`` project. For ease of use, we have combined many examples -into this one CMake project. After running the following commands, you will -create the executable ``/bin/example_1``: +into this one CMake project. You can create the executable ``/bin/example_1``, +by running the following commands: .. code-block:: bash @@ -85,7 +86,7 @@ created library target: :language: cmake The ``DEPENDS_ON`` parameter properly links the previously defined library -into this executable without any more work or CMake function calls. +into this executable without any more work or extra CMake function calls. .. admonition:: blt_add_library @@ -93,7 +94,7 @@ into this executable without any more work or CMake function calls. This is another core BLT macro. It creates a CMake library target and associates the given sources and headers along with handling dependencies the same way as - ``blt_add_executable`` does. It also provides a few commonly used build options, + ``blt_add_executable()`` does. It also provides a few commonly used build options, such as overriding the output name of the library and the output directory. It defaults to building a static library unless you override it with ``SHARED`` or with the global CMake option ``BUILD_SHARED_LIBS``. @@ -102,7 +103,7 @@ Object Libraries ---------------- BLT has simplified the use of CMake object libraries through the -``blt_add_library`` macro. Object libraries are a collection of object files +``blt_add_library()`` macro. Object libraries are a collection of object files that are not linked or archived into a library. They are used in other libraries or executables through the ``DEPENDS_ON`` macro argument. This is generally useful for combining smaller libraries into a larger library without From 05ee7fcc7e7f7490dc32f0d48a4081a8784b64fc Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 11:12:30 -0700 Subject: [PATCH 250/330] remove more unnecessary options --- docs/tutorial/external_dependencies.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 4669ba325..8f78c2e51 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -252,8 +252,7 @@ Here is how you can use the host-config file to configure a build of the ``calc_ mkdir build cd build # configure using host-config - cmake -C ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake \ - -DBLT_SOURCE_DIR=../../../../blt .. + cmake -C ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake .. After building (``make``), you can run ``make test`` on a batch node (where the GPUs reside) to run the unit tests that are using MPI and CUDA: @@ -296,14 +295,11 @@ enabled on the blue_os Ray cluster: .. code-block:: bash - # load new cmake b/c default on ray is too old - ml cmake # create build dir mkdir build cd build # configure using host-config - cmake -C ../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake \ - -DBLT_SOURCE_DIR=../../../../blt .. + cmake -C ../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake .. And here is how to build and test the code on Ray: From 0ccb8f683583937186677dbb5722836f5966264c Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 11:46:14 -0700 Subject: [PATCH 251/330] Formatting --- docs/tutorial/using_flags.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/tutorial/using_flags.rst b/docs/tutorial/using_flags.rst index ef62320a4..8704a05ce 100644 --- a/docs/tutorial/using_flags.rst +++ b/docs/tutorial/using_flags.rst @@ -3,7 +3,7 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -Portable compiler flags +Portable Compiler Flags ========================= To simplify the development of code that is portable across different architectures @@ -39,7 +39,7 @@ Here is an example for setting the appropriate flag to treat warnings as errors: ) Since values for ``GNU``, ``CLANG`` and ``INTEL`` are not supplied, -they will get the default value (``-Werror``) +they will get the default value, ``-Werror``, which is supplied by the macro's ``DEFAULT`` argument. BLT also provides a simple macro to add compiler flags to a target. @@ -64,6 +64,6 @@ Here is another example to disable warnings about unknown OpenMP pragmas in the MSVC "/wd4068" ) -Note that GNU does not have a way to only disable warnings about openmp pragmas, -so one must disable warnings about all unknown pragmas on this compiler. - +.. note:: + GNU does not have a way to only disable warnings about OpenMP pragmas, + so you must disable warnings about all unknown pragmas on this compiler. From 931ab678c06edd8e89eb03c05811062dd1d91573 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 11:56:07 -0700 Subject: [PATCH 252/330] Formatting and consistency in naming --- docs/tutorial/calc_pi/test_2.cpp | 2 +- docs/tutorial/external_dependencies.rst | 8 +- docs/tutorial/unit_testing.rst | 119 ++++++++++++------------ 3 files changed, 64 insertions(+), 65 deletions(-) diff --git a/docs/tutorial/calc_pi/test_2.cpp b/docs/tutorial/calc_pi/test_2.cpp index 0b6cbaa73..3977aff28 100644 --- a/docs/tutorial/calc_pi/test_2.cpp +++ b/docs/tutorial/calc_pi/test_2.cpp @@ -37,7 +37,7 @@ TEST(calc_pi_mpi, compare_mpi_serial) } // _blt_tutorial_calcpi_test2_main_start -// main driver that allows using mpi w/ google test +// main driver that allows using mpi w/ GoogleTest int main(int argc, char * argv[]) { int result = 0; diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 8f78c2e51..4984a8cb0 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -84,8 +84,8 @@ registered dependency in test_1: ``gtest`` :language: cmake -``gtest`` is the name for the Google Test dependency in BLT registered via -``blt_register_library()``. Even though Google Test is built-in and uses CMake, +``gtest`` is the name for the GoogleTest dependency in BLT registered via +``blt_register_library()``. Even though GoogleTest is built-in and uses CMake, ``blt_register_library()`` allows us to easily set defines needed by all dependent targets. @@ -123,10 +123,10 @@ to launch. We use the ``NUM_MPI_TASKS`` argument to ``blt_add_test()`` macro. :language: cmake -As mentioned in :ref:`UnitTesting`, google test provides a default ``main()`` +As mentioned in :ref:`UnitTesting`, GoogleTest provides a default ``main()`` driver that will execute all unit tests defined in the source. To test MPI code, we need to create a main that initializes and finalizes MPI in addition to Google -Test. ``test_2.cpp`` provides an example driver for MPI with Google Test. +Test. ``test_2.cpp`` provides an example driver for MPI with GoogleTest. .. literalinclude:: calc_pi/test_2.cpp :start-after: _blt_tutorial_calcpi_test2_main_start diff --git a/docs/tutorial/unit_testing.rst b/docs/tutorial/unit_testing.rst index 8eaec0d9b..64e7d1f76 100644 --- a/docs/tutorial/unit_testing.rst +++ b/docs/tutorial/unit_testing.rst @@ -9,15 +9,15 @@ Unit Testing ============ BLT has a built-in copy of the -`Google Test framework (gtest) `_ for C +`GoogleTest framework (gtest) `_ for C and C++ unit tests and the `Fortran Unit Test Framework (FRUIT) `_ for Fortran unit tests. -Each Google Test or FRUIT file may contain multiple tests and is compiled into +Each GoogleTest or FRUIT file may contain multiple tests and is compiled into its own executable that can be run directly or as a ``make`` target. -In this section, we give a brief overview of GTest and discuss how to add unit +In this section, we give a brief overview of GoogleTest and discuss how to add unit tests using the ``blt_add_test()`` macro. @@ -41,10 +41,10 @@ options are available when ``ENABLE_TESTS`` is on: Option to control FRUIT (Default ``ON``). It is only active when ``ENABLE_FORTRAN`` is enabled. -Google Test (C++/C Tests) +GoogleTest (C++/C Tests) -------------------------- -The contents of a typical Google Test file look like this: +The contents of a typical GoogleTest file look like this: .. code:: cpp @@ -66,9 +66,8 @@ The contents of a typical Google Test file look like this: // EXPECT_TRUE(...); } - // Etc. -Each unit test is defined by the Google Test ``TEST()`` macro which accepts a +Each unit test is defined by the GoogleTest ``TEST()`` macro which accepts a *test case name* identifier, such as the name of the C++ class being tested, and a *test name*, which indicates the functionality being verified by the test. Within a test, failure of logical assertions (macros prefixed by ``ASSERT_``) @@ -76,7 +75,7 @@ will cause the test to fail immediately, while failures of expected values (macros prefixed by ``EXPECT_``) will cause the test to fail, but will continue running code within the test. -Note that the Google Test framework will generate a ``main()`` routine for +Note that the GoogleTest framework will generate a ``main()`` routine for each test file if it is not explicitly provided. However, sometimes it is necessary to provide a ``main()`` routine that contains operation to run before or after the unit tests in a file; e.g., initialization code or @@ -84,22 +83,24 @@ pre-/post-processing operations. A ``main()`` routine provided in a test file should be placed at the end of the file in which it resides. -Note that Google Test is initialized before ``MPI_Init()`` is called. +Note that GoogleTest is initialized before ``MPI_Init()`` is called. -Other Google Test features, such as *fixtures* and *mock* objects (gmock) may +Other GoogleTest features, such as *fixtures* and *mock* objects (gmock) may be used as well. -See the `Google Test Primer `_ -for a discussion of Google Test concepts, how to use them, and a listing of +See the `GoogleTest Primer `_ +for a discussion of GoogleTest concepts, how to use them, and a listing of available assertion macros, etc. FRUIT (Fortran Tests) -------------------------- Fortran unit tests using the FRUIT framework are similar in structure to -the Google Test tests for C and C++ described above. +the GoogleTest tests for C and C++ described above. -The contents of a typical FRUIT test file look like this:: +The contents of a typical FRUIT test file look like this: + +.. code-block:: fortran module use iso_c_binding @@ -119,7 +120,6 @@ The contents of a typical FRUIT test file look like this:: ! call assert_true(...) end subroutine test_name_2 - ! Etc. The tests in a FRUIT test file are placed in a Fortran *module* named for the *test case name*, such as the name of the C++ class whose Fortran interface @@ -130,30 +130,32 @@ FRUIT methods. Failure of expected values will cause the test to fail, but other tests will continue to run. Note that each FRUIT test file defines an executable Fortran program. The -program is defined at the end of the test file and is organized as follows:: - - program fortran_test - use fruit - use - implicit none - logical ok - - ! initialize fruit - call init_fruit - - ! run tests - call test_name_1 - call test_name_2 - - ! compile summary and finalize fruit - call fruit_summary - call fruit_finalize - - call is_all_successful(ok) - if (.not. ok) then - call exit(1) - endif - end program fortran_test +program is defined at the end of the test file and is organized as follows: + +.. code-block:: fortran + + program fortran_test + use fruit + use + implicit none + logical ok + + ! initialize fruit + call init_fruit + + ! run tests + call test_name_1 + call test_name_2 + + ! compile summary and finalize fruit + call fruit_summary + call fruit_finalize + + call is_all_successful(ok) + if (.not. ok) then + call exit(1) + endif + end program fortran_test Please refer to the `FRUIT documentation `_ for more information. @@ -178,7 +180,7 @@ Returning to our running example (see :ref:`AddTarget`), let's add a simple test for the ``calc_pi`` library, which has a single function with signature: - .. code-block:: cpp +.. code-block:: cpp double calc_pi(int num_intervals); @@ -207,15 +209,12 @@ We then register this executable as a test: :end-before: _blt_tutorial_calcpi_test1_test_end :language: cmake -.. Hide these for now until we bring into an example -.. .. note:: -.. The ``COMMAND`` parameter can be used to pass arguments into a test executable. -.. This feature is not exercised in this example. -.. -.. .. note:: -.. The ``NAME`` of the test can be different from the test executable, -.. which is passed in through the ``COMMAND`` parameter. -.. This feature is not exercised in this example. +.. note:: + The ``COMMAND`` parameter can be used to pass arguments into a test executable. + +.. note:: + The ``NAME`` of the test can be different from the test executable, + which is passed in through the ``COMMAND`` parameter. Running tests and examples @@ -237,17 +236,17 @@ you are modifying or adding code and need to understand how unit test details are working, for example. .. note:: - You can pass arguments to ctest via the ``TEST_ARGS`` parameter, e.g. - ``make test TEST_ARGS="..."`` - Useful arguments include: - - -R - Regular expression filtering of tests. - E.g. ``-R foo`` only runs tests whose names contain ``foo`` - -j - Run tests in parallel, E.g. ``-j 16`` will run tests using 16 processors - -VV - (Very verbose) Dump test output to stdout + You can pass arguments to ctest via the ``TEST_ARGS`` parameter, e.g. + ``make test TEST_ARGS="..."`` + Useful arguments include: + + -R + Regular expression filtering of tests. + E.g. ``-R foo`` only runs tests whose names contain ``foo`` + -j + Run tests in parallel, E.g. ``-j 16`` will run tests using 16 processors + -VV + (Very verbose) Dump test output to stdout Converting CTest XML to JUnit From 881e90ef0bd47fc60b1def779239714b4fa27e7b Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 12:41:25 -0700 Subject: [PATCH 253/330] Avoid scroll bar --- host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake index 3c0b90498..83e3ef980 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake @@ -49,7 +49,8 @@ set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "") set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") set(_cuda_arch "sm_${CMAKE_CUDA_ARCHITECTURES}") -set(CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-lambda -G" CACHE STRING "") +set(CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-lambda -G" + CACHE STRING "") set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") From fac59b62913a770360e0581602f8203503d75ce6 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 12:53:41 -0700 Subject: [PATCH 254/330] slight formatting and fixing links --- docs/tutorial/creating_execs_and_libs.rst | 2 +- docs/tutorial/exporting_blt_targets.rst | 2 ++ docs/tutorial/external_dependencies.rst | 33 +++++++++-------------- docs/tutorial/unit_testing.rst | 2 +- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index 35cbcd264..cf8d72425 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -3,7 +3,7 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -.. _AddTarget: +.. _CreatingLibrariesAndExecutables: Creating Libraries and Executables ================================== diff --git a/docs/tutorial/exporting_blt_targets.rst b/docs/tutorial/exporting_blt_targets.rst index 5478b2944..00328e7ca 100644 --- a/docs/tutorial/exporting_blt_targets.rst +++ b/docs/tutorial/exporting_blt_targets.rst @@ -3,6 +3,8 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) +.. _ExportingBLTCreatedTargets: + Exporting BLT Created Targets ============================= diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 4984a8cb0..5d25170ab 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -32,7 +32,7 @@ For example, to find and add the external dependency *axom* as a CMake target, y LIBRARIES ${AXOM_LIBRARIES} EXPORTABLE ON) -Then *axom* is available to be used in the DEPENDS_ON list in the following +Then ``axom`` is available to be used in the ``DEPENDS_ON`` list in the following ``blt_add_executable()`` or ``blt_add_library()`` calls, or in any CMake command that accepts a target. CMake targets created by ``blt_import_library()`` are ``INTERFACE`` libraries that can be installed @@ -48,9 +48,10 @@ BLT also supports using ``blt_register_library()`` to provide additional options The implementation doesn't modify the properties of the existing targets, it just exposes these options via BLT's support for ``DEPENDS_ON``. -This first-class importing functionality provided by ``blt_import_library()`` should be preferred, but ``blt_register_library()`` is -still available for compatibility. ``blt_import_library()`` is generally usable as a drop-in replacement, -though it does not support the creation of targets with the same name as a target that already exists. +This first-class importing functionality provided by ``blt_import_library()`` should be preferred, +but ``blt_register_library()`` is still available for compatibility. ``blt_import_library()`` +is generally usable as a drop-in replacement, though it does not support the creation of targets +with the same name as a target that already exists. .. note:: Because CMake targets are only accessible from within the directory they were defined (including @@ -59,21 +60,13 @@ though it does not support the creation of targets with the same name as a targe can also be used to manage visibility. BLT's ``mpi``, ``cuda``, ``cuda_runtime``, and ``openmp`` targets are all defined via ``blt_import_library()``. -You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. If your project exports targets and you would like -BLT's provided third-party targets to also be exported (for example, if a project that imports your project does not -use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other EXPORTABLE targets created by -``blt_import_library()``, these targets should be prefixed with the name of the project. Either the ``EXPORT_NAME`` -target property or the ``NAMESPACE`` option to CMake's ``install`` command can be used to modify the name of an -installed target. See the "Exporting BLT Targets" page for more info. - - -.. admonition:: blt_register_library - :class: hint - - A macro to register external libraries and dependencies with BLT. - The named target can be added to the ``DEPENDS_ON`` argument of other BLT macros, - like ``blt_add_library()`` and ``blt_add_executable()``. - +You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. If your project exports targets and you +would like BLT's provided third-party targets to also be exported (for example, if a project that imports +your project does not use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other +EXPORTABLE targets created by ``blt_import_library()``, these targets should be prefixed with the name of +the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` +command can be used to modify the name of an installed target. See :ref:`ExportingBLTCreatedTargetsE:` +for more info. You have already seen one use of ``DEPENDS_ON`` for a BLT registered dependency in test_1: ``gtest`` @@ -291,7 +284,7 @@ Building and testing on Ray ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA -enabled on the blue_os Ray cluster: +enabled on the LLNL BlueOS Ray cluster: .. code-block:: bash diff --git a/docs/tutorial/unit_testing.rst b/docs/tutorial/unit_testing.rst index 64e7d1f76..55d7f6591 100644 --- a/docs/tutorial/unit_testing.rst +++ b/docs/tutorial/unit_testing.rst @@ -176,7 +176,7 @@ by first generating an executable for the test using the and allows users to pass in command line arguments. -Returning to our running example (see :ref:`AddTarget`), +Returning to our running example (see :ref:`CreatingLibrariesAndExecutables:`), let's add a simple test for the ``calc_pi`` library, which has a single function with signature: From 2f68a63992d5918b232ba1127f568379747730df Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 12:57:24 -0700 Subject: [PATCH 255/330] Fix typo --- docs/tutorial/external_dependencies.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 5d25170ab..76cf6a0e3 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -65,7 +65,7 @@ would like BLT's provided third-party targets to also be exported (for example, your project does not use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other EXPORTABLE targets created by ``blt_import_library()``, these targets should be prefixed with the name of the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` -command can be used to modify the name of an installed target. See :ref:`ExportingBLTCreatedTargetsE:` +command can be used to modify the name of an installed target. See :ref:`ExportingBLTCreatedTargets:` for more info. You have already seen one use of ``DEPENDS_ON`` for a BLT From 05febcaf6e87770e0f7b4ec78e2d98ef1cbdaa77 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 13:09:03 -0700 Subject: [PATCH 256/330] nitpick --- docs/tutorial/external_dependencies.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 76cf6a0e3..e3e1e838f 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -170,7 +170,7 @@ Here, you can see how ``calc_pi_cuda`` and ``test_3`` use ``DEPENDS_ON``: The ``cuda`` dependency for ``calc_pi_cuda`` is a little special, along with adding the normal CUDA library and headers to your library or executable, -it also tells BLT that this target's C/CXX/CUDA source files need to be compiled via +it also tells BLT that this target's C/C++/CUDA source files need to be compiled via ``nvcc`` or ``cuda-clang``. If this is not a requirement, you can use the dependency ``cuda_runtime`` which also adds the CUDA runtime library and headers but will not compile each source file with ``nvcc``. From 0e0437558af3e4031fa0e7c258eb50a6fdaaef9e Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 13:33:28 -0700 Subject: [PATCH 257/330] Consistency --- docs/tutorial/creating_documentation.rst | 22 ++++++++-------------- docs/tutorial/external_dependencies.rst | 16 +++++++++------- docs/tutorial/recommendations.rst | 6 +++--- docs/tutorial/setup_blt.rst | 2 ++ docs/tutorial/unit_testing.rst | 8 ++++---- docs/tutorial/using_flags.rst | 4 +++- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/tutorial/creating_documentation.rst b/docs/tutorial/creating_documentation.rst index 247ad1577..c4a08976a 100644 --- a/docs/tutorial/creating_documentation.rst +++ b/docs/tutorial/creating_documentation.rst @@ -3,6 +3,8 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) +.. _CreatingDocumentation: + Creating Documentation ====================== @@ -34,7 +36,7 @@ The ``calc_pi`` example provides examples of both Sphinx and Doxygen documentati Calc Pi Sphinx Example -~~~~~~~~~~~~~~~~~~~~~~~~~ +---------------------- Sphinx is a python package that depends on several other packages. It can be installed via `spack `_, pip, anaconda, etc... @@ -69,7 +71,7 @@ Here is the example reStructuredText file that contains documentation for the *c Calc Pi Doxygen Example -~~~~~~~~~~~~~~~~~~~~~~~~~ +----------------------- Doxygen is a compiled executable that can be installed via spack, built-by-hand, etc... @@ -100,10 +102,8 @@ Here is the example ``Doxyfile.in`` file that is configured by CMake and passed :language: rst - Building the Calc Pi Example Documentation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - +------------------------------------------ Here is an example of building both the calc_pi Sphinx and Doxygen docs using the ``docs`` CMake target: @@ -128,13 +128,7 @@ Here is an example of building both the calc_pi Sphinx and Doxygen docs using th [100%] Built target docs +After this your local build directory will contain the following for viewing: - -After this, you can view the Sphinx docs at: - -* ``build-calc-pi/docs/sphinx/html/index.html`` - -and the Doxygen docs at: - -* ``build-calc-pi/docs/doxygen/html/index.html`` - +* Sphinx: ``build-calc-pi/docs/sphinx/html/index.html`` +* Doxygen: ``build-calc-pi/docs/doxygen/html/index.html`` diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index e3e1e838f..df027a6e7 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -3,6 +3,8 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) +.. _ExternalDependencies: + External Dependencies ===================== @@ -84,7 +86,7 @@ targets. MPI Example -~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~ Our next example, ``test_2``, builds and tests the ``calc_pi_mpi`` library, which uses MPI to parallelize the calculation over the integration intervals. @@ -142,7 +144,7 @@ Test. ``test_2.cpp`` provides an example driver for MPI with GoogleTest. CUDA Example -~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~ Finally, ``test_3`` builds and tests the ``calc_pi_cuda`` library, which uses CUDA to parallelize the calculation over the integration intervals. @@ -217,7 +219,7 @@ Here is an example of how to add an OpenMP enabled test that sets the amount of Example Host-configs -~~~~~~~~~~~~~~~~~~~~ +-------------------- Here are the full example host-config files that use gcc 4.9.3 for LLNL's Pascal, Ray, and Quartz Clusters. @@ -234,8 +236,8 @@ Here is a full example host-config file for an OSX laptop, using a set of depend :download:`darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake <../../host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake>` -Building and testing on Pascal -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Building and Testing on Pascal +------------------------------ Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA enabled on Pascal: @@ -280,8 +282,8 @@ to run the unit tests that are using MPI and CUDA: Total Test time (real) = 6.80 sec -Building and testing on Ray -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Building and Testing on Ray +--------------------------- Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA enabled on the LLNL BlueOS Ray cluster: diff --git a/docs/tutorial/recommendations.rst b/docs/tutorial/recommendations.rst index 5452e81d8..12acfb4fc 100644 --- a/docs/tutorial/recommendations.rst +++ b/docs/tutorial/recommendations.rst @@ -3,10 +3,10 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -.. _Recommendations: +.. _CMakeRecommendations: -CMake Recommendations -====================== +CMake Recommendations +===================== This section includes several recommendations for how to wield CMake. Some of them are embodied in BLT, others are broader suggestions for CMake bliss. diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index f89cee000..50a5d2cb2 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -3,6 +3,8 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) +.. _SetupBLTInYourCMakeProject: + Setup BLT in your CMake Project =============================== diff --git a/docs/tutorial/unit_testing.rst b/docs/tutorial/unit_testing.rst index 55d7f6591..cbd039adb 100644 --- a/docs/tutorial/unit_testing.rst +++ b/docs/tutorial/unit_testing.rst @@ -41,8 +41,8 @@ options are available when ``ENABLE_TESTS`` is on: Option to control FRUIT (Default ``ON``). It is only active when ``ENABLE_FORTRAN`` is enabled. -GoogleTest (C++/C Tests) --------------------------- +GoogleTest (C/C++ Tests) +------------------------ The contents of a typical GoogleTest file look like this: @@ -93,7 +93,7 @@ for a discussion of GoogleTest concepts, how to use them, and a listing of available assertion macros, etc. FRUIT (Fortran Tests) --------------------------- +--------------------- Fortran unit tests using the FRUIT framework are similar in structure to the GoogleTest tests for C and C++ described above. @@ -217,7 +217,7 @@ We then register this executable as a test: which is passed in through the ``COMMAND`` parameter. -Running tests and examples +Running Tests and Examples -------------------------- To run the tests, type the following command in the build directory: diff --git a/docs/tutorial/using_flags.rst b/docs/tutorial/using_flags.rst index 8704a05ce..a058c9953 100644 --- a/docs/tutorial/using_flags.rst +++ b/docs/tutorial/using_flags.rst @@ -3,8 +3,10 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) +.. _PortabltCompilerFlags: + Portable Compiler Flags -========================= +======================= To simplify the development of code that is portable across different architectures and compilers, BLT provides the ``blt_append_custom_compiler_flag()`` macro, From 985caf9cf5afb677e674f4e0fb1cdc8f5f687b0f Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 13:45:57 -0700 Subject: [PATCH 258/330] Make sections stand out more --- docs/tutorial/recommendations.rst | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/docs/tutorial/recommendations.rst b/docs/tutorial/recommendations.rst index 12acfb4fc..82b53c4e3 100644 --- a/docs/tutorial/recommendations.rst +++ b/docs/tutorial/recommendations.rst @@ -12,24 +12,26 @@ This section includes several recommendations for how to wield CMake. Some of them are embodied in BLT, others are broader suggestions for CMake bliss. -.. rubric:: Disable in-source builds +Disable In-source Builds +------------------------ *BLT Enforces This* - In-source builds clutter source code with temporary build files and prevent other out-of-source builds from being created. Disabling in-source builds avoids clutter and accidental checkins of temporary build files. -.. rubric:: Avoid using globs to identify source files + +Avoid using Globs to Identify Source Files +------------------------------------------ Globs are evaluated at CMake configure time - not build time. This means CMake will not detect new source files when they are added to the file system unless there are other changes that trigger CMake to reconfigure. -The CMake documentation also warns against this: -https://cmake.org/cmake/help/v3.10/command/file.html?highlight=glob#file +The CMake documentation also warns against `this `_. -.. rubric:: Use arguments instead of options in CMake Macros and Functions +Use Arguments instead of Options in CMake Macros and Functions +-------------------------------------------------------------- ``CMAKE_PARSE_ARGUMENTS`` allows Macros or Functions to support options. Options are enabled by passing them by name when calling a Macro or Function. Because of this, wrapping an existing Macro or Function in a way @@ -56,25 +58,30 @@ To simplify calling logic, we recommend using an argument instead of an option. my_function(arg1 arg2 arg3 ${arg4_value}) -.. rubric:: Prefer explicit paths to locate third-party dependencies +Prefer Explicit Paths to Locate Third-party Dependencies +-------------------------------------------------------- Require passing explicit paths (ex: ``ZZZ_DIR``) for third-party dependency locations. This avoids surprises with incompatible installs sprinkled in various system locations. If you are using off-the-shelf *FindZZZ* logic, also consider adding CMake checks to verify that *FindZZZ* logic actually found the dependencies at the location specified. -.. rubric:: Emit a configure error if an explicitly identified third-party dependency is not found or an incorrect version is found. -If an explicit path to a dependency is given (ex: ``ZZZ_DIR``) it should be valid or result in a CMake configure error. +Error at Configure Time for Third-party Dependency Problems +----------------------------------------------------------- + +Emit a configure error if an explicitly identified third-party dependency is not found or an incorrect +version is found. If an explicit path to a dependency is given (ex: ``ZZZ_DIR``) it should be valid or result in a CMake configure error. -In contrast, if you only issue a warning and automatically disable a feature when a third-party dependency is bad, -the warning often goes unnoticed and may not be caught until folks using your software are surprised. +In contrast, if you only issue a warning and automatically disable a feature when a third-party dependency +is bad, the warning often goes unnoticed and may not be caught until folks using your software are surprised. Emitting a configure error stops CMake and draws attention to the fact that something is wrong. Optional dependencies are still supported by including them only if an explicit path to the dependency is provided (ex: ``ZZZ_DIR``). -.. rubric:: Add headers as source files to targets +Add Headers as Source Files to Targets +-------------------------------------- *BLT Macros Support This* @@ -82,7 +89,8 @@ This ensures headers are tracked as dependencies and are included in the project created by CMake's IDE generators, like Xcode or Eclipse. -.. rubric:: Always support `make install` +Always Support `make install` +----------------------------- This allows CMake to do the right thing based on ``CMAKE_INSTALL_PREFIX``, and also helps support CPack create release packages. This is especially important for libraries. From c414c24e30f16c1f958cec1fc08c17a6eacf9153 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 13:53:45 -0700 Subject: [PATCH 259/330] Update link --- docs/tutorial/recommendations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/recommendations.rst b/docs/tutorial/recommendations.rst index 82b53c4e3..cea3947bf 100644 --- a/docs/tutorial/recommendations.rst +++ b/docs/tutorial/recommendations.rst @@ -27,7 +27,7 @@ Avoid using Globs to Identify Source Files Globs are evaluated at CMake configure time - not build time. This means CMake will not detect new source files when they are added to the file system unless there are other changes that trigger CMake to reconfigure. -The CMake documentation also warns against `this `_. +The CMake documentation also warns against `this `_. Use Arguments instead of Options in CMake Macros and Functions From 9bc753319c0a6c148741436ded2df40a6f806db6 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 14:01:51 -0700 Subject: [PATCH 260/330] Consistency --- docs/api/code_check.rst | 95 +++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index a5b5e205b..376ca5c02 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -52,19 +52,19 @@ CLANGQUERY_CHECKER_DIRECTORIES List of directories where clang-query's checkers are located The purpose of this macro is to enable all code checks in the default manner. It runs -all code checks from the working directory `CMAKE_BINARY_DIR`. If you need more specific +all code checks from the working directory ``CMAKE_BINARY_DIR``. If you need more specific functionality you will need to call the individual code check macros yourself. .. note:: For library projects that may be included as a subproject of another code via CMake's - add_subproject(), we recommend guarding "code check" targets against being included in - other codes. The following check `if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")` + ``add_subproject()``, we recommend guarding "code check" targets against being included in + other codes. The following check ``if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")`` will stop your code checks from running unless you are the main CMake project. Sources are filtered based on file extensions for use in these code checks. If you need additional file extensions defined add them to -BLT_C_FILE_EXTS, BLT_Python_FILE_EXTS, BLT_CMAKE_FILE_EXTS, and -BLT_Fortran_FILE_EXTS. Currently this macro only has code checks for +``BLT_C_FILE_EXTS``, ``BLT_Python_FILE_EXTS``, ``BLT_CMAKE_FILE_EXTS``, and +``BLT_Fortran_FILE_EXTS``. Currently this macro only has code checks for C/C++ and Python; it simply filters out the Fortran files. This macro supports C/C++ code formatting with either AStyle, ClangFormat, or Uncrustify @@ -72,18 +72,18 @@ This macro supports C/C++ code formatting with either AStyle, ClangFormat, or Un - AStyle - * ASTYLE_CFG_FILE is given - * ASTYLE_EXECUTABLE is defined and found prior to calling this macro + * ``ASTYLE_CFG_FILE`` is given + * ``ASTYLE_EXECUTABLE`` is defined and found prior to calling this macro - ClangFormat - * CLANGFORMAT_CFG_FILE is given - * CLANGFORMAT_EXECUTABLE is defined and found prior to calling this macro + * ``CLANGFORMAT_CFG_FILE`` is given + * ``CLANGFORMAT_EXECUTABLE`` is defined and found prior to calling this macro - Uncrustify - * UNCRUSTIFY_CFG_FILE is given - * UNCRUSTIFY_EXECUTABLE is defined and found prior to calling this macro + * ``UNCRUSTIFY_CFG_FILE`` is given + * ``UNCRUSTIFY_EXECUTABLE`` is defined and found prior to calling this macro .. note:: ClangFormat does not support a command line option for config files. To work around this, @@ -92,18 +92,18 @@ This macro supports C/C++ code formatting with either AStyle, ClangFormat, or Un This macro also supports Python code formatting with Yapf only if the following requirements are met: -* YAPF_CFG_FILE is given -* YAPF_EXECUTABLE is defined and found prior to calling this macro +* ``YAPF_CFG_FILE`` is given +* ``YAPF_EXECUTABLE`` is defined and found prior to calling this macro This macro also supports CMake code formatting with CMakeFormat only if the following requirements are met: -* CMAKEFORMAT_CFG_FILE is given -* CMAKEFORMAT_EXECUTABLE is defined and found prior to calling this macro +* ``CMAKEFORMAT_CFG_FILE`` is given +* ``CMAKEFORMAT_EXECUTABLE`` is defined and found prior to calling this macro -Enabled code formatting checks produce a `check` build target that will test to see if you -are out of compliance with your code formatting and a `style` build target that will actually +Enabled code formatting checks produce a ``check`` build target that will test to see if you +are out of compliance with your code formatting and a ``style`` build target that will actually modify your source files. It also creates smaller child build targets that follow the pattern -`__`. +``__``. If a particular version of a code formatting tool is required, you can configure BLT to enforce that version by setting @@ -121,20 +121,20 @@ This macro supports the following static analysis tools with their requirements: - CppCheck - * CPPCHECK_EXECUTABLE is defined and found prior to calling this macro - * CPPCHECK_FLAGS added to the cppcheck command line before the sources + * ``CPPCHECK_EXECUTABLE`` is defined and found prior to calling this macro + * ``CPPCHECK_FLAGS`` added to the cppcheck command line before the sources - Clang-Query - * CLANGQUERY_EXECUTABLE is defined and found prior to calling this macro - * CLANGQUERY_CHECKER_DIRECTORIES parameter given or BLT_CLANGQUERY_CHECKER_DIRECTORIES is defined + * ``CLANGQUERY_EXECUTABLE`` is defined and found prior to calling this macro + * ``CLANGQUERY_CHECKER_DIRECTORIES`` parameter given or ``BLT_CLANGQUERY_CHECKER_DIRECTORIES`` is defined - clang-tidy - * CLANGTIDY_EXECUTABLE is defined and found prior to calling this macro + * ``CLANGTIDY_EXECUTABLE`` is defined and found prior to calling this macro -These are added as children to the `check` build target and produce child build targets -that follow the pattern `__check`. +These are added as children to the ``check`` build target and produce child build targets +that follow the pattern ``__check``. blt_add_clang_query_target ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -177,9 +177,9 @@ coding standards and rules on your source code. A good primer on how to use cla found `here `_. A list of checker directories is required for clang-query, this can be defined either by -the parameter CHECKER_DIRECTORIES or the variable BLT_CLANGQUERY_CHECKER_DIRECTORIES. +the parameter ``CHECKER_DIRECTORIES`` or the variable ``BLT_CLANGQUERY_CHECKER_DIRECTORIES``. -Turning on DIE_ON_MATCH is useful if you're using this in CI to enforce rules about your code. +Turning on ``DIE_ON_MATCH`` is useful if you're using this in CI to enforce rules about your code. CHECKERS are the static analysis passes to specifically run on the target. The following checker options can be given: @@ -308,13 +308,13 @@ SRC_FILES AStyle is a Source Code Beautifier for C/C++ code. More information about AStyle can be found `here `_. -When MODIFY_FILES is set to TRUE, modifies the files in place and adds the created build +When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build target to the parent `style` build target. Otherwise the files are not modified and the -created target is added to the parent `check` build target. This target will notify you +created target is added to the parent ``check`` build target. This target will notify you which files do not conform to your style guide. .. Note:: - Setting MODIFY_FILES to FALSE is only supported in AStyle v2.05 or greater. + Setting ``MODIFY_FILES`` to ``FALSE`` is only supported in AStyle v2.05 or greater. blt_add_clangformat_target @@ -360,24 +360,24 @@ SRC_FILES ClangFormat is a Source Code Beautifier for C/C++ code. More information about ClangFormat can be found `here `_. -When MODIFY_FILES is set to TRUE, modifies the files in place and adds the created build -target to the parent `style` build target. Otherwise the files are not modified and the +When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build +target to the parent ``style`` build target. Otherwise the files are not modified and the created target is added to the parent `check` build target. This target will notify you which files do not conform to your style guide. .. note:: ClangFormat does not support a command line option for config files. To work around this, we copy the given config file to the given working directory. We recommend using the build - directory `${PROJECT_BINARY_DIR}`. Also if someone is directly including your CMake project + directory ``${PROJECT_BINARY_DIR}``. Also if someone is directly including your CMake project in theirs, you may conflict with theirs. We recommend guarding your code checks against this - with the following check `if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")`. + with the following check ``if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")``. .. note:: - ClangFormat does not support a command line option for check (--dry-run) until version 10. + ClangFormat does not support a command line option for check ``--dry-run`` until version 10. This version is not widely used or available at this time. To work around this, we use an - included script called run-clang-format.py that does not use PREPEND_FLAGS or APPEND_FLAGS - in the `check` build target because the script does not support command line flags passed - to `clang-format`. This script is not used in the `style` build target. + included script called ``run-clang-format.py`` that does not use ``PREPEND_FLAGS`` or ``APPEND_FLAGS`` + in the ``check`` build target because the script does not support command line flags passed + to ``clang-format``. This script is not used in the ``style`` build target. blt_add_uncrustify_target ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -422,12 +422,13 @@ SRC_FILES Uncrustify is a Source Code Beautifier for C/C++ code. More information about Uncrustify can be found `here `_. -When MODIFY_FILES is set to TRUE, modifies the files in place and adds the created build -target to the parent `style` build target. Otherwise the files are not modified and the -created target is added to the parent `check` build target. This target will notify you +When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build +target to the parent ``style`` build target. Otherwise the files are not modified and the +created target is added to the parent ``check`` build target. This target will notify you which files do not conform to your style guide. + .. Note:: - Setting MODIFY_FILES to FALSE is only supported in Uncrustify v0.61 or greater. + Setting ``MODIFY_FILES`` to ``FALSE`` is only supported in Uncrustify v0.61 or greater. blt_add_yapf_target @@ -473,9 +474,9 @@ SRC_FILES Yapf is a Source Code Beautifier for Python code. More information about Yapf can be found `here `_. -When MODIFY_FILES is set to TRUE, modifies the files in place and adds the created build -target to the parent `style` build target. Otherwise the files are not modified and the -created target is added to the parent `check` build target. This target will notify you +When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build +target to the parent ``style`` build target. Otherwise the files are not modified and the +created target is added to the parent ``check`` build target. This target will notify you which files do not conform to your style guide. @@ -522,7 +523,7 @@ SRC_FILES CMakeFormat is a Source Code Beautifier for CMake code. More information about CMakeFormat can be found `here `_. -When MODIFY_FILES is set to TRUE, modifies the files in place and adds the created build -target to the parent `style` build target. Otherwise the files are not modified and the +When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build +target to the parent ``style`` build target. Otherwise the files are not modified and the created target is added to the parent `check` build target. This target will notify you which files do not conform to your style guide. From 71d779b159d4f08a9e4a1ca78795c3738bec9b75 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 14:40:00 -0700 Subject: [PATCH 261/330] Consistency over API docs --- docs/api/code_check.rst | 28 ++++++++-- docs/api/code_metric.rst | 2 + docs/api/documentation.rst | 21 ++++---- docs/api/git.rst | 57 +++++++++++--------- docs/api/target.rst | 98 ++++++++++++++++++---------------- docs/api/target_properties.rst | 69 +++++++++++++----------- docs/api/utility.rst | 33 +++++++----- 7 files changed, 184 insertions(+), 124 deletions(-) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 376ca5c02..a6fe3494d 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -6,6 +6,8 @@ Code Check Macros ================== +.. _blt_add_code_checks: + blt_add_code_checks ~~~~~~~~~~~~~~~~~~~ @@ -136,6 +138,9 @@ This macro supports the following static analysis tools with their requirements: These are added as children to the ``check`` build target and produce child build targets that follow the pattern ``__check``. + +.. _blt_add_clang_query_target: + blt_add_clang_query_target ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -181,14 +186,16 @@ the parameter ``CHECKER_DIRECTORIES`` or the variable ``BLT_CLANGQUERY_CHECKER_D Turning on ``DIE_ON_MATCH`` is useful if you're using this in CI to enforce rules about your code. -CHECKERS are the static analysis passes to specifically run on the target. The following checker options -can be given: +``CHECKERS`` are the static analysis passes to specifically run on the target. The following checker +options can be given: * (no value) : run all available static analysis checks found * (checker1:checker2) : run checker1 and checker2 * (interpreter) : run the clang-query interpeter to interactively develop queries +.. _blt_add_cppcheck_target: + blt_add_cppcheck_target ~~~~~~~~~~~~~~~~~~~~~~~ @@ -225,6 +232,8 @@ Cppcheck is a static analysis tool for C/C++ code. More information about Cppcheck can be found `here `_. +.. _blt_add_clang_tidy_target: + blt_add_clang_tidy_target ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -249,7 +258,7 @@ COMMENT Comment prepended to the build target output CHECKS - list of checks to be run on the selected source files, available checks are listed + List of checks to be run on the selected source files, available checks are listed `here `_. FIX @@ -261,10 +270,12 @@ SRC_FILES Clang-tidy is a tool used for diagnosing and fixing typical programming errors. It is useful for enforcing coding standards and rules on your source code. Clang-tidy is documented `here `_. -CHECKS are the static analysis "rules" to specifically run on the target. +``CHECKS`` are the static analysis "rules" to specifically run on the target. If no checks are specified, clang-tidy will run the default available static analysis checks. +.. _blt_add_astyle_target: + blt_add_astyle_target ~~~~~~~~~~~~~~~~~~~~~ @@ -317,6 +328,8 @@ which files do not conform to your style guide. Setting ``MODIFY_FILES`` to ``FALSE`` is only supported in AStyle v2.05 or greater. +.. _blt_add_clangformat_target: + blt_add_clangformat_target ~~~~~~~~~~~~~~~~~~~~~ @@ -379,6 +392,9 @@ which files do not conform to your style guide. in the ``check`` build target because the script does not support command line flags passed to ``clang-format``. This script is not used in the ``style`` build target. + +.. _blt_add_uncrustify_target: + blt_add_uncrustify_target ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -431,6 +447,8 @@ which files do not conform to your style guide. Setting ``MODIFY_FILES`` to ``FALSE`` is only supported in Uncrustify v0.61 or greater. +.. _blt_add_yapf_target: + blt_add_yapf_target ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -480,6 +498,8 @@ created target is added to the parent ``check`` build target. This target will n which files do not conform to your style guide. +.. _blt_add_cmake_format_target: + blt_add_cmakeformat_target ~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/api/code_metric.rst b/docs/api/code_metric.rst index e6eeed882..6753b7808 100644 --- a/docs/api/code_metric.rst +++ b/docs/api/code_metric.rst @@ -6,6 +6,8 @@ Code Metric Macros ================== +.. _blt_add_code_coverage_target: + blt_add_code_coverage_target ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/api/documentation.rst b/docs/api/documentation.rst index e027a6c61..441e9318c 100644 --- a/docs/api/documentation.rst +++ b/docs/api/documentation.rst @@ -6,6 +6,7 @@ Documenation Macros =================== +.. _blt_add_doxygen_target: blt_add_doxygen_target ~~~~~~~~~~~~~~~~~~~~~~ @@ -14,14 +15,16 @@ blt_add_doxygen_target blt_add_doxygen_target(doxygen_target_name) -Creates a build target for invoking doxygen to generate docs. Expects to -find a Doxyfile.in in the directory the macro is called in. +Creates a build target for invoking Doxygen to generate docs. Expects to +find a ``Doxyfile.in`` in the directory the macro is called in. This macro sets up the doxygen paths so that the doc builds happen out of source. For ``make install``, this will place the resulting docs in -docs/doxygen/. +``docs/doxygen/``. +.. _blt_add_sphinx_target: + blt_add_sphinx_target ~~~~~~~~~~~~~~~~~~~~~ @@ -29,16 +32,16 @@ blt_add_sphinx_target blt_add_sphinx_target(sphinx_target_name) -Creates a build target for invoking sphinx to generate docs. Expects -to find a conf.py or conf.py.in in the directory the macro is called +Creates a build target for invoking Sphinx to generate docs. Expects +to find a ``conf.py`` or ``conf.py.in`` in the directory the macro is called in. Requires that a CMake variable named ``SPHINX_EXECUTABLE`` contains the path to the ``sphinx-build`` executable. -If conf.py is found, it is directly used as input to sphinx. +If ``conf.py`` is found, it is directly used as input to Sphinx. -If conf.py.in is found, this macro uses CMake's configure_file() command -to generate a conf.py, which is then used as input to sphinx. +If ``conf.py.in`` is found, this macro uses CMake's ``configure_file()`` command +to generate a ``conf.py``, which is then used as input to Sphinx. This macro sets up the sphinx paths so that the doc builds happen out of source. For ``make install``, this will place the resulting docs in -docs/sphinx/. +``docs/sphinx/``. diff --git a/docs/api/git.rst b/docs/api/git.rst index 8fcb4c6d7..d5afd775a 100644 --- a/docs/api/git.rst +++ b/docs/api/git.rst @@ -6,6 +6,7 @@ Git Macros ========== +.. _blt_git: blt_git ~~~~~~~ @@ -20,23 +21,23 @@ blt_git Runs the supplied git command on the given Git repository. -This macro runs the user-supplied Git command, given by GIT_COMMAND, on the -given Git repository corresponding to SOURCE_DIR. The supplied GIT_COMMAND +This macro runs the user-supplied Git command, given by ``GIT_COMMAND``, on the +given Git repository corresponding to ``SOURCE_DIR``. The supplied ``GIT_COMMAND`` is just a string consisting of the Git command and its arguments. The resulting output is returned to the supplied CMake variable provided by -the OUTPUT_VARIABLE argument. +the ``OUTPUT_VARIABLE`` argument. A return code for the Git command is returned to the caller via the CMake -variable provided with the RETURN_CODE argument. A non-zero return code +variable provided with the ``RETURN_CODE`` argument. A non-zero return code indicates that an error has occured. -Note, this macro assumes FindGit() was invoked and was successful. It relies -on the following variables set by FindGit(): +Note, this macro assumes ``FindGit()`` was invoked and was successful. It relies +on the following variables set by ``FindGit()``: - * Git_FOUND flag that indicates if git is found - * GIT_EXECUTABLE points to the Git binary + * ``Git_FOUND`` flag that indicates if git is found + * ``GIT_EXECUTABLE`` points to the Git binary -If Git_FOUND is "false" this macro will throw a FATAL_ERROR message. +If ``Git_FOUND`` is ``False`` this macro will throw a ``FATAL_ERROR`` message. .. code-block:: cmake :caption: **Example** @@ -51,6 +52,8 @@ If Git_FOUND is "false" this macro will throw a FATAL_ERROR message. endif() +.. _blt_is_git_repo: + blt_is_git_repo ~~~~~~~~~~~~~~~ @@ -63,11 +66,11 @@ Checks if we are working with a valid Git repository. This macro checks if the corresponding source directory is a valid Git repo. Nominally, the corresponding source directory that is used is set to -${CMAKE_CURRENT_SOURCE_DIR}. A different source directory may be optionally -specified using the SOURCE_DIR argument. +``CMAKE_CURRENT_SOURCE_DIR``. A different source directory may be optionally +specified using the ``SOURCE_DIR`` argument. The resulting state is stored in the CMake variable specified by the caller -using the OUTPUT_STATE parameter. +using the ``OUTPUT_STATE`` parameter. .. code-block:: cmake :caption: **Example** @@ -81,6 +84,8 @@ using the OUTPUT_STATE parameter. endif() +.. _blt_git_tag: + blt_git_tag ~~~~~~~~~~~ @@ -94,16 +99,16 @@ blt_git_tag Returns the latest tag on a corresponding Git repository. This macro gets the latest tag from a Git repository that can be specified -via the SOURCE_DIR argument. If SOURCE_DIR is not supplied, the macro will -use ${CMAKE_CURRENT_SOURCE_DIR}. By default the macro will return the latest +via the ``SOURCE_DIR`` argument. If ``SOURCE_DIR`` is not supplied, the macro will +use ``CMAKE_CURRENT_SOURCE_DIR``. By default the macro will return the latest tag on the branch that is currently checked out. A particular branch may be -specified using the ON_BRANCH option. +specified using the ``ON_BRANCH`` option. The tag is stored in the CMake variable specified by the caller using the -the OUTPUT_TAG parameter. +the ``OUTPUT_TAG`` parameter. A return code for the Git command is returned to the caller via the CMake -variable provided with the RETURN_CODE argument. A non-zero return code +variable provided with the ``RETURN_CODE`` argument. A non-zero return code indicates that an error has occured. .. code-block:: cmake @@ -117,6 +122,8 @@ indicates that an error has occured. message( STATUS "tag=${tag}" ) +.. _blt_git_branch: + blt_git_branch ~~~~~~~~~~~~~~ @@ -129,12 +136,12 @@ blt_git_branch Returns the name of the active branch in the checkout space. This macro gets the name of the current active branch in the checkout space -that can be specified using the SOURCE_DIR argument. If SOURCE_DIR is not +that can be specified using the ``SOURCE_DIR`` argument. If ``SOURCE_DIR`` is not supplied by the caller, this macro will point to the checkout space -corresponding to ${CMAKE_CURRENT_SOURCE_DIR}. +corresponding to ``CMAKE_CURRENT_SOURCE_DIR``. A return code for the Git command is returned to the caller via the CMake -variable provided with the RETURN_CODE argument. A non-zero return code +variable provided with the ``RETURN_CODE`` argument. A non-zero return code indicates that an error has occured. .. code-block:: cmake @@ -148,6 +155,8 @@ indicates that an error has occured. message( STATUS "active_branch=${active_branch}" ) +.. _blt_git_hashcode: + blt_git_hashcode ~~~~~~~~~~~~~~~~ @@ -161,14 +170,14 @@ blt_git_hashcode Returns the SHA-1 hashcode at the tip of a branch. This macro returns the SHA-1 hashcode at the tip of a branch that may be -specified with the ON_BRANCH argument. If the ON_BRANCH argument is not +specified with the ``ON_BRANCH`` argument. If the ``ON_BRANCH`` argument is not supplied, the macro will return the SHA-1 hash at the tip of the current branch. In addition, the caller may specify the target Git repository using -the SOURCE_DIR argument. Otherwise, if SOURCE_DIR is not specified, the -macro will use ${CMAKE_CURRENT_SOURCE_DIR}. +the ``SOURCE_DIR`` argument. Otherwise, if ``SOURCE_DIR`` is not specified, the +macro will use ``CMAKE_CURRENT_SOURCE_DIR``. A return code for the Git command is returned to the caller via the CMake -variable provided with the RETURN_CODE argument. A non-zero return code +variable provided with the ``RETURN_CODE`` argument. A non-zero return code indicates that an error has occured. .. code-block:: cmake diff --git a/docs/api/target.rst b/docs/api/target.rst index 17548a3c1..a743bf0f6 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -60,6 +60,7 @@ is always on in your build project. COMMAND component_benchmark "--benchmark_min_time=0.0 --v=3 --benchmark_format=json") endif() + .. _blt_add_executable: blt_add_executable @@ -120,15 +121,14 @@ OUTPUT_NAME is useful when multiple CMake targets with the same name need to be created by different targets. .. note:: - If the first entry in SOURCES is a Fortran source file, the fortran linker - is used. (via setting the CMake target property LINKER_LANGUAGE to Fortran ) + If the first entry in ``SOURCES`` is a Fortran source file, the fortran linker + is used. (via setting the CMake target property ``LINKER_LANGUAGE`` to Fortran ) .. note:: - The FOLDER option is only used when ENABLE_FOLDERS is ON and when the CMake generator + The ``FOLDER`` option is only used when ENABLE_FOLDERS is ON and when the CMake generator supports this feature and will otherwise be ignored. - .. _blt_add_library: blt_add_library @@ -179,19 +179,19 @@ OUTPUT_DIR Directory that this target will built to SHARED - Builds library as shared and overrides global BUILD_SHARED_LIBS (defaults to OFF) + Builds library as shared and overrides global ``BUILD_SHARED_LIBS`` (defaults to ``OFF``) OBJECT Create an Object library CLEAR_PREFIX - Removes library prefix (defaults to 'lib' on linux) + Removes library prefix (defaults to ``lib`` on linux) FOLDER Name of the IDE folder to ease organization This macro creates a true CMake target that can be altered by other CMake commands -like normal, such as `set_target_property()`. It also adds SOURCES and HEADERS +like normal, such as ``set_target_property()``. It also adds ``SOURCES`` and ``HEADERS`` to the library for build system dependency tracking and IDE folder support. This macro supports three types of libraries automatically: normal, header-only, @@ -202,8 +202,8 @@ library and have headers that go along with them (unless it's a Fortran library) Header-only libraries are useful when you do not want the library separately compiled or are using C++ templates that require the library's user to instantiate them. These libraries -have headers but no sources. To create a header-only library (CMake calls them INTERFACE libraries), -simply list all headers under the HEADERS argument and do not specify SOURCES (because there aren't any). +have headers but no sources. To create a header-only library (CMake calls them ``INTERFACE`` libraries), +simply list all headers under the HEADERS argument and do not specify ``SOURCES`` (because there aren't any). Header-only libraries can have dependencies like compiled libraries - these will be propagated to targets that depend on the header-only library. @@ -215,28 +215,28 @@ object libraries you do not have to use the ``$>`` synt use with BLT macros. Unless you have a good reason don't use Object libraries. .. note:: - Due to necessary record keeping, BLT Object libraries need to be defined by `blt_add_library` before - they are used in any `DEPENDS_ON` list. They also do not follow CMake's normal transitivity rules. + Due to necessary record keeping, BLT Object libraries need to be defined by ``blt_add_library`` before + they are used in any ``DEPENDS_ON`` list. They also do not follow CMake's normal transitivity rules. This is due to CMake requiring you install the individual object files if you install the - target that uses them. BLT manually adds the INTERFACE target properties to get around this. + target that uses them. BLT manually adds the ``INTERFACE`` target properties to get around this. -This macro uses the BUILD_SHARED_LIBS, which is defaulted to OFF, to determine +This macro uses the ``BUILD_SHARED_LIBS``, which is defaulted to ``OFF``, to determine whether the library will be built as shared or static. The optional boolean -SHARED argument can be used to override this choice. +``SHARED`` argument can be used to override this choice. -If given a DEPENDS_ON argument, this macro will inherit the necessary information +If given a ``DEPENDS_ON`` argument, this macro will inherit the necessary information from all targets given in the list. This includes CMake targets as well as any BLT registered libraries already defined via :ref:`blt_register_library`. To ease use, all information is used by this library and inherited by anything depending on this -library (CMake PUBLIC inheritance). +library (CMake ``PUBLIC`` inheritance). -OUTPUT_NAME is useful when multiple libraries with the same name need to be created +``OUTPUT_NAME`` is useful when multiple libraries with the same name need to be created by different targets. For example, you might want to build both a shared and static -library in the same build instead of building twice, once with BUILD_SHARED_LIBS set to ON -and then with OFF. NAME is the CMake target name, OUTPUT_NAME is the created library name. +library in the same build instead of building twice, once with ``BUILD_SHARED_LIBS`` set to ``ON`` +and then with ``OFF``. ``NAME`` is the CMake target name, ``OUTPUT_NAME`` is the created library name. .. note:: - The FOLDER option is only used when ENABLE_FOLDERS is ON and when the CMake generator + The ``FOLDER`` option is only used when ``ENABLE_FOLDERS`` is ``ON`` and when the CMake generator supports this feature and will otherwise be ignored. @@ -275,17 +275,17 @@ This macro adds the named test to CTest, which is run by the build target ``test does not build the executable and requires a prior call to :ref:`blt_add_executable`. This macro assists with building up the correct command line. It will prepend -the RUNTIME_OUTPUT_DIRECTORY target property to the executable. +the ``RUNTIME_OUTPUT_DIRECTORY`` target property to the executable. -If NUM_MPI_TASKS is given or ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC is set, the macro -will appropriately use MPIEXEC, MPIEXEC_NUMPROC_FLAG, and BLT_MPI_COMMAND_APPEND +If ``NUM_MPI_TASKS`` is given or ``ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC`` is set, the macro +will appropriately use ``MPIEXEC``, ``MPIEXEC_NUMPROC_FLAG``, and ``BLT_MPI_COMMAND_APPEND`` to create the MPI run line. -MPIEXEC and MPIEXEC_NUMPROC_FLAG are filled in by CMake's FindMPI.cmake but can -be overwritten in your host-config specific to your platform. BLT_MPI_COMMAND_APPEND -is useful on machines that require extra arguments to MPIEXEC. +``MPIEXEC`` and ``MPIEXEC_NUMPROC_FLAG`` are filled in by CMake's ``FindMPI.cmake`` but can +be overwritten in your host-config specific to your platform. ``BLT_MPI_COMMAND_APPEND`` +is useful on machines that require extra arguments to ``MPIEXEC``. -If NUM_OMP_THREADS is given, this macro will set the environment variable OMP_NUM_THREADS +If ``NUM_OMP_THREADS`` is given, this macro will set the environment variable ``OMP_NUM_THREADS`` before running this test. This is done by appending to the CMake tests property. .. note:: @@ -294,7 +294,7 @@ before running this test. This is done by appending to the CMake tests property repository you wish to run as a test instead of an executable you built as a part of your build system. -Any calls to this macro should be guarded with ENABLE_TESTS unless this option +Any calls to this macro should be guarded with ``ENABLE_TESTS`` unless this option is always on in your build project. .. code-block:: cmake @@ -308,6 +308,7 @@ is always on in your build project. COMMAND my_test --with-some-argument) endif() + .. _blt_patch_target: blt_patch_target @@ -341,12 +342,12 @@ INCLUDES TREAT_INCLUDES_AS_SYSTEM Whether to inform the compiler to treat this target's include paths as system headers - this applies to all include paths for the target, - not just those specifies in the INCLUDES parameter. Only some + not just those specifies in the ``INCLUDES`` parameter. Only some compilers support this. This is useful if the headers generate warnings you want to not have them reported in your build. This defaults to OFF. FORTRAN_MODULES - FORTRAN module directories to be inherited by dependent targets + Fortran module directories to be inherited by dependent targets LIBRARIES List of CMake targets and library files (.a/.so/.lib/.dll) that make up @@ -366,9 +367,11 @@ targets created via another BLT macro or CMake command. Unlike ``blt_register_l it modifies the specified target, updating the CMake properties of the target that correspond to each of the parameters. -.. warning:: The DEPENDS_ON and LIBRARIES parameters cannot be used when patching a target +.. warning:: + The ``DEPENDS_ON`` and ``LIBRARIES`` parameters cannot be used when patching a target declared in a separate directory unless CMake policy CMP0079 has been set. + .. _blt_import_library: blt_import_library @@ -404,7 +407,7 @@ TREAT_INCLUDES_AS_SYSTEM as system headers FORTRAN_MODULES - FORTRAN module directories to be inherited by dependent targets + Fortran module directories to be inherited by dependent targets LIBRARIES List of CMake targets and library files (.a/.so/.lib/.dll) that make up @@ -435,27 +438,31 @@ to use the library). Instead of using these variables directly every time they they could instead be built into a CMake target. It also allows for compiler and linker options to be associated with the library. -As with BLT-registered libraries, it can be added to the DEPENDS_ON parameter +As with BLT-registered libraries, it can be added to the ``DEPENDS_ON`` parameter when building another target or to ``target_link_libraries`` to transitively add in all includes, libraries, flags, and definitions associated with the imported library. -The EXPORTABLE option is intended to be used to simplify the process of exporting a project. +The ``EXPORTABLE`` option is intended to be used to simplify the process of exporting a project. Instead of handwriting package location logic in a CMake package configuration file, the EXPORTABLE targets can be exported with the targets defined by the project. -.. note:: Libraries marked EXPORTABLE cannot also be marked GLOBAL. They also +.. note:: + Libraries marked ``EXPORTABLE`` cannot also be marked ``GLOBAL``. They also must be added to any export set that includes a target that depends on the - EXPORTABLE library. + ``EXPORTABLE`` library. -.. note:: It is highly recommended that EXPORTABLE imported targets be installed with a - project-specific namespace/prefix, either with the NAMESPACE option of CMake's install() command, - or the EXPORT_NAME target property. This mitigates the risk of conflicting target names. +.. note:: + It is highly recommended that ``EXPORTABLE`` imported targets be installed with a + project-specific namespace/prefix, either with the ``NAMESPACE`` option of CMake's + ``install()`` command, or the ``EXPORT_NAME`` target property. This mitigates the + risk of conflicting target names. In CMake terms, the imported libraries will be ``INTERFACE`` libraries. This does not actually build a library. This is strictly to ease use after discovering it on your system or building it yourself inside your project. + .. _blt_register_library: blt_register_library @@ -477,10 +484,11 @@ Registers a library to the project to ease use in other BLT macro calls. Stores information about a library in a specific way that is easily recalled in other macros. For example, after registering gtest, you can add gtest to -the DEPENDS_ON in your blt_add_executable call and it will add the INCLUDES -and LIBRARIES to that executable. +the ``DEPENDS_ON`` in your ``blt_add_executable()`` call and it will add the +``INCLUDES`` and ``LIBRARIES`` to that executable. -.. note:: In general, this macro should be avoided unless absolutely necessary, as it +.. note:: + In general, this macro should be avoided unless absolutely necessary, as it does not create a native CMake target. If the library to register already exists as a CMake target, consider using ``blt_patch_target``. Otherwise, consider using ``blt_import_library``. These options are insufficient in some circumstances, for example, @@ -488,9 +496,9 @@ and LIBRARIES to that executable. directory while keeping the modified target usable with the same name as the original target. In this case ``blt_register_library`` is the only option. - -Note: The OBJECT parameter is for internal BLT support for object libraries -and is not for users. Object libraries are created using blt_add_library(). +Note: + The ``OBJECT`` parameter is for internal BLT support for object libraries + and is not for users. Object libraries are created using ``blt_add_library()``. Internally created variables (NAME = "foo"): | _BLT_FOO_IS_REGISTERED_LIBRARY diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index 75803acfe..11f947c28 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -6,6 +6,7 @@ Target Property Macros ====================== +.. _blt_add_target_compile_flags: blt_add_target_compile_flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -28,20 +29,22 @@ FLAGS List of compile flags This macro provides very similar functionality to CMake's native -``add_compile_options`` and ``target_compile_options`` commands, but +``add_compile_options()`` and ``target_compile_options()`` commands, but provides more fine-grained scoping for the compile flags on a per target basis. -The given target must be added via CMake's ``add_executable`` or ``add_library`` commands -or with the corresponding ``blt_add_executable`` and ``blt_add_library`` macros. +The given target must be added via CMake's ``add_executable()`` or ``add_library()`` commands +or with the corresponding ``blt_add_executable()`` and ``blt_add_library()`` macros. -PRIVATE flags are used for the given target. INTERFACE flags are inherited -by any target that depends on this target. PUBLIC flags are both INTERFACE and PRIVATE. +``PRIVATE`` flags are used for the given target. ``INTERFACE`` flags are inherited +by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. .. note:: This macro will strip away leading and trailing whitespace from each flag. +.. _blt_add_target_definitions: + blt_add_target_definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -57,28 +60,28 @@ TO Name of CMake target SCOPE - Defines the scope of the given definitions. Defaults to PUBLIC and is case insensitive. + Defines the scope of the given definitions. Defaults to ``PUBLIC`` and is case insensitive. FLAGS List of definitions flags This macro provides very similar functionality to CMake's native -``add_definitions`` and ``target_add_defintions`` commands, but provides +``add_definitions()`` and ``target_add_defintions()`` commands, but provides more fine-grained scoping for the compile definitions on a per target basis. -Given a list of definitions, e.g., FOO and BAR, this macro adds compiler +Given a list of definitions, e.g., ``FOO`` and ``BAR``, this macro adds compiler definitions to the compiler command for the given target, i.e., it will pass --DFOO and -DBAR. +``-DFOO`` and ``-DBAR``. -The given target must be added via CMake's ``add_executable`` or ``add_library`` commands -or with the corresponding ``blt_add_executable`` and ``blt_add_library`` macros. +The given target must be added via CMake's ``add_executable()`` or ``add_library()`` commands +or with the corresponding ``blt_add_executable()`` and ``blt_add_library()`` macros. -PRIVATE flags are used for the given target. INTERFACE flags are inherited -by any target that depends on this target. PUBLIC flags are both INTERFACE and PRIVATE. +``PRIVATE`` flags are used for the given target. ``INTERFACE`` flags are inherited +by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. .. note:: The target definitions can either include or omit the "-D" characters. E.g. the following are all valid ways to add two compile definitions - (A=1 and B) to target 'foo'. + (A=1 and B) to target ``foo``. .. note:: This macro will strip away leading and trailing whitespace from each definition. @@ -93,6 +96,8 @@ by any target that depends on this target. PUBLIC flags are both INTERFACE and P blt_add_target_definitions(TO foo TARGET_DEFINITIONS " " -DA=1;B) +.. _blt_add_target_link_flags: + blt_add_target_link_flags ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -114,21 +119,21 @@ FLAGS List of linker flags This macro provides very similar functionality to CMake's native -``add_link_options`` and ``target_link_options`` commands, but provides +``add_link_options()`` and ``target_link_options()`` commands, but provides more fine-grained scoping for the compile definitions on a per target basis. -The given target must be added via CMake's ``add_executable`` or ``add_library`` commands -or with the corresponding ``blt_add_executable`` and ``blt_add_library`` macros. +The given target must be added via CMake's ``add_executable()`` or ``add_library()`` commands +or with the corresponding ``blt_add_executable()`` and ``blt_add_library()`` macros. -PRIVATE flags are used for the given target. INTERFACE flags are inherited -by any target that depends on this target. PUBLIC flags are both INTERFACE and PRIVATE. +``PRIVATE`` flags are used for the given target. ``INTERFACE`` flags are inherited +by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. -If `CUDA_LINK_WITH_NVCC` is set to ON, this macro will automatically convert -"-Wl,-rpath," to "-Xlinker -rpath -Xlinker ". +If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically convert +``-Wl,-rpath,`` to ``-Xlinker -rpath -Xlinker ``. .. note:: This macro also handles the various changes that CMake made in 3.13. For example, - the target property LINK_FLAGS was changes to LINK_OPTIONS and was changed from a + the target property ``LINK_FLAGS`` was changes to ``LINK_OPTIONS`` and was changed from a string to a list. New versions now support Generator Expressions. Also pre-3.13, there were no macros to add link flags to targets so we do this by setting the properties directly. @@ -138,11 +143,13 @@ If `CUDA_LINK_WITH_NVCC` is set to ON, this macro will automatically convert and any ; characters will be removed. .. note:: - In CMake versions 3.13 and above, this list is prepended with "SHELL:" which stops + In CMake versions 3.13 and above, this list is prepended with ``SHELL:`` which stops CMake from de-duplicating flags. This is especially bad when linking with NVCC when - you have groups of flags like "-Xlinker -rpath -Xlinker ". + you have groups of flags like ``-Xlinker -rpath -Xlinker ``. +.. _blt_print_target_properties: + blt_print_target_properties ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -155,14 +162,16 @@ Prints out all properties of the given target. TARGET Name of CMake target -The given target must be added via ``add_executable`` or ``add_library`` or -with the corresponding ``blt_add_executable``, ``blt_add_library``, or -``blt_register_library`` macros. +The given target must be added via ``add_executable()`` or ``add_library()`` or +with the corresponding ``blt_add_executable()``, ``blt_add_library()``, +``blt_import_library()``, or ``blt_register_library()`` macros. Output is of the form for each property: | [ property] : +.. _blt_set_target_folder: + blt_set_target_folder ~~~~~~~~~~~~~~~~~~~~~ @@ -181,11 +190,11 @@ FOLDER This is used to organize properties in an IDE. -This feature is only available when BLT's `ENABLE_FOLDERS` option is ON and +This feature is only available when BLT's ``ENABLE_FOLDERS`` option is ``ON`` and in CMake generators that support folders (but is safe to call regardless -of the generator or value of ENABLE_FOLDERS). +of the generator or value of ``ENABLE_FOLDERS``). .. note:: - Do not use this macro on header-only (INTERFACE) library targets, since + Do not use this macro on header-only, ``INTERFACE`` library targets, since this will generate a CMake configuration error. diff --git a/docs/api/utility.rst b/docs/api/utility.rst index 3ff692e8c..4bed9cc51 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -6,6 +6,7 @@ Utility Macros ============== +.. _blt_assert_exists: blt_assert_exists ~~~~~~~~~~~~~~~~~~~ @@ -21,7 +22,6 @@ Checks if the specified directory, file and/or cmake target exists and throws an error message. .. note:: - The behavior for checking if a given file or directory exists is well-defined only for absolute paths. @@ -43,6 +43,8 @@ an error message. blt_assert_exists( TARGETS foo bar ) +.. _blt_append_custom_compiler_flag: + blt_append_custom_compiler_flag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -64,16 +66,18 @@ blt_append_custom_compiler_flag Appends compiler-specific flags to a given variable of flags If a custom flag is given for the current compiler, we use that. -Otherwise, we will use the DEFAULT flag (if present). +Otherwise, we will use the ``DEFAULT`` flag (if present). -If ENABLE_FORTRAN is On, any flagsVar with "fortran" (any capitalization) +If ``ENABLE_FORTRAN`` is ``ON``, any flagsVar with ``fortran`` (any capitalization) in its name will pick the compiler family (GNU,CLANG, INTEL, etc) based on the fortran compiler family type. This allows mixing C and Fortran compiler families, e.g. using Intel fortran compilers with clang C compilers. -When using the Intel toolchain within visual studio, we use the -MSVC_INTEL flag, when provided, with a fallback to the MSVC flag. +When using the Intel toolchain within Visual Studio, we use the +``MSVC_INTEL`` flag, when provided, with a fallback to the ``MSVC`` flag. + +.. _blt_find_libraries: blt_find_libraries ~~~~~~~~~~~~~~~~~~ @@ -87,15 +91,17 @@ blt_find_libraries This command is used to find a list of libraries. -If the libraries are found the results are appended to the given FOUND_LIBS variable name. -NAMES lists the names of the libraries that will be searched for in the given PATHS. +If the libraries are found the results are appended to the given ``FOUND_LIBS`` variable name. +``NAMES`` lists the names of the libraries that will be searched for in the given ``PATHS``. -If REQUIRED is set to TRUE, BLT will produce an error message if any of the -given libraries are not found. The default value is TRUE. +If ``REQUIRED`` is set to ``TRUE``, BLT will produce an error message if any of the +given libraries are not found. The default value is ``TRUE``. -PATH lists the paths in which to search for NAMES. No system paths will be searched. +``PATH`` lists the paths in which to search for ``NAMES``. No system paths will be searched. +.. _blt_list_append: + blt_list_append ~~~~~~~~~~~~~~~ @@ -117,8 +123,9 @@ This macro requires specifying: * A condition to check by passing ``IF `` * The list of elements to append by passing ``ELEMENTS [...]`` -Note, the argument passed to the IF option has to be a single boolean value -and cannot be a boolean expression since CMake cannot evaluate those inline. +.. note:: + The argument passed to the ``IF`` option has to be a single boolean value + and cannot be a boolean expression since CMake cannot evaluate those inline. .. code-block:: cmake :caption: **Example** @@ -139,6 +146,8 @@ and cannot be a boolean expression since CMake cannot evaluate those inline. blt_list_append( TO mylist ELEMENTS F IF _undefined ) # Does not append 'F' +.. _blt_list_remove_duplicates: + blt_list_remove_duplicates ~~~~~~~~~~~~~~~~~~~~~~~~~~ From 288efca25ec74ed22ce32039cf94fd32affa1d3f Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 15:14:18 -0700 Subject: [PATCH 262/330] Add links and more consistency --- docs/api/target.rst | 59 +++++++++++++++++----------------- docs/api/target_properties.rst | 10 +++--- docs/api/utility.rst | 2 +- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/docs/api/target.rst b/docs/api/target.rst index a743bf0f6..14f305ad3 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -38,14 +38,14 @@ information see :ref:`blt_add_test`. The underlying executable should be previously added to the build system with :ref:`blt_add_executable`. It should include the necessary benchmarking -library in its DEPENDS_ON list. +library in its ``DEPENDS_ON`` list. -Any calls to this macro should be guarded with ENABLE_BENCHMARKS unless this option +Any calls to this macro should be guarded with ``ENABLE_BENCHMARKS`` unless this option is always on in your build project. .. note:: BLT provides a built-in Google Benchmark that is enabled by default if you set - ENABLE_BENCHMARKS=ON and can be turned off with the option ENABLE_GBENCHMARK. + ``ENABLE_BENCHMARKS=ON`` and can be turned off with the option ``ENABLE_GBENCHMARK``. .. code-block:: cmake :caption: **Example** @@ -105,28 +105,28 @@ OUTPUT_DIR Directory that this target will built to, defaults to bin OUTPUT_NAME - Override built file name of the executable (defaults to ) + Override built file name of the executable (defaults to ````) FOLDER Name of the IDE folder to ease organization -Adds an executable target, called , to be built from the given sources. -It also adds the given INCLUDES and DEFINES from the parameters to this macro -and adds all inherited information from the list given by DEPENDS_ON. This +Adds an executable target, called ````, to be built from the given sources. +It also adds the given ``INCLUDES`` and ``DEFINES`` from the parameters to this macro +and adds all inherited information from the list given by ``DEPENDS_ON``. This macro creates a true CMake target that can be altered by other CMake commands -like normal, such as `set_target_property()`. It also adds SOURCES and HEADERS +like normal, such as ``set_target_property()``. It also adds ``SOURCES`` and ``HEADERS`` to the library for build system dependency tracking and IDE folder support. -OUTPUT_NAME is useful when multiple CMake targets with the same name need to be +``OUTPUT_NAME`` is useful when multiple CMake targets with the same name need to be created by different targets. .. note:: If the first entry in ``SOURCES`` is a Fortran source file, the fortran linker - is used. (via setting the CMake target property ``LINKER_LANGUAGE`` to Fortran ) + is used, via setting the CMake target property ``LINKER_LANGUAGE`` to Fortran. .. note:: - The ``FOLDER`` option is only used when ENABLE_FOLDERS is ON and when the CMake generator - supports this feature and will otherwise be ignored. + The ``FOLDER`` option is only used when ``ENABLE_FOLDERS`` is ``ON`` and when the + CMake generator supports this feature and will otherwise be ignored. .. _blt_add_library: @@ -173,7 +173,7 @@ DEPENDS_ON depends on OUTPUT_NAME - Override built file name of the library (defaults to ) + Override built file name of the library (defaults to ````) OUTPUT_DIR Directory that this target will built to @@ -203,19 +203,19 @@ library and have headers that go along with them (unless it's a Fortran library) Header-only libraries are useful when you do not want the library separately compiled or are using C++ templates that require the library's user to instantiate them. These libraries have headers but no sources. To create a header-only library (CMake calls them ``INTERFACE`` libraries), -simply list all headers under the HEADERS argument and do not specify ``SOURCES`` (because there aren't any). -Header-only libraries can have dependencies like compiled libraries - these will be propagated to targets -that depend on the header-only library. +simply list all headers under the ``HEADERS`` argument and do not specify ``SOURCES`` +(because there aren't any). Header-only libraries can have dependencies like compiled libraries. +These will be propagated to targets that depend on the header-only library. Object libraries are basically a collection of compiled source files that are not archived or linked. They are sometimes useful when you want to solve compilicated linking problems (like circular dependencies) or when you want to combine smaller libraries into one larger library but don't want the linker to remove unused symbols. Unlike regular CMake object libraries you do not have to use the ``$>`` syntax, you can just -use with BLT macros. Unless you have a good reason don't use Object libraries. +use ```` with BLT macros. Unless you have a good reason don't use Object libraries. .. note:: - Due to necessary record keeping, BLT Object libraries need to be defined by ``blt_add_library`` before + Due to necessary record keeping, BLT Object libraries need to be defined by :ref:`blt_add_library` before they are used in any ``DEPENDS_ON`` list. They also do not follow CMake's normal transitivity rules. This is due to CMake requiring you install the individual object files if you install the target that uses them. BLT manually adds the ``INTERFACE`` target properties to get around this. @@ -265,7 +265,8 @@ NUM_MPI_TASKS Indicates this is an MPI test and how many MPI tasks to use. NUM_OMP_THREADS - Indicates this test requires the defined environment variable OMP_NUM_THREADS set to the given variable. + Indicates this test requires the defined environment variable ``OMP_NUM_THREADS`` + set to the given variable. CONFIGURATIONS Set the CTest configuration for this test. When not specified, the test @@ -344,7 +345,7 @@ TREAT_INCLUDES_AS_SYSTEM as system headers - this applies to all include paths for the target, not just those specifies in the ``INCLUDES`` parameter. Only some compilers support this. This is useful if the headers generate warnings - you want to not have them reported in your build. This defaults to OFF. + you want to not have them reported in your build. This defaults to ``OFF``. FORTRAN_MODULES Fortran module directories to be inherited by dependent targets @@ -362,8 +363,8 @@ LINK_FLAGS DEFINES List of compiler defines to be inherited by dependent targets -This macro does not create a target - it is intended to be used with CMake -targets created via another BLT macro or CMake command. Unlike ``blt_register_library``, +This macro does not create a target, it is intended to be used with CMake +targets created via another BLT macro or CMake command. Unlike :ref:`blt_register_library`, it modifies the specified target, updating the CMake properties of the target that correspond to each of the parameters. @@ -439,12 +440,12 @@ they could instead be built into a CMake target. It also allows for compiler an options to be associated with the library. As with BLT-registered libraries, it can be added to the ``DEPENDS_ON`` parameter -when building another target or to ``target_link_libraries`` to transitively add in +when building another target or to ``target_link_libraries()`` to transitively add in all includes, libraries, flags, and definitions associated with the imported library. The ``EXPORTABLE`` option is intended to be used to simplify the process of exporting a project. Instead of handwriting package location logic in a CMake package configuration file, the -EXPORTABLE targets can be exported with the targets defined by the project. +``EXPORTABLE`` targets can be exported with the targets defined by the project. .. note:: Libraries marked ``EXPORTABLE`` cannot also be marked ``GLOBAL``. They also @@ -484,21 +485,21 @@ Registers a library to the project to ease use in other BLT macro calls. Stores information about a library in a specific way that is easily recalled in other macros. For example, after registering gtest, you can add gtest to -the ``DEPENDS_ON`` in your ``blt_add_executable()`` call and it will add the +the ``DEPENDS_ON`` in your :ref:`blt_add_executable` call and it will add the ``INCLUDES`` and ``LIBRARIES`` to that executable. .. note:: In general, this macro should be avoided unless absolutely necessary, as it does not create a native CMake target. If the library to register already exists - as a CMake target, consider using ``blt_patch_target``. Otherwise, consider using - ``blt_import_library``. These options are insufficient in some circumstances, for example, + as a CMake target, consider using :ref:`blt_patch_target`. Otherwise, consider using + :ref:`blt_import_library`. These options are insufficient in some circumstances, for example, if it is necessary to add libraries to a CMake library target declared in another directory while keeping the modified target usable with the same name as the original - target. In this case ``blt_register_library`` is the only option. + target. In this case :ref:`blt_register_library` is the only option. Note: The ``OBJECT`` parameter is for internal BLT support for object libraries - and is not for users. Object libraries are created using ``blt_add_library()``. + and is not for users. Object libraries are created using :ref:`blt_add_library`. Internally created variables (NAME = "foo"): | _BLT_FOO_IS_REGISTERED_LIBRARY diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index 11f947c28..e7fe1e9d9 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -34,7 +34,7 @@ provides more fine-grained scoping for the compile flags on a per target basis. The given target must be added via CMake's ``add_executable()`` or ``add_library()`` commands -or with the corresponding ``blt_add_executable()`` and ``blt_add_library()`` macros. +or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` macros. ``PRIVATE`` flags are used for the given target. ``INTERFACE`` flags are inherited by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. @@ -73,7 +73,7 @@ definitions to the compiler command for the given target, i.e., it will pass ``-DFOO`` and ``-DBAR``. The given target must be added via CMake's ``add_executable()`` or ``add_library()`` commands -or with the corresponding ``blt_add_executable()`` and ``blt_add_library()`` macros. +or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` macros. ``PRIVATE`` flags are used for the given target. ``INTERFACE`` flags are inherited by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. @@ -123,7 +123,7 @@ This macro provides very similar functionality to CMake's native more fine-grained scoping for the compile definitions on a per target basis. The given target must be added via CMake's ``add_executable()`` or ``add_library()`` commands -or with the corresponding ``blt_add_executable()`` and ``blt_add_library()`` macros. +or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` macros. ``PRIVATE`` flags are used for the given target. ``INTERFACE`` flags are inherited by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. @@ -163,8 +163,8 @@ TARGET Name of CMake target The given target must be added via ``add_executable()`` or ``add_library()`` or -with the corresponding ``blt_add_executable()``, ``blt_add_library()``, -``blt_import_library()``, or ``blt_register_library()`` macros. +with the corresponding :ref:`blt_add_executable`, :ref:`blt_add_library`, +:ref:`blt_import_library`, or :ref:`blt_register_library` macros. Output is of the form for each property: | [ property] : diff --git a/docs/api/utility.rst b/docs/api/utility.rst index 4bed9cc51..60d525805 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -155,7 +155,7 @@ blt_list_remove_duplicates blt_list_remove_duplicates(TO ) -Removes duplicate elements from the given TO list. +Removes duplicate elements from the given ``TO`` list. This macro is essentially a wrapper around CMake's ``list(REMOVE_DUPLICATES ...)`` command but doesn't throw an error if the list is empty or not defined. From f5f7bbe24dadb900da541f4aaf35388b31af945c Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 15:57:45 -0700 Subject: [PATCH 263/330] Fix a missed note --- docs/api/target.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target.rst b/docs/api/target.rst index 14f305ad3..752557304 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -497,7 +497,7 @@ the ``DEPENDS_ON`` in your :ref:`blt_add_executable` call and it will add the directory while keeping the modified target usable with the same name as the original target. In this case :ref:`blt_register_library` is the only option. -Note: +.. note:: The ``OBJECT`` parameter is for internal BLT support for object libraries and is not for users. Object libraries are created using :ref:`blt_add_library`. From ea366230901bb14cda8ddfef4242669846aa9baf Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 19:56:57 -0700 Subject: [PATCH 264/330] Fix paths --- docs/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index a2c5217f6..12bcf295f 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -13,7 +13,7 @@ project( blt_docs ) # Set BLT_SOURCE_DIR to default location, if not set by user if(NOT BLT_SOURCE_DIR) - set(BLT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../..") + set(BLT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/..") endif() include(${BLT_SOURCE_DIR}/SetupBLT.cmake) @@ -21,7 +21,7 @@ include(${BLT_SOURCE_DIR}/SetupBLT.cmake) #------------------------------------------------------------------------------ # Calc PI Tutorial #------------------------------------------------------------------------------ -add_subdirectory(calc_pi) +add_subdirectory(tutorial/calc_pi) #------------------------------------------------------------------------------ # Docs From 2aa0621cd2e2333ae14b163e7740f84b2ca2027b Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 19:57:11 -0700 Subject: [PATCH 265/330] Add guard --- docs/tutorial/calc_pi/CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/tutorial/calc_pi/CMakeLists.txt b/docs/tutorial/calc_pi/CMakeLists.txt index 0e22dd62b..ff353d603 100644 --- a/docs/tutorial/calc_pi/CMakeLists.txt +++ b/docs/tutorial/calc_pi/CMakeLists.txt @@ -118,7 +118,6 @@ endif() #------------------------------------------------------------------------------ # Add Documentation Examples #------------------------------------------------------------------------------ -add_subdirectory(docs) - - - +if (ENABLE_DOCS) + add_subdirectory(docs) +endif() From 837a991445a3ef8b9a87a5511c20fb9c0381cda8 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 25 Mar 2021 19:57:22 -0700 Subject: [PATCH 266/330] Quiet sphinx warnings --- docs/api/code_check.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index a6fe3494d..45d7ad466 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -179,7 +179,7 @@ CHECKER_DIRECTORIES Clang-query is a tool used for examining and matching the Clang AST. It is useful for enforcing coding standards and rules on your source code. A good primer on how to use clang-query can be -found `here `_. +found `here `__. A list of checker directories is required for clang-query, this can be defined either by the parameter ``CHECKER_DIRECTORIES`` or the variable ``BLT_CLANGQUERY_CHECKER_DIRECTORIES``. @@ -229,7 +229,7 @@ SRC_FILES Source list that cppcheck will be ran on Cppcheck is a static analysis tool for C/C++ code. More information about -Cppcheck can be found `here `_. +Cppcheck can be found `here `__. .. _blt_add_clang_tidy_target: @@ -259,7 +259,7 @@ COMMENT CHECKS List of checks to be run on the selected source files, available checks are listed - `here `_. + `here `__. FIX Applies fixes for checks (a subset of clang-tidy checks specify how they should be resolved) @@ -268,7 +268,7 @@ SRC_FILES Source list that clang-tidy will be ran on Clang-tidy is a tool used for diagnosing and fixing typical programming errors. It is useful for enforcing -coding standards and rules on your source code. Clang-tidy is documented `here `_. +coding standards and rules on your source code. Clang-tidy is documented `here `__. ``CHECKS`` are the static analysis "rules" to specifically run on the target. If no checks are specified, clang-tidy will run the default available static analysis checks. @@ -317,7 +317,7 @@ SRC_FILES Source list that AStyle will be ran on AStyle is a Source Code Beautifier for C/C++ code. More information about -AStyle can be found `here `_. +AStyle can be found `here `__. When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build target to the parent `style` build target. Otherwise the files are not modified and the @@ -331,7 +331,7 @@ which files do not conform to your style guide. .. _blt_add_clangformat_target: blt_add_clangformat_target -~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: cmake @@ -371,7 +371,7 @@ SRC_FILES Source list that ClangFormat will be ran on ClangFormat is a Source Code Beautifier for C/C++ code. More information about -ClangFormat can be found `here `_. +ClangFormat can be found `here `__. When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build target to the parent ``style`` build target. Otherwise the files are not modified and the @@ -436,7 +436,7 @@ SRC_FILES Source list that Uncrustify will be ran on Uncrustify is a Source Code Beautifier for C/C++ code. More information about -Uncrustify can be found `here `_. +Uncrustify can be found `here `__. When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build target to the parent ``style`` build target. Otherwise the files are not modified and the @@ -450,7 +450,7 @@ which files do not conform to your style guide. .. _blt_add_yapf_target: blt_add_yapf_target -~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~ .. code-block:: cmake @@ -490,7 +490,7 @@ SRC_FILES Source list that Yapf will be ran on Yapf is a Source Code Beautifier for Python code. More information about -Yapf can be found `here `_. +Yapf can be found `here `__. When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build target to the parent ``style`` build target. Otherwise the files are not modified and the @@ -501,7 +501,7 @@ which files do not conform to your style guide. .. _blt_add_cmake_format_target: blt_add_cmakeformat_target -~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: cmake @@ -541,7 +541,7 @@ SRC_FILES Source list that CMakeFormat will be ran on CMakeFormat is a Source Code Beautifier for CMake code. More information about -CMakeFormat can be found `here `_. +CMakeFormat can be found `here `__. When ``MODIFY_FILES`` is set to ``TRUE``, modifies the files in place and adds the created build target to the parent ``style`` build target. Otherwise the files are not modified and the From 66809fc3777ec3984ce9ec6e4b81e96f39b449f8 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 25 Mar 2021 18:36:22 -0700 Subject: [PATCH 267/330] Adds the blt logo to it sphinx-generated documentation --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index fafcd2467..6717cc4b5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -118,7 +118,7 @@ # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +html_logo = '../share/blt/logo/blt_logo.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 From 54ac14e0e46e41829c87a436ee18cb29cd2f32c4 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 25 Mar 2021 18:48:23 -0700 Subject: [PATCH 268/330] Adds code to support toggle elements in docs Credits: Borrowed from a solution by Tom Stitt --- docs/_static/style.css | 28 ++++++++++++++++++++++++++++ docs/_templates/page.html | 27 +++++++++++++++++++++++++++ docs/conf.py | 2 +- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 docs/_static/style.css create mode 100644 docs/_templates/page.html diff --git a/docs/_static/style.css b/docs/_static/style.css new file mode 100644 index 000000000..7af57188a --- /dev/null +++ b/docs/_static/style.css @@ -0,0 +1,28 @@ +.toggle .label { + display: block; + clear: both; +} + +.toggle .label:before { + font-family: FontAwesome; + content: "\f196 "; + color: #b3b3b3; +} + +.toggle .label.expanded:hover:before { + color: #d9d9d9; +} + +.toggle .label.expanded:before { + font-family: FontAwesome; + content: "\f147 "; + color: #b3b3b3; +} + +.toggle .label:hover:before { + color: #d9d9d9; +} + +.linebreak { + opacity: 0.0; +} diff --git a/docs/_templates/page.html b/docs/_templates/page.html new file mode 100644 index 000000000..687c1150c --- /dev/null +++ b/docs/_templates/page.html @@ -0,0 +1,27 @@ +{% extends "!page.html" %} + +{% set css_files = css_files + ["_static/style.css"] %} + +{% block footer %} + +{% endblock %} diff --git a/docs/conf.py b/docs/conf.py index 6717cc4b5..017b6dbab 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -128,7 +128,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. From 721440d89da9cffe94a28b3644efa031920d2bb2 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 25 Mar 2021 19:16:39 -0700 Subject: [PATCH 269/330] Adds some toggleable files to for blank_project to user tutorial --- docs/tutorial/setup_blt.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index 50a5d2cb2..b6e98ab71 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -217,3 +217,33 @@ using gcc 4.9.3 on LLNL's Pascal cluster. :language: cmake +Example files +------------- + +.. container:: toggle expanded + + .. container:: label + + Files related to setting up `blank_project` + + .. + + .. container:: toggle + + .. container:: label + + ``CMakeLists.txt`` + + .. literalinclude:: ./blank_project/CMakeLists.txt + :language: cmake + :linenos: + + .. container:: toggle + + .. container:: label + + ``gcc@4.9.3_nvcc host config`` + + .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake + :language: cmake + :linenos: From 1a907a734f1b836d310c1d91ce2257623f94a9c0 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 25 Mar 2021 20:09:45 -0700 Subject: [PATCH 270/330] Adds a transparent version of the BLT logo and uses it for the user docs --- docs/conf.py | 2 +- share/blt/logo/blt_logo_transparent.png | Bin 0 -> 3502 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 share/blt/logo/blt_logo_transparent.png diff --git a/docs/conf.py b/docs/conf.py index 017b6dbab..2841f4145 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -118,7 +118,7 @@ # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = '../share/blt/logo/blt_logo.png' +html_logo = '../share/blt/logo/blt_logo_transparent.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 diff --git a/share/blt/logo/blt_logo_transparent.png b/share/blt/logo/blt_logo_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..cdb04285e7b07cdd5cac8b5f5355b2132335ae18 GIT binary patch literal 3502 zcmV;f4N>xmP)@ z3J{Yw#a;ns#teG}zzPhrp4qGbGi8Fj0?Z1KSMbaZUS)UcwUC9XRFyyHW`18pg$Te_ zRsNhjH*Z$vK?5+5S6@z!+K;L5E#Ck2pHH`u%V56cuV?<+#$kIM1^RmTY(F>tZn6IF z?epI&RKz2?%P);))j(Y1dF=nZ>P*ktN?TA$zwlLDXk2|g8zG_>8-J}PtlLEH&Bk-M zkLB8R=LO1%&=R3ZBP?@YSx>tf5hC-T?55%(vl{WobmDm-)wR`Oc@c8$`o@>lB9;Ss zR9WY6g?-#!&-ZLZ%LbY)qq{nHBYyTtCH44=ptgO)3D4*Dx(?}hiWizSae2KXZboRz z6q?(@pD(8HT(o`Xy8Zmv3eGh`^Lv4D;_||a%vf&Fl?OaVXo|=6o#VDIxqzpO z&A$S3+Wa#iHVgP`aWwWi;&SMGgP#b7e{p^3vMm=E6`T*5ubhxR*-v)m44Kqy&jmsppmlK#b;tdv|u_-ijs<;Lxci$|3ShU`eDdLR8A8)O%$a+r#Pb6<8heh0w08RTa9M=Vv?AjkQB6t|bKH9J=G+ty*Em`nVF_Llmj-$!Kcos@b7~0~5hvIaYQwmqPb~(AaY`W9scG)f+r~ zn#l=`e-m4&A(L@3C^RGXxy8|hXD%f)Uin@ZGBTEo`l!DM(J3H&dr@&TZUR_sA`YRk z=V%7i8C!Qo<48tmyqh@{wBQTci8-Me`i>KBrgWic(rjLZn;AbKSm=yH7wfT5FJ8Mj z$}TjjZU&(->1M_V4WU!yc9YxDycR7SGEVk{=6=L+t_V%!@F|XL7S#-5|$jcpu_sj!KRlTD$y8~Aff1ScSi(D<2X)wmcpv%S95 zVImku^MDt^1%uGob2Ed4#?KSZsNSeda|+F=aKVsqvN!542WFgbGo^-3ev3}!eLrwC z4^f}T7+PltO`1MG%i(CA7aHpmI@xofOav!tKRJZvSh++-Y-~;Fgrfn4(8*^nl*1-O zW_z8fgV2ccDDn5bFwn8)`!w(o8!c^q?>>i@-HuppUs~8SX5G`f1h?l_RL@0=&b8f- zDZVGQ(9Ff#tn27s_Y{a+g1BlZ?s9V!i%1I%i#=z%Ew8r;>ghtb-Cw6DgQSkezp0H? z4evH)z9GM9%hQWOI@!g@#?`)8Yi@n_st7a_A&GfgecdqmlBRJ{(Q?4(C(b;7nfSUVgeI}0!Oduh&9tD7A{{n)lqb@Y&TXX<8s=v-!l;Wq zf95e^Q?ZUFsYp*K@Txf7bAnPmbowrSf6C=oR_L_nidRS=HU)*e${8o=vP(U;mBP^= zGFm+E*->T&o`s2EBjuJtXy){7tq#z0QdnMS0&N8=!(11lJsxCBy zPN{^($X+J3($!JbLnq~olX}?|7dp-8&$4u#pg`zUsEf}vw>7D?z;QHYM`VP?SlHx< zc?yDsR}Ze5IOp12C^xu{GojRl=04$>R;9K3Wv(xdDKr*F#*Z;JXcl(`UC&F{RBpS^ zHn&xK=oDPxy~rppKksq_hX@U!lL?_Q66eR77*l`t?}j@{pZm{-flO<*&?%Oqu^=?D z)ZKdML1!tn-RE3QJ*l*_#kAn+li>F|Mr8H3j*}jGM%bh;H0p7_Bi6*&%y37=&6GRH zWG%Z`LStbf__o4lUmCABb)iunWU{WNMrZ<}zVm&Lj;j8S(~bE35jrInnyGk$h_&cz zCjQ(^1V@65Q(~bpFsjE4o79D-%RX}iZlNwd_x?RG9F4l0iD|)~TJ5MtGET}uGqYIl zmW8Iu6~P6B9=Mru2bt_4XAGgSuzhFnf;Zv_EDOz2{Qi_3P4?B)lgbKw)!`Nux|yzL zRv#d~i{Bri6QL7fQ)7P(jcn*tz_JFDLNl$j(A8f(Amdc0n~|7A4=OZ9_6feJv9aw6 zoeG#=LTJPVI<%v)klK#bU@hBc>+?&wA>))-Xw*Afl!CY5u4k<(L)Q(p@9y! zsH~y&aRllar#tccBXmkEG__7Bl5wgubRy%FM`*}6*>nViPKCNzmDe_Eb2PEyRkM!3 zK*s5wjFWwV4kk2}A3Uc1>`TJkXpnJA>}V_qP4I%Zuq{T1BT&D8&T$%!%tm1$g~mdP z_qMWzwli$5} zx78gD8K;LMvbvjboVE9v>$|Ty=C=r&G6>DwYKI$Po#kIf>}YTngyv1g?|$F$?_``( zhEBf2HHJG}scy!4#wlxi>2XqqvQSGMO*5gxRqf&)H!x;kB6LbDG*japZYb&<_117l zk#+=RoNzQL3!RKpy^cm&q?IyGA%&*aMPFu@?;FWDDZ4@Cf>WwzIx*OTH z^p>z`up_X1d~mTsQ{#(y>d)MDzBpmixb~u4|2JwkRKsNOeUCI{i7u|IvygEb=m-p~ zpOSMlqZjNM2qBh{G6c`XpSx>RBXs&bU8~61C@i(mH2SG+*C@U+DnmdwC@nN<8K+R8 z6S2Ncp`qT&3_B$Um=Hp9NV{ZIE3E9gIx88c3_^26(=<0C!|z!bZ}T^bHx)u?X0%O4 zwOY!~FLWg1gwQ}Eayp?=?u@thVuc0>ooWi5=E^s(IyZ;V)GIU#ifK^Uk#Rz3z>jK6 zN?{OvR*{o&$|N+5jJB-*iW`b*kP{^1lu2lq53o6^QEz*eiG|l~N*0=rv`;De?!AK( zeMncfZidig5*oj62Xg|(LMJ~LaZPdU)lqrJDWjutyrYfUu>Tu;pt$zxs80*2cbh`f zR?rnOzXW^jz2iF;AyogcV`lvR%{v;$OWLZ*QSF>!D?(_bSAz!=8b4Qq*ccNUUvG$w z{o_^251lqbsQ0wlY}^g3H&Y%^v^&000000000000000000000Gb28v-<@_0RTPu>|em`je7;bEw7$ab^y?m zy*IdLiw{HhJX#42=P(06mzx>9 ziQP(Q7L+3Z?BION4vq(_KfL;K^53S6-O>OcEDOKA>tNRR493*}z*aXi_7|)R&1cFJ z05*6R;wYDOp}D3^0bmVxBF5Vgzv%x$<0pC$8vs}l?1<~lbDapE0Kjn`^7PAt&A%Y~ z1W-NKt;n2&{Ds?2s{BAX160dx$dGB5(74rqoS6+!AFkiO3~{t_r_lH>!PNlNCo<1M z&dYQ;8e9zkA`@R|ysJ5<`~eV|5FG6K$5&rYzBcT>2Y|>#3Y}J*5JCYIi4&JUQ;1Bb z(D)GQggOBziYxDAmZ`q*pwEA5L#WgCvyt$egv;i}spP?*LJ8nIjhtxg(Mm%Hk4K zXf{O0&EGt4uVY*eKoD;I_1%)NL=~D1(K%{A-1WqNHvSU Date: Thu, 25 Mar 2021 20:27:05 -0700 Subject: [PATCH 271/330] Removes outer toggle from files in `setup_blt.rst` --- docs/tutorial/setup_blt.rst | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index b6e98ab71..ed26bd17d 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -220,30 +220,24 @@ using gcc 4.9.3 on LLNL's Pascal cluster. Example files ------------- -.. container:: toggle expanded +Files related to setting up `blank_project`: - .. container:: label - - Files related to setting up `blank_project` - - .. +.. container:: toggle - .. container:: toggle - - .. container:: label + .. container:: label - ``CMakeLists.txt`` + ``CMakeLists.txt`` - .. literalinclude:: ./blank_project/CMakeLists.txt - :language: cmake - :linenos: + .. literalinclude:: ./blank_project/CMakeLists.txt + :language: cmake + :linenos: - .. container:: toggle +.. container:: toggle - .. container:: label + .. container:: label - ``gcc@4.9.3_nvcc host config`` + ``gcc@4.9.3_nvcc host config`` - .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake - :language: cmake - :linenos: + .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake + :language: cmake + :linenos: From 0243dbd21eefa95ed0d74c7532907bf1faeaa3d7 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 25 Mar 2021 20:55:20 -0700 Subject: [PATCH 272/330] Changes color of upper left navbar for docs --- docs/_static/style.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/_static/style.css b/docs/_static/style.css index 7af57188a..dd0b37810 100644 --- a/docs/_static/style.css +++ b/docs/_static/style.css @@ -26,3 +26,8 @@ .linebreak { opacity: 0.0; } + +/* Sidebar header (and topbar for mobile) */ +.wy-side-nav-search, .wy-nav-top { + background: #404040; +} \ No newline at end of file From 711f54025ce132c61e5fc9a5bf81993bc878186d Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Fri, 26 Mar 2021 10:32:39 -0700 Subject: [PATCH 273/330] More tweaking of sphinx logo region Scales blt image in sphinx docs and recolors the background. --- docs/_static/style.css | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/_static/style.css b/docs/_static/style.css index dd0b37810..775d1a851 100644 --- a/docs/_static/style.css +++ b/docs/_static/style.css @@ -29,5 +29,9 @@ /* Sidebar header (and topbar for mobile) */ .wy-side-nav-search, .wy-nav-top { - background: #404040; -} \ No newline at end of file + background: #343131; +} + +a img.logo { + scale: 75% +} From dd9985d8e83210e630c084694efa566dd4594220 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Fri, 26 Mar 2021 10:37:22 -0700 Subject: [PATCH 274/330] Modifies sphinx pygments style to 'default' Per PR request. --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 2841f4145..6e65c9e2b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -87,7 +87,7 @@ #show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'default' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] From 67ea74edecdc693b63c24033d0dbfa0e8cecd218 Mon Sep 17 00:00:00 2001 From: Cyrus Harrison Date: Thu, 1 Apr 2021 16:06:52 -0700 Subject: [PATCH 275/330] a few minor changes and reminders (#468) * a few minor changes and reminders * typo * summit hconfig (wip) * typo * use jsrun * finish summit hc and example --- docs/tutorial/creating_execs_and_libs.rst | 11 ++- docs/tutorial/external_dependencies.rst | 69 ++++++++++++++++++- docs/tutorial/setup_blt.rst | 16 +++-- host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake | 68 ++++++++++++++++++ 4 files changed, 154 insertions(+), 10 deletions(-) create mode 100644 host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index cf8d72425..6d6097e59 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -16,7 +16,7 @@ We now move on to creating libraries and executables using two of BLT's core macros: ``blt_add_library()`` and ``blt_add_executable()``. We begin with a simple executable that calculates :math:`\pi` by numerical integration, -``example_1``. We will then extract that code into a library, which we link +``example_1``. We then extract that code into a library, which we link into a new executable, ``example_2``. @@ -125,6 +125,15 @@ the linker removing unused symbols in the larger library. as possible, you need to define object libraries before you use them if you need their inheritable information to be correct. +.. +.. ------------------------------------ +.. CYRUS NOTE: +.. Object Libraries CUDA Considerations +.. this seems like a detour given we haven't talked about CUDA yet +.. ------------------------------------ +.. + + If you are using separable CUDA compilation (relocatable device code) in your object library, users of that library will be required to use NVCC to link their executables - in general, only NVCC can perform the "device link" step. To remove diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index df027a6e7..48164980d 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -44,7 +44,8 @@ Axom, it could export its ``axom`` target. To avoid introducing target name con ``calc_pi::axom``. This is especially helpful for "converting" external libraries that are not built with CMake -into CMake-friendly imported targets. +into CMake-friendly imported targets. + BLT also supports using ``blt_register_library()`` to provide additional options for existing CMake targets. The implementation doesn't modify the properties of the existing targets, @@ -55,6 +56,10 @@ but ``blt_register_library()`` is still available for compatibility. ``blt_impo is generally usable as a drop-in replacement, though it does not support the creation of targets with the same name as a target that already exists. + +Both ``blt_import_library()`` and ``blt_register_library()`` are compatible with +libraries that *do* provide CMake-friendly targets. + .. note:: Because CMake targets are only accessible from within the directory they were defined (including subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files @@ -221,7 +226,7 @@ Here is an example of how to add an OpenMP enabled test that sets the amount of Example Host-configs -------------------- -Here are the full example host-config files that use gcc 4.9.3 for LLNL's Pascal, Ray, and Quartz Clusters. +Here are the full example host-config files for LLNL's Pascal, Ray, and Quartz Clusters. :download:`llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake <../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake>` @@ -231,6 +236,9 @@ Here are the full example host-config files that use gcc 4.9.3 for LLNL's Pascal .. note:: Quartz does not have GPUs, so CUDA is not enabled in the Quartz host-config. +Here is a full example host-config file for an OSX laptop, using a set of dependencies built with spack. + + Here is a full example host-config file for an OSX laptop, using a set of dependencies built with spack. :download:`darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake <../../host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake>` @@ -324,3 +332,60 @@ And here is how to build and test the code on Ray: 100% tests passed, 0 tests failed out of 7 Total Test time (real) = 2.47 sec + + +Building and Testing on Summit +------------------------------- + +Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA +enabled on the OLCF Summit cluster: + +.. code-block:: bash + + # load the cmake module + module load cmake + # create build dir + mkdir build + cd build + # configure using host-config + cmake -C ../../host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake .. + + +And here is how to build and test the code on Summit: + +.. code-block:: console + + bash-4.2$ bsub -W 30 -nnodes 1 -P -Is /bin/bash + bash-4.2$ module load gcc cuda + bash-4.2$ make + bash-4.2$ make test + + Running tests... + Test project /projects/blt/docs/tutorial/calc_pi/build + Start 1: test_1 + 1/11 Test #1: test_1 ........................... Passed 0.00 sec + Start 2: test_2 + 2/11 Test #2: test_2 ........................... Passed 1.03 sec + Start 3: test_3 + 3/11 Test #3: test_3 ........................... Passed 0.21 sec + Start 4: blt_gtest_smoke + 4/11 Test #4: blt_gtest_smoke .................. Passed 0.00 sec + Start 5: blt_fruit_smoke + 5/11 Test #5: blt_fruit_smoke .................. Passed 0.00 sec + Start 6: blt_mpi_smoke + 6/11 Test #6: blt_mpi_smoke .................... Passed 0.76 sec + Start 7: blt_cuda_smoke + 7/11 Test #7: blt_cuda_smoke ................... Passed 0.22 sec + Start 8: blt_cuda_runtime_smoke + 8/11 Test #8: blt_cuda_runtime_smoke ........... Passed 0.07 sec + Start 9: blt_cuda_version_smoke + 9/11 Test #9: blt_cuda_version_smoke ........... Passed 0.06 sec + Start 10: blt_cuda_mpi_smoke + 10/11 Test #10: blt_cuda_mpi_smoke ............... Passed 0.80 sec + Start 11: blt_cuda_gtest_smoke + 11/11 Test #11: blt_cuda_gtest_smoke ............. Passed 0.21 sec + + 100% tests passed, 0 tests failed out of 11 + + Total Test time (real) = 3.39 sec + diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index ed26bd17d..95b1a1b6e 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -10,7 +10,7 @@ Setup BLT in your CMake Project BLT is easy to include in your CMake project whether it is an existing project or you are starting from scratch. This tutorial assumes you are using git but those -commands can easily changed or ignored. +commands can easily be changed or ignored. Include BLT in your Git Repository @@ -31,7 +31,7 @@ This example adds BLT as a submodule, commits, and pushes the changes to your re **Copy BLT into a subdirectory in your repository** -This example will clone BLT into your repository and remove the unneeded +This example will clone a copy of BLT into your repository and remove the unneeded git files from the clone. It then commits and pushes the changes to your repository. @@ -54,7 +54,7 @@ line in your base ``CMakeLists.txt`` after your ``project()`` call. include(blt/SetupBLT.cmake) -This enables all of BLT's features in your project. +This enables all of BLT's features in your project. However if your project is likely to be used by other projects. The following is recommended: @@ -65,9 +65,11 @@ is recommended: :language: cmake This is a robust way of setting up BLT and supports an optional external BLT source -directory via the command line option ``BLT_SOURCE_DIR``. This allows the use of a common -BLT across large projects. There are some helpful error messages if the BLT submodule -is missing as well as the commands to solve it. +directory via the command line option ``BLT_SOURCE_DIR``. +Using the external BLT source directory allows you to use single BLT +instance across multiple independent CMake projects. +This also adds helpful error messages if the BLT submodule is missing +as well as the commands to solve it. Running CMake @@ -96,7 +98,7 @@ If you are using BLT outside of your project pass the location of BLT as follows Example: blank_project ---------------------- -The ``blank_project`` example is provided to show you some of BLT's built-in +The ``blank_project`` example shows you some of BLT's built-in features. It demonstrates the bare minimum required for testing purposes. Here is the entire CMakeLists.txt file for ``blank_project``: diff --git a/host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake b/host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake new file mode 100644 index 000000000..8ad9e9b19 --- /dev/null +++ b/host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake @@ -0,0 +1,68 @@ +# Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level COPYRIGHT file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) + +#------------------------------------------------------------------------------ +# Example host-config file for the Summit cluster at the OLCF +#------------------------------------------------------------------------------ +# This file provides CMake with paths / details for: +# C,C++, & Fortran compilers + MPI & CUDA +# +# As of 3/29/2021 - these settings match summit modules: +# gcc +# cuda +# +# We recommend loading these modules. +# +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# gcc@9.4.3 compilers +#------------------------------------------------------------------------------ +# _blt_tutorial_compiler_config_start +set(GCC_HOME "/sw/summit/gcc/6.4.0") +set(CMAKE_C_COMPILER "${GCC_HOME}/bin/gcc" CACHE PATH "") +set(CMAKE_CXX_COMPILER "${GCC_HOME}/bin/g++" CACHE PATH "") + +# Fortran support +set(ENABLE_FORTRAN ON CACHE BOOL "") +set(CMAKE_Fortran_COMPILER "${GCC_HOME}/bin/gfortran" CACHE PATH "") +# _blt_tutorial_compiler_config_end + +#------------------------------------------------------------------------------ +# MPI Support +#------------------------------------------------------------------------------ +# _blt_tutorial_mpi_config_start +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_HOME "/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-6.4.0/spectrum-mpi-10.3.1.2-20200121-awz2q5brde7wgdqqw4ugalrkukeub4eb") +set(MPI_C_COMPILER "${MPI_HOME}/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "${MPI_HOME}/bin/mpicxx" CACHE PATH "") + +set(MPI_Fortran_COMPILER "${MPI_HOME}/bin/mpif90" CACHE PATH "") + +set(MPIEXEC_EXECUTABLE "/sw/summit/xalt/1.2.1/bin/jsrun" CACHE PATH "") + +# _blt_tutorial_mpi_config_end + +#------------------------------------------------------------------------------ +# CUDA support +#------------------------------------------------------------------------------ +# _blt_tutorial_cuda_config_start +set(ENABLE_CUDA ON CACHE BOOL "") + +set(CUDA_TOOLKIT_ROOT_DIR "/sw/summit/cuda/10.1.243/" CACHE PATH "") +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") +set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "") + +set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "") +set(_cuda_arch "sm_${CMAKE_CUDA_ARCHITECTURES}") +set(CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-lambda -G" + CACHE STRING "") + +set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") + +# _blt_tutorial_cuda_config_end + From 887e855e36253a3d652332fa8240a9e43f97b229 Mon Sep 17 00:00:00 2001 From: Cyrus Harrison Date: Fri, 2 Apr 2021 09:43:34 -0700 Subject: [PATCH 276/330] tutorial landing page additions --- docs/tutorial/index.rst | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index db5da051a..de7b62cdb 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -15,13 +15,35 @@ This tutorial provides instructions for: * Using external project dependencies * Creating documentation with Sphinx and Doxygen -The tutorial provides several examples that calculate the value of :math:`\pi` +The two example CMake projects used are included in BLT's source tree at: + +* ``/cmake/docs/tutorial/blank_project`` +* ``/cmake/docs/tutorial/calc_pi`` + +Here are direct links to the projects in BLT's GitHub repo: + +* https://github.com/LLNL/blt/tree/develop/docs/tutorial/blank_project +* https://github.com/LLNL/blt/tree/develop/docs/tutorial/calc_pi + + +``blank_project`` provides a minimum template for starting a new project and +``calc_pi`` provides several examples that calculate the value of :math:`\pi` by approximating the integral :math:`f(x) = \int_0^14/(1+x^2)` using numerical -integration. The code is adapted from ANL `here `_. +integration. The code is adapted from ANL's `using mpi examples `_. -The tutorial requires a C++ compiler and CMake, we recommend using CMake 3.8.0 or newer. + +Most of the tutorial focuses on the BLT features used to create the complete +``calc_pi`` project. + + +The tutorial requires a C++ compiler and CMake, we recommend using CMake 3.8.0 or newer. Parts of the tutorial also require MPI, CUDA, Sphinx, and Doxygen. +We provide instructions to build and run these projects on several +LLNL HPC platforms and ORNL's Summit platform. + +.. CYRUS NOTE: IF WE SEPARATE THE HOST CONFIG EXAMPLES, WE SHOULD CROSS LINK HERE. + .. toctree:: :maxdepth: 3 From 557f30d1a416d53392281cc818b409596d9a38a1 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 2 Apr 2021 15:55:16 -0700 Subject: [PATCH 277/330] correct copyright line to correct file --- SetupBLT.cmake | 2 +- azure-pipelines.yml | 2 +- cmake/BLTGitMacros.cmake | 2 +- cmake/BLTMacros.cmake | 2 +- cmake/BLTOptions.cmake | 2 +- cmake/BLTPrivateMacros.cmake | 2 +- cmake/SetupCodeChecks.cmake | 2 +- cmake/SetupCodeCoverageReports.cmake | 2 +- cmake/SetupCodeMetrics.cmake | 2 +- cmake/SetupCompilerOptions.cmake | 2 +- cmake/SetupDocs.cmake | 2 +- cmake/WrapAstyle.cmake.in | 2 +- cmake/clang-query-wrapper.py | 2 +- cmake/thirdparty/FindHIP.cmake | 2 +- cmake/thirdparty/FindHIP/run_hipcc.cmake | 2 +- cmake/thirdparty/FindHIP/run_make2cmake.cmake | 2 +- cmake/thirdparty/FindROCm.cmake | 2 +- cmake/thirdparty/SetupCUDA.cmake | 2 +- cmake/thirdparty/SetupHCC.cmake | 2 +- cmake/thirdparty/SetupHIP.cmake | 2 +- cmake/thirdparty/SetupMPI.cmake | 2 +- cmake/thirdparty/SetupOpenMP.cmake | 2 +- cmake/thirdparty/SetupThirdParty.cmake | 2 +- docs/CMakeLists.txt | 2 +- docs/api/code_check.rst | 2 +- docs/api/code_metric.rst | 2 +- docs/api/documentation.rst | 2 +- docs/api/git.rst | 2 +- docs/api/index.rst | 2 +- docs/api/target.rst | 2 +- docs/api/target_properties.rst | 2 +- docs/api/utility.rst | 2 +- docs/conf.py | 2 +- docs/index.rst | 2 +- docs/tutorial/creating_documentation.rst | 2 +- docs/tutorial/creating_execs_and_libs.rst | 2 +- docs/tutorial/exporting_blt_targets.rst | 2 +- docs/tutorial/external_dependencies.rst | 2 +- docs/tutorial/index.rst | 2 +- docs/tutorial/recommendations.rst | 2 +- docs/tutorial/setup_blt.rst | 2 +- docs/tutorial/unit_testing.rst | 2 +- docs/tutorial/using_flags.rst | 2 +- host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake | 2 +- .../blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake | 2 +- .../llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake | 2 +- .../clang@upstream_nvcc_c++17_no_separable.cmake | 2 +- .../llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake | 2 +- host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake | 2 +- host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake | 2 +- .../llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake | 2 +- host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake | 2 +- host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake | 2 +- host-configs/llnl/toss_3_x86_64_ib/pgi@20.1.cmake | 2 +- host-configs/llnl/windows/sqa-uno-msvc@15.cmake | 2 +- host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake | 2 +- host-configs/other/hcc.cmake | 2 +- host-configs/other/hip.cmake | 2 +- tests/internal/CMakeLists.txt | 2 +- tests/internal/src/Example.cpp | 2 +- tests/internal/src/Example.hpp | 2 +- tests/internal/src/Example_Exports.h | 2 +- tests/internal/src/HeaderOnly.hpp | 2 +- tests/internal/src/combine_static_library_test/CMakeLists.txt | 2 +- tests/internal/src/combine_static_library_test/Foo1.cpp | 2 +- tests/internal/src/combine_static_library_test/Foo1.hpp | 2 +- tests/internal/src/combine_static_library_test/Foo2.cpp | 2 +- tests/internal/src/combine_static_library_test/Foo2.hpp | 2 +- tests/internal/src/combine_static_library_test/Foo3.cpp | 2 +- tests/internal/src/combine_static_library_test/Foo3.hpp | 2 +- .../blt_combine_static_libraries_shared_smoke.cpp | 2 +- .../blt_combine_static_libraries_static_smoke.cpp | 2 +- tests/internal/src/combine_static_library_test/main.cpp | 2 +- tests/internal/src/hip_defines_test/CMakeLists.txt | 2 +- tests/internal/src/hip_defines_test/bar.cpp | 2 +- tests/internal/src/hip_defines_test/foo.cpp | 2 +- tests/internal/src/object_library_test/CMakeLists.txt | 2 +- tests/internal/src/object_library_test/base_object.cpp | 2 +- tests/internal/src/object_library_test/base_object.hpp | 2 +- .../src/object_library_test/inherited_base/CMakeLists.txt | 2 +- .../src/object_library_test/inherited_base/inherited_base.cpp | 2 +- .../src/object_library_test/inherited_base/inherited_base.hpp | 2 +- tests/internal/src/object_library_test/main.cpp | 2 +- tests/internal/src/object_library_test/object.cpp | 2 +- tests/internal/src/object_library_test/object.hpp | 2 +- tests/internal/src/static_analysis/CMakeLists.txt | 2 +- tests/internal/src/static_analysis/subtle_error_source.cpp | 2 +- tests/internal/src/static_analysis/well_analyzed_source.cpp | 2 +- tests/internal/src/t_example_compile_definitions.cpp | 2 +- tests/internal/src/t_example_smoke.cpp | 2 +- tests/internal/src/t_git_macros_smoke.cpp.in | 2 +- tests/internal/src/t_header_only_smoke.cpp | 2 +- tests/internal/src/test_cmake_format_conformant.cmake | 2 +- tests/internal/src/test_cmake_format_nonconformant.cmake | 2 +- .../src/test_cuda_device_call_from_kernel/CMakeLists.txt | 2 +- tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp | 2 +- tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp | 2 +- .../src/test_cuda_device_call_from_kernel/CudaTests.cpp | 2 +- tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp | 2 +- tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp | 2 +- tests/internal/src/test_cuda_mpi.cpp | 2 +- tests/smoke/CMakeLists.txt | 2 +- tests/smoke/blt_cuda_gtest_smoke.cpp | 2 +- tests/smoke/blt_cuda_mpi_smoke.cpp | 2 +- tests/smoke/blt_cuda_openmp_smoke.cpp | 2 +- tests/smoke/blt_cuda_runtime_smoke.cpp | 2 +- tests/smoke/blt_cuda_smoke.cpp | 2 +- tests/smoke/blt_cuda_version_smoke.cpp | 2 +- tests/smoke/blt_fruit_mpi_smoke.f90 | 2 +- tests/smoke/blt_fruit_smoke.f90 | 2 +- tests/smoke/blt_gbenchmark_smoke.cpp | 2 +- tests/smoke/blt_gmock_smoke.cpp | 2 +- tests/smoke/blt_gtest_smoke.cpp | 2 +- tests/smoke/blt_hcc_runtime_smoke.cpp | 2 +- tests/smoke/blt_hcc_smoke.cpp | 2 +- tests/smoke/blt_hip_gtest_smoke.cpp | 2 +- tests/smoke/blt_hip_runtime_smoke.cpp | 2 +- tests/smoke/blt_hip_smoke.cpp | 2 +- tests/smoke/blt_mpi_smoke.cpp | 2 +- tests/smoke/blt_openmp_smoke.cpp | 2 +- tests/smoke/fortran_driver.cpp | 2 +- tests/smoke/fortran_mpi_driver.cpp | 2 +- thirdparty_builtin/CMakeLists.txt | 2 +- 123 files changed, 123 insertions(+), 123 deletions(-) diff --git a/SetupBLT.cmake b/SetupBLT.cmake index 46707ad89..18fd75fad 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1914cf3e3..5a7bd9a33 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/BLTGitMacros.cmake b/cmake/BLTGitMacros.cmake index 014228d50..e08a5d432 100644 --- a/cmake/BLTGitMacros.cmake +++ b/cmake/BLTGitMacros.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 4c182270c..5fd6be7e3 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/BLTOptions.cmake b/cmake/BLTOptions.cmake index f400d5561..edd1e5168 100644 --- a/cmake/BLTOptions.cmake +++ b/cmake/BLTOptions.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) #------------------------------------------------------------------------------ diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index edb09eadc..82632c394 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/SetupCodeChecks.cmake b/cmake/SetupCodeChecks.cmake index 012662c27..8e3facda9 100644 --- a/cmake/SetupCodeChecks.cmake +++ b/cmake/SetupCodeChecks.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) #------------------------------------------------------------------------------ diff --git a/cmake/SetupCodeCoverageReports.cmake b/cmake/SetupCodeCoverageReports.cmake index bfd91513d..28717a9a7 100644 --- a/cmake/SetupCodeCoverageReports.cmake +++ b/cmake/SetupCodeCoverageReports.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2012 - 2015, Lars Bilke. See the top-level COPYRIGHT file for details +# Copyright (c) 2012 - 2015, Lars Bilke. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/SetupCodeMetrics.cmake b/cmake/SetupCodeMetrics.cmake index 1dfef7274..59e6dbb0b 100644 --- a/cmake/SetupCodeMetrics.cmake +++ b/cmake/SetupCodeMetrics.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) ################################################# diff --git a/cmake/SetupCompilerOptions.cmake b/cmake/SetupCompilerOptions.cmake index 513bb4634..db38469bd 100644 --- a/cmake/SetupCompilerOptions.cmake +++ b/cmake/SetupCompilerOptions.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/SetupDocs.cmake b/cmake/SetupDocs.cmake index 2cf26f3ea..d1ba9cda1 100644 --- a/cmake/SetupDocs.cmake +++ b/cmake/SetupDocs.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) #------------------------------------------------------------------------------ diff --git a/cmake/WrapAstyle.cmake.in b/cmake/WrapAstyle.cmake.in index a4fd3c231..dea031e81 100644 --- a/cmake/WrapAstyle.cmake.in +++ b/cmake/WrapAstyle.cmake.in @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/clang-query-wrapper.py b/cmake/clang-query-wrapper.py index 13aa13112..74026a6cb 100644 --- a/cmake/clang-query-wrapper.py +++ b/cmake/clang-query-wrapper.py @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/FindHIP.cmake b/cmake/thirdparty/FindHIP.cmake index 1c624d00c..3bc2235fc 100644 --- a/cmake/thirdparty/FindHIP.cmake +++ b/cmake/thirdparty/FindHIP.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/FindHIP/run_hipcc.cmake b/cmake/thirdparty/FindHIP/run_hipcc.cmake index 7f0c02b5a..7c3b46c6b 100644 --- a/cmake/thirdparty/FindHIP/run_hipcc.cmake +++ b/cmake/thirdparty/FindHIP/run_hipcc.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/FindHIP/run_make2cmake.cmake b/cmake/thirdparty/FindHIP/run_make2cmake.cmake index 30bf5930a..db23cc33d 100644 --- a/cmake/thirdparty/FindHIP/run_make2cmake.cmake +++ b/cmake/thirdparty/FindHIP/run_make2cmake.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/FindROCm.cmake b/cmake/thirdparty/FindROCm.cmake index 0b80fb841..9c0efe403 100644 --- a/cmake/thirdparty/FindROCm.cmake +++ b/cmake/thirdparty/FindROCm.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index b1346a44c..d78ef37f8 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupHCC.cmake b/cmake/thirdparty/SetupHCC.cmake index 48372b81e..9b4367bba 100644 --- a/cmake/thirdparty/SetupHCC.cmake +++ b/cmake/thirdparty/SetupHCC.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index 408ae6a9f..944ad83f3 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupMPI.cmake b/cmake/thirdparty/SetupMPI.cmake index 12c32abfe..812df35e0 100644 --- a/cmake/thirdparty/SetupMPI.cmake +++ b/cmake/thirdparty/SetupMPI.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupOpenMP.cmake b/cmake/thirdparty/SetupOpenMP.cmake index efd68c2a9..0620a8554 100644 --- a/cmake/thirdparty/SetupOpenMP.cmake +++ b/cmake/thirdparty/SetupOpenMP.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/cmake/thirdparty/SetupThirdParty.cmake b/cmake/thirdparty/SetupThirdParty.cmake index f632888ec..2cf788a20 100644 --- a/cmake/thirdparty/SetupThirdParty.cmake +++ b/cmake/thirdparty/SetupThirdParty.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 12bcf295f..92c95d1dc 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/code_check.rst b/docs/api/code_check.rst index 45d7ad466..b94a8d75a 100644 --- a/docs/api/code_check.rst +++ b/docs/api/code_check.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/code_metric.rst b/docs/api/code_metric.rst index 6753b7808..e2646ac44 100644 --- a/docs/api/code_metric.rst +++ b/docs/api/code_metric.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/documentation.rst b/docs/api/documentation.rst index 441e9318c..ddc115cec 100644 --- a/docs/api/documentation.rst +++ b/docs/api/documentation.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/git.rst b/docs/api/git.rst index d5afd775a..f05d8558b 100644 --- a/docs/api/git.rst +++ b/docs/api/git.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/index.rst b/docs/api/index.rst index 7eba026d0..cb31bb6ad 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/target.rst b/docs/api/target.rst index 752557304..ec8b80dca 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index e7fe1e9d9..4fbc0854b 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/api/utility.rst b/docs/api/utility.rst index 60d525805..6d7fd89ab 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/conf.py b/docs/conf.py index 6e65c9e2b..2eb0f29c6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/index.rst b/docs/index.rst index c27da10c4..82cafdfa6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/creating_documentation.rst b/docs/tutorial/creating_documentation.rst index c4a08976a..1354b350c 100644 --- a/docs/tutorial/creating_documentation.rst +++ b/docs/tutorial/creating_documentation.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index 6d6097e59..e1bb3d100 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/exporting_blt_targets.rst b/docs/tutorial/exporting_blt_targets.rst index 00328e7ca..17d5bf470 100644 --- a/docs/tutorial/exporting_blt_targets.rst +++ b/docs/tutorial/exporting_blt_targets.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 48164980d..369e824d9 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index de7b62cdb..2256edc66 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/recommendations.rst b/docs/tutorial/recommendations.rst index cea3947bf..7e49f58f8 100644 --- a/docs/tutorial/recommendations.rst +++ b/docs/tutorial/recommendations.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/setup_blt.rst index 95b1a1b6e..a36b669c3 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/setup_blt.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/unit_testing.rst b/docs/tutorial/unit_testing.rst index cbd039adb..5c7489e32 100644 --- a/docs/tutorial/unit_testing.rst +++ b/docs/tutorial/unit_testing.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/docs/tutorial/using_flags.rst b/docs/tutorial/using_flags.rst index a058c9953..861cf7864 100644 --- a/docs/tutorial/using_flags.rst +++ b/docs/tutorial/using_flags.rst @@ -1,5 +1,5 @@ .. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -.. # other BLT Project Developers. See the top-level COPYRIGHT file for details +.. # other BLT Project Developers. See the top-level LICENSE file for details .. # .. # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake b/host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake index 27634a054..61d07a4d1 100644 --- a/host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake +++ b/host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake index 76cbaf74e..36c6634f6 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake index 55167440b..dd741836d 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake index ade71e75b..2907ac1a4 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake index 85144a17e..a4c8806cc 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake index 79e879d56..1e4d7b741 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/pgi@20.4_nvcc.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake b/host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake index 1e9b92ee1..0566d9298 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/clang@4.0.0-libcxx.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake b/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake index 34ad8a24e..7f1556dfb 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/clang@6.0.0-static-analysis.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake index 83e3ef980..b837b547e 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake b/host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake index e39bc62ae..d83451926 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/toss_3_x86_64_ib/pgi@20.1.cmake b/host-configs/llnl/toss_3_x86_64_ib/pgi@20.1.cmake index 78f024677..8b8ed6575 100644 --- a/host-configs/llnl/toss_3_x86_64_ib/pgi@20.1.cmake +++ b/host-configs/llnl/toss_3_x86_64_ib/pgi@20.1.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/llnl/windows/sqa-uno-msvc@15.cmake b/host-configs/llnl/windows/sqa-uno-msvc@15.cmake index 655281f85..95c84018b 100644 --- a/host-configs/llnl/windows/sqa-uno-msvc@15.cmake +++ b/host-configs/llnl/windows/sqa-uno-msvc@15.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake b/host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake index 8ad9e9b19..b31ede032 100644 --- a/host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake +++ b/host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/other/hcc.cmake b/host-configs/other/hcc.cmake index 19605e361..8f3d08de3 100644 --- a/host-configs/other/hcc.cmake +++ b/host-configs/other/hcc.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/host-configs/other/hip.cmake b/host-configs/other/hip.cmake index f626b36e4..b97dcaaa9 100644 --- a/host-configs/other/hip.cmake +++ b/host-configs/other/hip.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index a5ba5b9b1..b090c57c5 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/Example.cpp b/tests/internal/src/Example.cpp index da2da41a2..380b3c1b2 100644 --- a/tests/internal/src/Example.cpp +++ b/tests/internal/src/Example.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/Example.hpp b/tests/internal/src/Example.hpp index 47e0620f6..6e7841c77 100644 --- a/tests/internal/src/Example.hpp +++ b/tests/internal/src/Example.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/Example_Exports.h b/tests/internal/src/Example_Exports.h index 327aebc7b..feb1a62fa 100644 --- a/tests/internal/src/Example_Exports.h +++ b/tests/internal/src/Example_Exports.h @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/HeaderOnly.hpp b/tests/internal/src/HeaderOnly.hpp index 0ee71714c..fa42fa1cb 100644 --- a/tests/internal/src/HeaderOnly.hpp +++ b/tests/internal/src/HeaderOnly.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/CMakeLists.txt b/tests/internal/src/combine_static_library_test/CMakeLists.txt index 2ad633fca..96faabbb5 100644 --- a/tests/internal/src/combine_static_library_test/CMakeLists.txt +++ b/tests/internal/src/combine_static_library_test/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo1.cpp b/tests/internal/src/combine_static_library_test/Foo1.cpp index 3613a21f7..6bc0f3f58 100644 --- a/tests/internal/src/combine_static_library_test/Foo1.cpp +++ b/tests/internal/src/combine_static_library_test/Foo1.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo1.hpp b/tests/internal/src/combine_static_library_test/Foo1.hpp index bae74edf7..439c733b5 100644 --- a/tests/internal/src/combine_static_library_test/Foo1.hpp +++ b/tests/internal/src/combine_static_library_test/Foo1.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo2.cpp b/tests/internal/src/combine_static_library_test/Foo2.cpp index fb1e339d6..9a8160408 100644 --- a/tests/internal/src/combine_static_library_test/Foo2.cpp +++ b/tests/internal/src/combine_static_library_test/Foo2.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo2.hpp b/tests/internal/src/combine_static_library_test/Foo2.hpp index 094589a4e..984d71c80 100644 --- a/tests/internal/src/combine_static_library_test/Foo2.hpp +++ b/tests/internal/src/combine_static_library_test/Foo2.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo3.cpp b/tests/internal/src/combine_static_library_test/Foo3.cpp index 4f95c4dad..ee5ba3be8 100644 --- a/tests/internal/src/combine_static_library_test/Foo3.cpp +++ b/tests/internal/src/combine_static_library_test/Foo3.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/Foo3.hpp b/tests/internal/src/combine_static_library_test/Foo3.hpp index 67cfe2676..9ebdd48fc 100644 --- a/tests/internal/src/combine_static_library_test/Foo3.hpp +++ b/tests/internal/src/combine_static_library_test/Foo3.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_shared_smoke.cpp b/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_shared_smoke.cpp index 9c8858290..4d3d28c43 100644 --- a/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_shared_smoke.cpp +++ b/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_shared_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_static_smoke.cpp b/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_static_smoke.cpp index 9c8858290..4d3d28c43 100644 --- a/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_static_smoke.cpp +++ b/tests/internal/src/combine_static_library_test/blt_combine_static_libraries_static_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/combine_static_library_test/main.cpp b/tests/internal/src/combine_static_library_test/main.cpp index 911f2b639..0e57cea15 100644 --- a/tests/internal/src/combine_static_library_test/main.cpp +++ b/tests/internal/src/combine_static_library_test/main.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/hip_defines_test/CMakeLists.txt b/tests/internal/src/hip_defines_test/CMakeLists.txt index ec1e621de..c5f3d5b39 100644 --- a/tests/internal/src/hip_defines_test/CMakeLists.txt +++ b/tests/internal/src/hip_defines_test/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/hip_defines_test/bar.cpp b/tests/internal/src/hip_defines_test/bar.cpp index 95746f245..487b91ee3 100644 --- a/tests/internal/src/hip_defines_test/bar.cpp +++ b/tests/internal/src/hip_defines_test/bar.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/hip_defines_test/foo.cpp b/tests/internal/src/hip_defines_test/foo.cpp index 9a8e0f55b..6db75427c 100644 --- a/tests/internal/src/hip_defines_test/foo.cpp +++ b/tests/internal/src/hip_defines_test/foo.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/CMakeLists.txt b/tests/internal/src/object_library_test/CMakeLists.txt index 8089e1f1c..a8aa578fb 100644 --- a/tests/internal/src/object_library_test/CMakeLists.txt +++ b/tests/internal/src/object_library_test/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/base_object.cpp b/tests/internal/src/object_library_test/base_object.cpp index cb232df26..bce52e83b 100644 --- a/tests/internal/src/object_library_test/base_object.cpp +++ b/tests/internal/src/object_library_test/base_object.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/base_object.hpp b/tests/internal/src/object_library_test/base_object.hpp index 1988e20fe..e3d98d60c 100644 --- a/tests/internal/src/object_library_test/base_object.hpp +++ b/tests/internal/src/object_library_test/base_object.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/inherited_base/CMakeLists.txt b/tests/internal/src/object_library_test/inherited_base/CMakeLists.txt index 7924031d7..e3b9aed82 100644 --- a/tests/internal/src/object_library_test/inherited_base/CMakeLists.txt +++ b/tests/internal/src/object_library_test/inherited_base/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/inherited_base/inherited_base.cpp b/tests/internal/src/object_library_test/inherited_base/inherited_base.cpp index 8cd7f85e2..116c59cd5 100644 --- a/tests/internal/src/object_library_test/inherited_base/inherited_base.cpp +++ b/tests/internal/src/object_library_test/inherited_base/inherited_base.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/inherited_base/inherited_base.hpp b/tests/internal/src/object_library_test/inherited_base/inherited_base.hpp index f623548e4..cd0a06c51 100644 --- a/tests/internal/src/object_library_test/inherited_base/inherited_base.hpp +++ b/tests/internal/src/object_library_test/inherited_base/inherited_base.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/main.cpp b/tests/internal/src/object_library_test/main.cpp index 9850db148..3e27582a2 100644 --- a/tests/internal/src/object_library_test/main.cpp +++ b/tests/internal/src/object_library_test/main.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/object.cpp b/tests/internal/src/object_library_test/object.cpp index aa32d50be..76706da0c 100644 --- a/tests/internal/src/object_library_test/object.cpp +++ b/tests/internal/src/object_library_test/object.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/object_library_test/object.hpp b/tests/internal/src/object_library_test/object.hpp index 91d28bdc6..b7aefda2b 100644 --- a/tests/internal/src/object_library_test/object.hpp +++ b/tests/internal/src/object_library_test/object.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/static_analysis/CMakeLists.txt b/tests/internal/src/static_analysis/CMakeLists.txt index e1e100d79..7addf9616 100644 --- a/tests/internal/src/static_analysis/CMakeLists.txt +++ b/tests/internal/src/static_analysis/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/static_analysis/subtle_error_source.cpp b/tests/internal/src/static_analysis/subtle_error_source.cpp index 582a29def..4226cc473 100644 --- a/tests/internal/src/static_analysis/subtle_error_source.cpp +++ b/tests/internal/src/static_analysis/subtle_error_source.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/static_analysis/well_analyzed_source.cpp b/tests/internal/src/static_analysis/well_analyzed_source.cpp index 9de872b0e..298b9c8c3 100644 --- a/tests/internal/src/static_analysis/well_analyzed_source.cpp +++ b/tests/internal/src/static_analysis/well_analyzed_source.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/t_example_compile_definitions.cpp b/tests/internal/src/t_example_compile_definitions.cpp index 82a18ffde..8f0f6fd03 100644 --- a/tests/internal/src/t_example_compile_definitions.cpp +++ b/tests/internal/src/t_example_compile_definitions.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/t_example_smoke.cpp b/tests/internal/src/t_example_smoke.cpp index 48cdc5aaf..a4c968646 100644 --- a/tests/internal/src/t_example_smoke.cpp +++ b/tests/internal/src/t_example_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/t_git_macros_smoke.cpp.in b/tests/internal/src/t_git_macros_smoke.cpp.in index 6b50487a4..6612c79e5 100644 --- a/tests/internal/src/t_git_macros_smoke.cpp.in +++ b/tests/internal/src/t_git_macros_smoke.cpp.in @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/t_header_only_smoke.cpp b/tests/internal/src/t_header_only_smoke.cpp index c7d01bb4c..53cf39a23 100644 --- a/tests/internal/src/t_header_only_smoke.cpp +++ b/tests/internal/src/t_header_only_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cmake_format_conformant.cmake b/tests/internal/src/test_cmake_format_conformant.cmake index 1e94279ba..64ae0b1a5 100644 --- a/tests/internal/src/test_cmake_format_conformant.cmake +++ b/tests/internal/src/test_cmake_format_conformant.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and other -# BLT Project Developers. See the top-level COPYRIGHT file for details +# BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) # ------------------------------------------------------------------------------ diff --git a/tests/internal/src/test_cmake_format_nonconformant.cmake b/tests/internal/src/test_cmake_format_nonconformant.cmake index 37407d8dd..29e86859c 100644 --- a/tests/internal/src/test_cmake_format_nonconformant.cmake +++ b/tests/internal/src/test_cmake_format_nonconformant.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and other -# BLT Project Developers. See the top-level COPYRIGHT file for details +# BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) # ------------------------------------------------------------------------------ diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/CMakeLists.txt b/tests/internal/src/test_cuda_device_call_from_kernel/CMakeLists.txt index 2de20fd8a..5cd0867e6 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/CMakeLists.txt +++ b/tests/internal/src/test_cuda_device_call_from_kernel/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp b/tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp index 7664ae266..c81443afa 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/Child.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp b/tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp index ba9dd5bfa..00f66f1c4 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/Child.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/CudaTests.cpp b/tests/internal/src/test_cuda_device_call_from_kernel/CudaTests.cpp index 5b5b69865..7680a2caf 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/CudaTests.cpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/CudaTests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp b/tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp index 239a507dd..a58532e12 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/Parent.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp b/tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp index 7d7a79b11..64ffe23f0 100644 --- a/tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp +++ b/tests/internal/src/test_cuda_device_call_from_kernel/Parent.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/internal/src/test_cuda_mpi.cpp b/tests/internal/src/test_cuda_mpi.cpp index 37524518b..8e288afe8 100644 --- a/tests/internal/src/test_cuda_mpi.cpp +++ b/tests/internal/src/test_cuda_mpi.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/CMakeLists.txt b/tests/smoke/CMakeLists.txt index 46b5cc475..8d3ef0d33 100644 --- a/tests/smoke/CMakeLists.txt +++ b/tests/smoke/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_gtest_smoke.cpp b/tests/smoke/blt_cuda_gtest_smoke.cpp index 7536f3324..098108e5e 100644 --- a/tests/smoke/blt_cuda_gtest_smoke.cpp +++ b/tests/smoke/blt_cuda_gtest_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_mpi_smoke.cpp b/tests/smoke/blt_cuda_mpi_smoke.cpp index b18a6867a..ccccb562e 100644 --- a/tests/smoke/blt_cuda_mpi_smoke.cpp +++ b/tests/smoke/blt_cuda_mpi_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_openmp_smoke.cpp b/tests/smoke/blt_cuda_openmp_smoke.cpp index 979462408..2bfd5c2d5 100644 --- a/tests/smoke/blt_cuda_openmp_smoke.cpp +++ b/tests/smoke/blt_cuda_openmp_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_runtime_smoke.cpp b/tests/smoke/blt_cuda_runtime_smoke.cpp index 154596852..9348594f4 100644 --- a/tests/smoke/blt_cuda_runtime_smoke.cpp +++ b/tests/smoke/blt_cuda_runtime_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_smoke.cpp b/tests/smoke/blt_cuda_smoke.cpp index 0bf7b3c2c..a3f21c88e 100644 --- a/tests/smoke/blt_cuda_smoke.cpp +++ b/tests/smoke/blt_cuda_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_cuda_version_smoke.cpp b/tests/smoke/blt_cuda_version_smoke.cpp index 6eb94cda2..97c43fa93 100644 --- a/tests/smoke/blt_cuda_version_smoke.cpp +++ b/tests/smoke/blt_cuda_version_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_fruit_mpi_smoke.f90 b/tests/smoke/blt_fruit_mpi_smoke.f90 index e61c842fd..160596205 100644 --- a/tests/smoke/blt_fruit_mpi_smoke.f90 +++ b/tests/smoke/blt_fruit_mpi_smoke.f90 @@ -1,5 +1,5 @@ ! Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -! other BLT Project Developers. See the top-level COPYRIGHT file for details +! other BLT Project Developers. See the top-level LICENSE file for details ! ! SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_fruit_smoke.f90 b/tests/smoke/blt_fruit_smoke.f90 index a7b342aa2..88dad321d 100644 --- a/tests/smoke/blt_fruit_smoke.f90 +++ b/tests/smoke/blt_fruit_smoke.f90 @@ -1,5 +1,5 @@ ! Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -! other BLT Project Developers. See the top-level COPYRIGHT file for details +! other BLT Project Developers. See the top-level LICENSE file for details ! ! SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_gbenchmark_smoke.cpp b/tests/smoke/blt_gbenchmark_smoke.cpp index 1db7cb056..bbc0176a9 100644 --- a/tests/smoke/blt_gbenchmark_smoke.cpp +++ b/tests/smoke/blt_gbenchmark_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_gmock_smoke.cpp b/tests/smoke/blt_gmock_smoke.cpp index 8d7d22ecb..d565a1949 100644 --- a/tests/smoke/blt_gmock_smoke.cpp +++ b/tests/smoke/blt_gmock_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_gtest_smoke.cpp b/tests/smoke/blt_gtest_smoke.cpp index 16f3afe6f..4511d059a 100644 --- a/tests/smoke/blt_gtest_smoke.cpp +++ b/tests/smoke/blt_gtest_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hcc_runtime_smoke.cpp b/tests/smoke/blt_hcc_runtime_smoke.cpp index 8c7113df0..b152acea8 100644 --- a/tests/smoke/blt_hcc_runtime_smoke.cpp +++ b/tests/smoke/blt_hcc_runtime_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hcc_smoke.cpp b/tests/smoke/blt_hcc_smoke.cpp index fe21cf88a..55bd6abd9 100644 --- a/tests/smoke/blt_hcc_smoke.cpp +++ b/tests/smoke/blt_hcc_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hip_gtest_smoke.cpp b/tests/smoke/blt_hip_gtest_smoke.cpp index f9bf6a13d..018935643 100644 --- a/tests/smoke/blt_hip_gtest_smoke.cpp +++ b/tests/smoke/blt_hip_gtest_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hip_runtime_smoke.cpp b/tests/smoke/blt_hip_runtime_smoke.cpp index 914fd51b9..09af2915f 100644 --- a/tests/smoke/blt_hip_runtime_smoke.cpp +++ b/tests/smoke/blt_hip_runtime_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_hip_smoke.cpp b/tests/smoke/blt_hip_smoke.cpp index 5983485fc..7138476ed 100644 --- a/tests/smoke/blt_hip_smoke.cpp +++ b/tests/smoke/blt_hip_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_mpi_smoke.cpp b/tests/smoke/blt_mpi_smoke.cpp index cef0cd98c..79fa2389c 100644 --- a/tests/smoke/blt_mpi_smoke.cpp +++ b/tests/smoke/blt_mpi_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/blt_openmp_smoke.cpp b/tests/smoke/blt_openmp_smoke.cpp index abd0fd8be..cd3743853 100644 --- a/tests/smoke/blt_openmp_smoke.cpp +++ b/tests/smoke/blt_openmp_smoke.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/fortran_driver.cpp b/tests/smoke/fortran_driver.cpp index 5f966ab0c..c2c015738 100644 --- a/tests/smoke/fortran_driver.cpp +++ b/tests/smoke/fortran_driver.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/tests/smoke/fortran_mpi_driver.cpp b/tests/smoke/fortran_mpi_driver.cpp index cee1a8d41..d327d072e 100644 --- a/tests/smoke/fortran_mpi_driver.cpp +++ b/tests/smoke/fortran_mpi_driver.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -// other BLT Project Developers. See the top-level COPYRIGHT file for details +// other BLT Project Developers. See the top-level LICENSE file for details // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/thirdparty_builtin/CMakeLists.txt b/thirdparty_builtin/CMakeLists.txt index d8031dde9..a222f8d91 100644 --- a/thirdparty_builtin/CMakeLists.txt +++ b/thirdparty_builtin/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and -# other BLT Project Developers. See the top-level COPYRIGHT file for details +# other BLT Project Developers. See the top-level LICENSE file for details # # SPDX-License-Identifier: (BSD-3-Clause) From 5a3b8b76c5acebb85bf3a4a82cb0c622f17838c1 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 2 Apr 2021 18:36:28 -0700 Subject: [PATCH 278/330] Only set INTERFACE scope on INTERFACE targets --- cmake/BLTPrivateMacros.cmake | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 82632c394..e7680c6d7 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -253,49 +253,51 @@ macro(blt_inherit_target_info) message( FATAL_ERROR "Must provide a FROM argument to the 'blt_inherit_target' macro" ) endif() + blt_determine_scope(TARGET ${arg_TO} OUT _scope) + get_target_property(_interface_system_includes ${arg_FROM} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) if ( _interface_system_includes ) - target_include_directories(${arg_TO} SYSTEM PUBLIC ${_interface_system_includes}) + target_include_directories(${arg_TO} SYSTEM ${_scope} ${_interface_system_includes}) endif() get_target_property(_interface_includes ${arg_FROM} INTERFACE_INCLUDE_DIRECTORIES) if ( _interface_includes ) - target_include_directories(${arg_TO} PUBLIC ${_interface_includes}) + target_include_directories(${arg_TO} ${_scope} ${_interface_includes}) endif() get_target_property(_interface_defines ${arg_FROM} INTERFACE_COMPILE_DEFINITIONS) if ( _interface_defines ) - target_compile_definitions( ${arg_TO} PUBLIC ${_interface_defines}) + target_compile_definitions( ${arg_TO} ${_scope} ${_interface_defines}) endif() if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) get_target_property(_interface_link_options ${arg_FROM} INTERFACE_LINK_OPTIONS) if ( _interface_link_options ) - target_link_options( ${arg_TO} PUBLIC ${_interface_link_options}) + target_link_options( ${arg_TO} ${_scope} ${_interface_link_options}) endif() endif() get_target_property(_interface_compile_options ${arg_FROM} INTERFACE_COMPILE_OPTIONS) if ( _interface_compile_options ) - target_compile_options( ${arg_TO} PUBLIC ${_interface_compile_options}) + target_compile_options( ${arg_TO} ${_scope} ${_interface_compile_options}) endif() if ( NOT arg_OBJECT ) get_target_property(_interface_link_directories ${arg_FROM} INTERFACE_LINK_DIRECTORIES) if ( _interface_link_directories ) - target_link_directories( ${arg_TO} PUBLIC ${_interface_link_directories}) + target_link_directories( ${arg_TO} ${_scope} ${_interface_link_directories}) endif() get_target_property(_interface_link_libraries ${arg_FROM} INTERFACE_LINK_LIBRARIES) if ( _interface_link_libraries ) - target_link_libraries( ${arg_TO} PUBLIC ${_interface_link_libraries}) + target_link_libraries( ${arg_TO} ${_scope} ${_interface_link_libraries}) endif() endif() From cbf3ca07c32979d87cdf1a8ac06851aba638bcc4 Mon Sep 17 00:00:00 2001 From: Josh Essman <68349992+joshessman-llnl@users.noreply.github.com> Date: Tue, 6 Apr 2021 07:33:34 -0500 Subject: [PATCH 279/330] fix: incorporate changes from @davidbeckingsale --- cmake/thirdparty/SetupHIP.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/thirdparty/SetupHIP.cmake b/cmake/thirdparty/SetupHIP.cmake index 944ad83f3..5437fb580 100644 --- a/cmake/thirdparty/SetupHIP.cmake +++ b/cmake/thirdparty/SetupHIP.cmake @@ -15,9 +15,9 @@ find_package(HIP REQUIRED) message(STATUS "HIP version: ${HIP_VERSION_STRING}") message(STATUS "HIP platform: ${HIP_PLATFORM}") -if(${HIP_PLATFORM} STREQUAL "hcc") +if("${HIP_PLATFORM}" STREQUAL "hcc" OR "${HIP_PLATFORM}" STREQUAL "amd") set(HIP_RUNTIME_DEFINE "__HIP_PLATFORM_HCC__") -elseif(${HIP_PLATFORM} STREQUAL "nvcc") +elseif("${HIP_PLATFORM}" STREQUAL "nvcc") set(HIP_RUNTIME_DEFINE "__HIP_PLATFORM_NVCC__") endif() if ( IS_DIRECTORY "${HIP_ROOT_DIR}/hcc/include" ) # this path only exists on older rocm installs From 3beb195f5074ee2c724f579982c88e96b64c7b61 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 6 Apr 2021 18:46:21 -0700 Subject: [PATCH 280/330] Renaming Setup BLT to Getting Started, Rename blank project to Bare Bones --- .../CMakeLists.txt | 4 +-- docs/tutorial/creating_execs_and_libs.rst | 2 +- .../{setup_blt.rst => getting_started.rst} | 32 +++++++++---------- docs/tutorial/index.rst | 8 ++--- 4 files changed, 23 insertions(+), 23 deletions(-) rename docs/tutorial/{blank_project => bare_bones}/CMakeLists.txt (95%) rename docs/tutorial/{setup_blt.rst => getting_started.rst} (88%) diff --git a/docs/tutorial/blank_project/CMakeLists.txt b/docs/tutorial/bare_bones/CMakeLists.txt similarity index 95% rename from docs/tutorial/blank_project/CMakeLists.txt rename to docs/tutorial/bare_bones/CMakeLists.txt index 9631f6808..1ce7baef6 100644 --- a/docs/tutorial/blank_project/CMakeLists.txt +++ b/docs/tutorial/bare_bones/CMakeLists.txt @@ -1,9 +1,9 @@ #------------------------------------------------------------------------------ -# BLT Tutorial Example: Blank Project. +# BLT Tutorial Example: Bare Bones Project. #------------------------------------------------------------------------------ cmake_minimum_required(VERSION 3.8) -project( blank ) +project( bare_bones ) # Note: This is specific to running our tests and shouldn't be exported to documentation if(NOT BLT_SOURCE_DIR) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_execs_and_libs.rst index e1bb3d100..d13cb890b 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_execs_and_libs.rst @@ -24,7 +24,7 @@ Example 1: Basic executable --------------------------- This example is as basic as it gets. After setting up a BLT CMake project, -like ``blank_project`` in the previous section, we can start using BLT's macros. +like the Bare Bones project in the previous section, we can start using BLT's macros. Creating an executable is as simple as calling the following macro: diff --git a/docs/tutorial/setup_blt.rst b/docs/tutorial/getting_started.rst similarity index 88% rename from docs/tutorial/setup_blt.rst rename to docs/tutorial/getting_started.rst index a36b669c3..861483ca0 100644 --- a/docs/tutorial/setup_blt.rst +++ b/docs/tutorial/getting_started.rst @@ -3,10 +3,10 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -.. _SetupBLTInYourCMakeProject: +.. _GettingStarted: -Setup BLT in your CMake Project -=============================== +Getting Started +=============== BLT is easy to include in your CMake project whether it is an existing project or you are starting from scratch. This tutorial assumes you are using git but those @@ -59,7 +59,7 @@ This enables all of BLT's features in your project. However if your project is likely to be used by other projects. The following is recommended: -.. literalinclude:: blank_project/CMakeLists.txt +.. literalinclude:: bare_bones/CMakeLists.txt :start-after: _blt_tutorial_include_blt_start :end-before: _blt_tutorial_include_blt_end :language: cmake @@ -95,18 +95,18 @@ If you are using BLT outside of your project pass the location of BLT as follows cmake -DBLT_SOURCE_DIR="path/to/blt" .. -Example: blank_project ----------------------- +Example: Bare Bones +------------------- -The ``blank_project`` example shows you some of BLT's built-in +The ``bare_bones`` example project shows you some of BLT's built-in features. It demonstrates the bare minimum required for testing purposes. -Here is the entire CMakeLists.txt file for ``blank_project``: +Here is the entire CMakeLists.txt file needed for a bare bones project: .. code-block:: cmake cmake_minimum_required(VERSION 3.8) - project( blank ) + project( bare_bones ) include(/path/to/blt/SetupBLT.cmake) @@ -119,7 +119,7 @@ For example if you run the following commands: .. code-block:: bash - cd /docs/tutorial/blank_project + cd /docs/tutorial/bare_bones cmake . you will get the following error: @@ -139,13 +139,13 @@ To correctly run cmake, create a build directory and run cmake from there: .. code-block:: bash - cd /docs/blank_project + cd /docs/bare_bones mkdir build cd build cmake .. This will generate a configured ``Makefile`` in your build directory to build -``blank_project``. The generated makefile includes gtest and several built-in +Bare Bones project. The generated makefile includes gtest and several built-in BLT *smoke* tests, depending on the features that you have enabled in your build. To build the project, use the following command: @@ -172,7 +172,7 @@ If everything went correctly, you should have the following output: .. code-block:: bash Running tests... - Test project blt/docs/tutorial/blank_project/build + Test project blt/docs/tutorial/bare_bones/build Start 1: blt_gtest_smoke 1/1 Test #1: blt_gtest_smoke .................. Passed 0.01 sec @@ -180,7 +180,7 @@ If everything went correctly, you should have the following output: Total Test time (real) = 0.10 sec -Note that the default options for ``blank_project`` only include a single test +Note that the default options for ``bare_bones`` only include a single test ``blt_gtest_smoke``. As we will see later on, BLT includes additional smoke tests that are activated when BLT is configured with other options enabled, like Fortran, MPI, OpenMP, and CUDA. @@ -222,7 +222,7 @@ using gcc 4.9.3 on LLNL's Pascal cluster. Example files ------------- -Files related to setting up `blank_project`: +Files related to setting up the Bare Bones project: .. container:: toggle @@ -230,7 +230,7 @@ Files related to setting up `blank_project`: ``CMakeLists.txt`` - .. literalinclude:: ./blank_project/CMakeLists.txt + .. literalinclude:: ./bare_bones/CMakeLists.txt :language: cmake :linenos: diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 2256edc66..76c86e692 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -17,16 +17,16 @@ This tutorial provides instructions for: The two example CMake projects used are included in BLT's source tree at: -* ``/cmake/docs/tutorial/blank_project`` +* ``/cmake/docs/tutorial/bare_bones`` * ``/cmake/docs/tutorial/calc_pi`` Here are direct links to the projects in BLT's GitHub repo: -* https://github.com/LLNL/blt/tree/develop/docs/tutorial/blank_project +* https://github.com/LLNL/blt/tree/develop/docs/tutorial/bare_bones * https://github.com/LLNL/blt/tree/develop/docs/tutorial/calc_pi -``blank_project`` provides a minimum template for starting a new project and +``bare_bones`` provides a minimum template for starting a new project and ``calc_pi`` provides several examples that calculate the value of :math:`\pi` by approximating the integral :math:`f(x) = \int_0^14/(1+x^2)` using numerical integration. The code is adapted from ANL's `using mpi examples `_. @@ -49,7 +49,7 @@ LLNL HPC platforms and ORNL's Summit platform. :maxdepth: 3 :caption: Tutorial Contents - setup_blt + getting_started creating_execs_and_libs using_flags unit_testing From 282a25b916a10168c66712e269bde5d7eff4ca3b Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 6 Apr 2021 19:12:52 -0700 Subject: [PATCH 281/330] Centralize host-config logic --- docs/tutorial/external_dependencies.rst | 168 ----------------- docs/tutorial/getting_started.rst | 43 ----- docs/tutorial/host_configs.rst | 239 ++++++++++++++++++++++++ docs/tutorial/index.rst | 1 + 4 files changed, 240 insertions(+), 211 deletions(-) create mode 100644 docs/tutorial/host_configs.rst diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index 369e824d9..b424fee2d 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -221,171 +221,3 @@ Here is an example of how to add an OpenMP enabled test that sets the amount of :start-after: _blt_tutorial_openmp_test_start :end-before: _blt_tutorial_openmp_test_end :language: cmake - - -Example Host-configs --------------------- - -Here are the full example host-config files for LLNL's Pascal, Ray, and Quartz Clusters. - -:download:`llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake <../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake>` - -:download:`llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake <../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake>` - -:download:`llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake <../../host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake>` - -.. note:: Quartz does not have GPUs, so CUDA is not enabled in the Quartz host-config. - -Here is a full example host-config file for an OSX laptop, using a set of dependencies built with spack. - - -Here is a full example host-config file for an OSX laptop, using a set of dependencies built with spack. - -:download:`darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake <../../host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake>` - - -Building and Testing on Pascal ------------------------------- - -Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA enabled on Pascal: - -.. code-block:: bash - - # create build dir - mkdir build - cd build - # configure using host-config - cmake -C ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake .. - -After building (``make``), you can run ``make test`` on a batch node (where the GPUs reside) -to run the unit tests that are using MPI and CUDA: - -.. code-block:: console - - bash-4.1$ salloc -A - bash-4.1$ make - bash-4.1$ make test - - Running tests... - Test project blt/docs/tutorial/calc_pi/build - Start 1: test_1 - 1/8 Test #1: test_1 ........................... Passed 0.01 sec - Start 2: test_2 - 2/8 Test #2: test_2 ........................... Passed 2.79 sec - Start 3: test_3 - 3/8 Test #3: test_3 ........................... Passed 0.54 sec - Start 4: blt_gtest_smoke - 4/8 Test #4: blt_gtest_smoke .................. Passed 0.01 sec - Start 5: blt_fruit_smoke - 5/8 Test #5: blt_fruit_smoke .................. Passed 0.01 sec - Start 6: blt_mpi_smoke - 6/8 Test #6: blt_mpi_smoke .................... Passed 2.82 sec - Start 7: blt_cuda_smoke - 7/8 Test #7: blt_cuda_smoke ................... Passed 0.48 sec - Start 8: blt_cuda_runtime_smoke - 8/8 Test #8: blt_cuda_runtime_smoke ........... Passed 0.11 sec - - 100% tests passed, 0 tests failed out of 8 - - Total Test time (real) = 6.80 sec - - -Building and Testing on Ray ---------------------------- - -Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA -enabled on the LLNL BlueOS Ray cluster: - -.. code-block:: bash - - # create build dir - mkdir build - cd build - # configure using host-config - cmake -C ../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake .. - -And here is how to build and test the code on Ray: - -.. code-block:: console - - bash-4.2$ lalloc 1 -G - bash-4.2$ make - bash-4.2$ make test - - Running tests... - Test project projects/blt/docs/tutorial/calc_pi/build - Start 1: test_1 - 1/7 Test #1: test_1 ........................... Passed 0.01 sec - Start 2: test_2 - 2/7 Test #2: test_2 ........................... Passed 1.24 sec - Start 3: test_3 - 3/7 Test #3: test_3 ........................... Passed 0.17 sec - Start 4: blt_gtest_smoke - 4/7 Test #4: blt_gtest_smoke .................. Passed 0.01 sec - Start 5: blt_mpi_smoke - 5/7 Test #5: blt_mpi_smoke .................... Passed 0.82 sec - Start 6: blt_cuda_smoke - 6/7 Test #6: blt_cuda_smoke ................... Passed 0.15 sec - Start 7: blt_cuda_runtime_smoke - 7/7 Test #7: blt_cuda_runtime_smoke ........... Passed 0.04 sec - - 100% tests passed, 0 tests failed out of 7 - - Total Test time (real) = 2.47 sec - - -Building and Testing on Summit -------------------------------- - -Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA -enabled on the OLCF Summit cluster: - -.. code-block:: bash - - # load the cmake module - module load cmake - # create build dir - mkdir build - cd build - # configure using host-config - cmake -C ../../host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake .. - - -And here is how to build and test the code on Summit: - -.. code-block:: console - - bash-4.2$ bsub -W 30 -nnodes 1 -P -Is /bin/bash - bash-4.2$ module load gcc cuda - bash-4.2$ make - bash-4.2$ make test - - Running tests... - Test project /projects/blt/docs/tutorial/calc_pi/build - Start 1: test_1 - 1/11 Test #1: test_1 ........................... Passed 0.00 sec - Start 2: test_2 - 2/11 Test #2: test_2 ........................... Passed 1.03 sec - Start 3: test_3 - 3/11 Test #3: test_3 ........................... Passed 0.21 sec - Start 4: blt_gtest_smoke - 4/11 Test #4: blt_gtest_smoke .................. Passed 0.00 sec - Start 5: blt_fruit_smoke - 5/11 Test #5: blt_fruit_smoke .................. Passed 0.00 sec - Start 6: blt_mpi_smoke - 6/11 Test #6: blt_mpi_smoke .................... Passed 0.76 sec - Start 7: blt_cuda_smoke - 7/11 Test #7: blt_cuda_smoke ................... Passed 0.22 sec - Start 8: blt_cuda_runtime_smoke - 8/11 Test #8: blt_cuda_runtime_smoke ........... Passed 0.07 sec - Start 9: blt_cuda_version_smoke - 9/11 Test #9: blt_cuda_version_smoke ........... Passed 0.06 sec - Start 10: blt_cuda_mpi_smoke - 10/11 Test #10: blt_cuda_mpi_smoke ............... Passed 0.80 sec - Start 11: blt_cuda_gtest_smoke - 11/11 Test #11: blt_cuda_gtest_smoke ............. Passed 0.21 sec - - 100% tests passed, 0 tests failed out of 11 - - Total Test time (real) = 3.39 sec - diff --git a/docs/tutorial/getting_started.rst b/docs/tutorial/getting_started.rst index 861483ca0..71f518379 100644 --- a/docs/tutorial/getting_started.rst +++ b/docs/tutorial/getting_started.rst @@ -185,39 +185,6 @@ Note that the default options for ``bare_bones`` only include a single test tests that are activated when BLT is configured with other options enabled, like Fortran, MPI, OpenMP, and CUDA. -Host-configs ------------- - -To capture (and revision control) build options, third party library paths, etc., -we recommend using CMake's initial-cache file mechanism. This feature allows you -to pass a file to CMake that provides variables to bootstrap the configuration -process. - -You can pass initial-cache files to cmake via the ``-C`` command line option. - -.. code-block:: bash - - cmake -C config_file.cmake - - -We call these initial-cache files ``host-config`` files since we typically create -a file for each platform or for specific hosts, if necessary. - -These files use standard CMake commands. CMake ``set()`` commands need to specify -``CACHE`` as follows: - -.. code-block:: cmake - - set(CMAKE_VARIABLE_NAME {VALUE} CACHE PATH "") - -Here is a snippet from a host-config file that specifies compiler details for -using gcc 4.9.3 on LLNL's Pascal cluster. - -.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake - :start-after: _blt_tutorial_compiler_config_start - :end-before: _blt_tutorial_compiler_config_end - :language: cmake - Example files ------------- @@ -233,13 +200,3 @@ Files related to setting up the Bare Bones project: .. literalinclude:: ./bare_bones/CMakeLists.txt :language: cmake :linenos: - -.. container:: toggle - - .. container:: label - - ``gcc@4.9.3_nvcc host config`` - - .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake - :language: cmake - :linenos: diff --git a/docs/tutorial/host_configs.rst b/docs/tutorial/host_configs.rst new file mode 100644 index 000000000..1e6b4a466 --- /dev/null +++ b/docs/tutorial/host_configs.rst @@ -0,0 +1,239 @@ +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level LICENSE file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +.. _HostConfigs: + +Host-configs +============ + +To capture (and revision control) build options, third party library paths, etc., +we recommend using CMake's initial-cache file mechanism. This feature allows you +to pass a file to CMake that provides variables to bootstrap the configuration +process. + +You can pass initial-cache files to cmake via the ``-C`` command line option. + +.. code-block:: bash + + cmake -C config_file.cmake + + +We call these initial-cache files ``host-config`` files since we typically create +a file for each platform or for specific hosts, if necessary. + +These files use standard CMake commands. CMake ``set()`` commands need to specify +``CACHE`` as follows: + +.. code-block:: cmake + + set(CMAKE_VARIABLE_NAME {VALUE} CACHE PATH "") + +Here is a snippet from a host-config file that specifies compiler details for +using gcc 4.9.3 on LLNL's Pascal cluster. + +.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake + :start-after: _blt_tutorial_compiler_config_start + :end-before: _blt_tutorial_compiler_config_end + :language: cmake + + +Building and Testing on Pascal +------------------------------ + +Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA enabled on Pascal: + +.. code-block:: bash + + # create build dir + mkdir build + cd build + # configure using host-config + cmake -C ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake .. + +After building (``make``), you can run ``make test`` on a batch node (where the GPUs reside) +to run the unit tests that are using MPI and CUDA: + +.. code-block:: console + + bash-4.1$ salloc -A + bash-4.1$ make + bash-4.1$ make test + + Running tests... + Test project blt/docs/tutorial/calc_pi/build + Start 1: test_1 + 1/8 Test #1: test_1 ........................... Passed 0.01 sec + Start 2: test_2 + 2/8 Test #2: test_2 ........................... Passed 2.79 sec + Start 3: test_3 + 3/8 Test #3: test_3 ........................... Passed 0.54 sec + Start 4: blt_gtest_smoke + 4/8 Test #4: blt_gtest_smoke .................. Passed 0.01 sec + Start 5: blt_fruit_smoke + 5/8 Test #5: blt_fruit_smoke .................. Passed 0.01 sec + Start 6: blt_mpi_smoke + 6/8 Test #6: blt_mpi_smoke .................... Passed 2.82 sec + Start 7: blt_cuda_smoke + 7/8 Test #7: blt_cuda_smoke ................... Passed 0.48 sec + Start 8: blt_cuda_runtime_smoke + 8/8 Test #8: blt_cuda_runtime_smoke ........... Passed 0.11 sec + + 100% tests passed, 0 tests failed out of 8 + + Total Test time (real) = 6.80 sec + + +Building and Testing on Ray +--------------------------- + +Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA +enabled on the LLNL BlueOS Ray cluster: + +.. code-block:: bash + + # create build dir + mkdir build + cd build + # configure using host-config + cmake -C ../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake .. + +And here is how to build and test the code on Ray: + +.. code-block:: console + + bash-4.2$ lalloc 1 -G + bash-4.2$ make + bash-4.2$ make test + + Running tests... + Test project projects/blt/docs/tutorial/calc_pi/build + Start 1: test_1 + 1/7 Test #1: test_1 ........................... Passed 0.01 sec + Start 2: test_2 + 2/7 Test #2: test_2 ........................... Passed 1.24 sec + Start 3: test_3 + 3/7 Test #3: test_3 ........................... Passed 0.17 sec + Start 4: blt_gtest_smoke + 4/7 Test #4: blt_gtest_smoke .................. Passed 0.01 sec + Start 5: blt_mpi_smoke + 5/7 Test #5: blt_mpi_smoke .................... Passed 0.82 sec + Start 6: blt_cuda_smoke + 6/7 Test #6: blt_cuda_smoke ................... Passed 0.15 sec + Start 7: blt_cuda_runtime_smoke + 7/7 Test #7: blt_cuda_runtime_smoke ........... Passed 0.04 sec + + 100% tests passed, 0 tests failed out of 7 + + Total Test time (real) = 2.47 sec + + +Building and Testing on Summit +------------------------------- + +Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA +enabled on the OLCF Summit cluster: + +.. code-block:: bash + + # load the cmake module + module load cmake + # create build dir + mkdir build + cd build + # configure using host-config + cmake -C ../../host-configs/olcf/summit/gcc@6.4.0_nvcc.cmake .. + + +And here is how to build and test the code on Summit: + +.. code-block:: console + + bash-4.2$ bsub -W 30 -nnodes 1 -P -Is /bin/bash + bash-4.2$ module load gcc cuda + bash-4.2$ make + bash-4.2$ make test + + Running tests... + Test project /projects/blt/docs/tutorial/calc_pi/build + Start 1: test_1 + 1/11 Test #1: test_1 ........................... Passed 0.00 sec + Start 2: test_2 + 2/11 Test #2: test_2 ........................... Passed 1.03 sec + Start 3: test_3 + 3/11 Test #3: test_3 ........................... Passed 0.21 sec + Start 4: blt_gtest_smoke + 4/11 Test #4: blt_gtest_smoke .................. Passed 0.00 sec + Start 5: blt_fruit_smoke + 5/11 Test #5: blt_fruit_smoke .................. Passed 0.00 sec + Start 6: blt_mpi_smoke + 6/11 Test #6: blt_mpi_smoke .................... Passed 0.76 sec + Start 7: blt_cuda_smoke + 7/11 Test #7: blt_cuda_smoke ................... Passed 0.22 sec + Start 8: blt_cuda_runtime_smoke + 8/11 Test #8: blt_cuda_runtime_smoke ........... Passed 0.07 sec + Start 9: blt_cuda_version_smoke + 9/11 Test #9: blt_cuda_version_smoke ........... Passed 0.06 sec + Start 10: blt_cuda_mpi_smoke + 10/11 Test #10: blt_cuda_mpi_smoke ............... Passed 0.80 sec + Start 11: blt_cuda_gtest_smoke + 11/11 Test #11: blt_cuda_gtest_smoke ............. Passed 0.21 sec + + 100% tests passed, 0 tests failed out of 11 + + Total Test time (real) = 3.39 sec + + +Example Host-configs +-------------------- + +Basic TOSS3 (for example: Quartz) host-config that has C, C++, and Fortran Compilers along with MPI support: + +.. container:: toggle + + .. container:: label + + ``gcc@8.3.1 host-config`` + + .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@8.3.1.cmake + :language: cmake + :linenos: + +Here are the full example host-config files for LLNL's Pascal, Ray, and Quartz Clusters that uses +the default compilers on the system: + +.. container:: toggle + + .. container:: label + + ``gcc@4.9.3 host-config`` + + .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake + :language: cmake + :linenos: + +More complicated BlueOS host-config that has C, C++, MPI, and CUDA support: + +.. container:: toggle + + .. container:: label + + ``clang@upstream C++17 host-config`` + + .. literalinclude:: ../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_c++17_no_separable.cmake + :language: cmake + :linenos: + +Here is a full example host-config file for an OSX laptop, using a set of dependencies built with Spack: + +.. container:: toggle + + .. container:: label + + ``OSX clang@7.3.0 host-config`` + + .. literalinclude:: ../../host-configs/darwin/elcapitan-x86_64/naples-clang@7.3.0.cmake + :language: cmake + :linenos: + diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 76c86e692..b2ed5d02e 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -51,6 +51,7 @@ LLNL HPC platforms and ORNL's Summit platform. getting_started creating_execs_and_libs + host_configs using_flags unit_testing external_dependencies From 2a15a03a9cea944542e24a26657069e223096d2f Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 12:11:20 -0700 Subject: [PATCH 282/330] rename page, fix reference --- ...reating_execs_and_libs.rst => creating_targets.rst} | 10 +++++----- docs/tutorial/unit_testing.rst | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) rename docs/tutorial/{creating_execs_and_libs.rst => creating_targets.rst} (96%) diff --git a/docs/tutorial/creating_execs_and_libs.rst b/docs/tutorial/creating_targets.rst similarity index 96% rename from docs/tutorial/creating_execs_and_libs.rst rename to docs/tutorial/creating_targets.rst index d13cb890b..48aebc376 100644 --- a/docs/tutorial/creating_execs_and_libs.rst +++ b/docs/tutorial/creating_targets.rst @@ -3,17 +3,17 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -.. _CreatingLibrariesAndExecutables: +.. _CreatingTargets: -Creating Libraries and Executables -================================== +Creating Targets +================ In the previous section, we learned the basics about how to create a CMake project with BLT, how to configure the project and how to build, and test BLT's built-in third party libraries. -We now move on to creating libraries and executables -using two of BLT's core macros: ``blt_add_library()`` and ``blt_add_executable()``. +We now move on to creating CMake targets using two of BLT's core macros: +``blt_add_library()`` and ``blt_add_executable()``. We begin with a simple executable that calculates :math:`\pi` by numerical integration, ``example_1``. We then extract that code into a library, which we link diff --git a/docs/tutorial/unit_testing.rst b/docs/tutorial/unit_testing.rst index 5c7489e32..db9c735df 100644 --- a/docs/tutorial/unit_testing.rst +++ b/docs/tutorial/unit_testing.rst @@ -176,7 +176,7 @@ by first generating an executable for the test using the and allows users to pass in command line arguments. -Returning to our running example (see :ref:`CreatingLibrariesAndExecutables:`), +Returning to our running example (see :ref:`CreatingTargets`), let's add a simple test for the ``calc_pi`` library, which has a single function with signature: From 94fcc5b4ec23e0c93a9c048fbfa199882da30a3d Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 12:25:25 -0700 Subject: [PATCH 283/330] Create advanced topics section --- docs/tutorial/advanced_topics.rst | 16 +++++++ docs/tutorial/index.rst | 3 +- docs/tutorial/object_libraries.rst | 67 ++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 docs/tutorial/advanced_topics.rst create mode 100644 docs/tutorial/object_libraries.rst diff --git a/docs/tutorial/advanced_topics.rst b/docs/tutorial/advanced_topics.rst new file mode 100644 index 000000000..4081d4440 --- /dev/null +++ b/docs/tutorial/advanced_topics.rst @@ -0,0 +1,16 @@ +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level LICENSE file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +Advanced Topics +=============== + +This section includes subpages on advanced topics such as: + + * :ref:`ObjectLibraries` : A collection of object files that are not linked or archived into a library + + +.. toctree:: + + object_libraries diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index b2ed5d02e..f4a1eef8f 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -52,8 +52,9 @@ LLNL HPC platforms and ORNL's Summit platform. getting_started creating_execs_and_libs host_configs - using_flags unit_testing + using_flags + advanced_topics external_dependencies exporting_blt_targets creating_documentation diff --git a/docs/tutorial/object_libraries.rst b/docs/tutorial/object_libraries.rst new file mode 100644 index 000000000..e45eaaa56 --- /dev/null +++ b/docs/tutorial/object_libraries.rst @@ -0,0 +1,67 @@ +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level LICENSE file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +.. _ObjectLibraries: + +Object Libraries +================ + +BLT has simplified the use of CMake object libraries through the +``blt_add_library()`` macro. Object libraries are a collection of object files +that are not linked or archived into a library. They are used in other libraries +or executables through the ``DEPENDS_ON`` macro argument. This is generally +useful for combining smaller libraries into a larger library without +the linker removing unused symbols in the larger library. + +.. code-block:: cmake + + blt_add_library(NAME myObjectLibrary + SOURCES source1.cpp + HEADERS header1.cpp + OBJECT TRUE) + + blt_add_exectuble(NAME helloWorld + SOURCES main.cpp + DEPENDS_ON myObjectLibrary) + +.. note:: + Due to record keeping on BLT's part to make object libraries as easy to use + as possible, you need to define object libraries before you use them + if you need their inheritable information to be correct. + +.. +.. ------------------------------------ +.. CYRUS NOTE: +.. Object Libraries CUDA Considerations +.. this seems like a detour given we haven't talked about CUDA yet +.. ------------------------------------ +.. + + +If you are using separable CUDA compilation (relocatable device code) in your +object library, users of that library will be required to use NVCC to link their +executables - in general, only NVCC can perform the "device link" step. To remove +this restriction, you can enable the ``CUDA_RESOLVE_DEVICE_SYMBOLS`` property on +an object library: + +.. code-block:: cmake + + set_target_properties(myObjectLibrary PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON) + +To enable this device linking step for all libraries in your project (including object libraries), you +can set the ``CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS`` option to ``ON``. This defaults the +``CUDA_RESOLVE_DEVICE_SYMBOLS`` target property to ``ON`` for all targets created by BLT. + +You can read more about this property in the +`CMake documentation `_. + +.. note:: + These options only apply when an object library in your project is linked later + into a shared or static library, in which case a separate object file containing + device symbols is created and added to the "final" library. Object libraries + provided directly to users of your project will still require a device link step. + +The ``CUDA_RESOLVE_DEVICE_SYMBOLS`` property is also supported for static and shared libraries. +By default, it is enabled for shared libraries but disabled for static libraries. From e102caa34fafd7c049bf8ad729c6c7619d6b38a7 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 12:28:46 -0700 Subject: [PATCH 284/330] move compiler flags under advanced --- docs/tutorial/advanced_topics.rst | 2 ++ docs/tutorial/index.rst | 1 - docs/tutorial/{using_flags.rst => portable_compiler_flags.rst} | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) rename docs/tutorial/{using_flags.rst => portable_compiler_flags.rst} (98%) diff --git a/docs/tutorial/advanced_topics.rst b/docs/tutorial/advanced_topics.rst index 4081d4440..beac6994f 100644 --- a/docs/tutorial/advanced_topics.rst +++ b/docs/tutorial/advanced_topics.rst @@ -8,9 +8,11 @@ Advanced Topics This section includes subpages on advanced topics such as: + * :ref:`PortableCompilerFlags` : Managing compiler flags across compiler families * :ref:`ObjectLibraries` : A collection of object files that are not linked or archived into a library .. toctree:: + portable_compiler_flags object_libraries diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index f4a1eef8f..0e6a1c2f0 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -53,7 +53,6 @@ LLNL HPC platforms and ORNL's Summit platform. creating_execs_and_libs host_configs unit_testing - using_flags advanced_topics external_dependencies exporting_blt_targets diff --git a/docs/tutorial/using_flags.rst b/docs/tutorial/portable_compiler_flags.rst similarity index 98% rename from docs/tutorial/using_flags.rst rename to docs/tutorial/portable_compiler_flags.rst index 861cf7864..5ba7bb056 100644 --- a/docs/tutorial/using_flags.rst +++ b/docs/tutorial/portable_compiler_flags.rst @@ -3,7 +3,7 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -.. _PortabltCompilerFlags: +.. _PortableCompilerFlags: Portable Compiler Flags ======================= From 593aa9521a9ea9ad8b0a072f2288bb3ab057a33a Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 12:31:39 -0700 Subject: [PATCH 285/330] renaming tests page --- docs/tutorial/{unit_testing.rst => adding_tests.rst} | 6 +++--- docs/tutorial/external_dependencies.rst | 2 +- docs/tutorial/index.rst | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename docs/tutorial/{unit_testing.rst => adding_tests.rst} (99%) diff --git a/docs/tutorial/unit_testing.rst b/docs/tutorial/adding_tests.rst similarity index 99% rename from docs/tutorial/unit_testing.rst rename to docs/tutorial/adding_tests.rst index db9c735df..a23df9d46 100644 --- a/docs/tutorial/unit_testing.rst +++ b/docs/tutorial/adding_tests.rst @@ -3,9 +3,9 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -.. _UnitTesting: +.. _AddingTests: -Unit Testing +Adding Tests ============ BLT has a built-in copy of the @@ -21,7 +21,7 @@ In this section, we give a brief overview of GoogleTest and discuss how to add u tests using the ``blt_add_test()`` macro. -Configuring tests within BLT +Configuring Tests within BLT ---------------------------- Unit testing in BLT is controlled by the ``ENABLE_TESTS`` cmake option and is on diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/external_dependencies.rst index b424fee2d..e3cf8f742 100644 --- a/docs/tutorial/external_dependencies.rst +++ b/docs/tutorial/external_dependencies.rst @@ -123,7 +123,7 @@ to launch. We use the ``NUM_MPI_TASKS`` argument to ``blt_add_test()`` macro. :language: cmake -As mentioned in :ref:`UnitTesting`, GoogleTest provides a default ``main()`` +As mentioned in :ref:`AddingTests`, GoogleTest provides a default ``main()`` driver that will execute all unit tests defined in the source. To test MPI code, we need to create a main that initializes and finalizes MPI in addition to Google Test. ``test_2.cpp`` provides an example driver for MPI with GoogleTest. diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 0e6a1c2f0..3eb3dc14d 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -51,8 +51,8 @@ LLNL HPC platforms and ORNL's Summit platform. getting_started creating_execs_and_libs + adding_tests host_configs - unit_testing advanced_topics external_dependencies exporting_blt_targets From 0554a59fdf44495d787e6d48a89b5a62191c5ff3 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 12:49:52 -0700 Subject: [PATCH 286/330] Fix toc --- docs/tutorial/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 3eb3dc14d..3aa37d5a5 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -50,7 +50,7 @@ LLNL HPC platforms and ORNL's Summit platform. :caption: Tutorial Contents getting_started - creating_execs_and_libs + creating_targets adding_tests host_configs advanced_topics From ad5ad91409c8fb01526955706d001fe1a3156124 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 13:37:36 -0700 Subject: [PATCH 287/330] Remove object/cuda references from creating targets page --- docs/tutorial/creating_targets.rst | 61 ------------------------------ 1 file changed, 61 deletions(-) diff --git a/docs/tutorial/creating_targets.rst b/docs/tutorial/creating_targets.rst index 48aebc376..9f1d0bdc5 100644 --- a/docs/tutorial/creating_targets.rst +++ b/docs/tutorial/creating_targets.rst @@ -98,64 +98,3 @@ into this executable without any more work or extra CMake function calls. such as overriding the output name of the library and the output directory. It defaults to building a static library unless you override it with ``SHARED`` or with the global CMake option ``BUILD_SHARED_LIBS``. - -Object Libraries ----------------- - -BLT has simplified the use of CMake object libraries through the -``blt_add_library()`` macro. Object libraries are a collection of object files -that are not linked or archived into a library. They are used in other libraries -or executables through the ``DEPENDS_ON`` macro argument. This is generally -useful for combining smaller libraries into a larger library without -the linker removing unused symbols in the larger library. - -.. code-block:: cmake - - blt_add_library(NAME myObjectLibrary - SOURCES source1.cpp - HEADERS header1.cpp - OBJECT TRUE) - - blt_add_exectuble(NAME helloWorld - SOURCES main.cpp - DEPENDS_ON myObjectLibrary) - -.. note:: - Due to record keeping on BLT's part to make object libraries as easy to use - as possible, you need to define object libraries before you use them - if you need their inheritable information to be correct. - -.. -.. ------------------------------------ -.. CYRUS NOTE: -.. Object Libraries CUDA Considerations -.. this seems like a detour given we haven't talked about CUDA yet -.. ------------------------------------ -.. - - -If you are using separable CUDA compilation (relocatable device code) in your -object library, users of that library will be required to use NVCC to link their -executables - in general, only NVCC can perform the "device link" step. To remove -this restriction, you can enable the ``CUDA_RESOLVE_DEVICE_SYMBOLS`` property on -an object library: - -.. code-block:: cmake - - set_target_properties(myObjectLibrary PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON) - -To enable this device linking step for all libraries in your project (including object libraries), you -can set the ``CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS`` option to ``ON``. This defaults the -``CUDA_RESOLVE_DEVICE_SYMBOLS`` target property to ``ON`` for all targets created by BLT. - -You can read more about this property in the -`CMake documentation `_. - -.. note:: - These options only apply when an object library in your project is linked later - into a shared or static library, in which case a separate object file containing - device symbols is created and added to the "final" library. Object libraries - provided directly to users of your project will still require a device link step. - -The ``CUDA_RESOLVE_DEVICE_SYMBOLS`` property is also supported for static and shared libraries. -By default, it is enabled for shared libraries but disabled for static libraries. From 9727ea54bb5b018f3638138b62a91d4a2676a5a0 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 13:37:50 -0700 Subject: [PATCH 288/330] Remove now unneeded note --- docs/tutorial/object_libraries.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/tutorial/object_libraries.rst b/docs/tutorial/object_libraries.rst index e45eaaa56..3c5cc36b1 100644 --- a/docs/tutorial/object_libraries.rst +++ b/docs/tutorial/object_libraries.rst @@ -31,15 +31,6 @@ the linker removing unused symbols in the larger library. as possible, you need to define object libraries before you use them if you need their inheritable information to be correct. -.. -.. ------------------------------------ -.. CYRUS NOTE: -.. Object Libraries CUDA Considerations -.. this seems like a detour given we haven't talked about CUDA yet -.. ------------------------------------ -.. - - If you are using separable CUDA compilation (relocatable device code) in your object library, users of that library will be required to use NVCC to link their executables - in general, only NVCC can perform the "device link" step. To remove From 6c0cfc174aa5a427ef62ef9a7f53eaaa0d3788ac Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 13:38:09 -0700 Subject: [PATCH 289/330] Rename external dependencies --- .../tutorial/{external_dependencies.rst => importing_targets.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/tutorial/{external_dependencies.rst => importing_targets.rst} (100%) diff --git a/docs/tutorial/external_dependencies.rst b/docs/tutorial/importing_targets.rst similarity index 100% rename from docs/tutorial/external_dependencies.rst rename to docs/tutorial/importing_targets.rst From 41617c711d0dec7302f47780120dc3b0c59d1d96 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 13:44:20 -0700 Subject: [PATCH 290/330] rename exporting targets --- .../{exporting_blt_targets.rst => exporting_targets.rst} | 6 +++--- docs/tutorial/importing_targets.rst | 8 ++++---- docs/tutorial/index.rst | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) rename docs/tutorial/{exporting_blt_targets.rst => exporting_targets.rst} (96%) diff --git a/docs/tutorial/exporting_blt_targets.rst b/docs/tutorial/exporting_targets.rst similarity index 96% rename from docs/tutorial/exporting_blt_targets.rst rename to docs/tutorial/exporting_targets.rst index 17d5bf470..ccc920f28 100644 --- a/docs/tutorial/exporting_blt_targets.rst +++ b/docs/tutorial/exporting_targets.rst @@ -3,10 +3,10 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -.. _ExportingBLTCreatedTargets: +.. _ExportingTargets: -Exporting BLT Created Targets -============================= +Exporting Targets +================= BLT provides several built-in targets for commonly used libraries: diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index e3cf8f742..76a2deeda 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -3,10 +3,10 @@ .. # .. # SPDX-License-Identifier: (BSD-3-Clause) -.. _ExternalDependencies: +.. _ImportingTargets: -External Dependencies -===================== +Importing Targets +================= One key goal for BLT is to simplify the use of external dependencies when building your libraries and executables. @@ -72,7 +72,7 @@ would like BLT's provided third-party targets to also be exported (for example, your project does not use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other EXPORTABLE targets created by ``blt_import_library()``, these targets should be prefixed with the name of the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` -command can be used to modify the name of an installed target. See :ref:`ExportingBLTCreatedTargets:` +command can be used to modify the name of an installed target. See :ref:`ExportingTargets:` for more info. You have already seen one use of ``DEPENDS_ON`` for a BLT diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 3aa37d5a5..c6ce9a76e 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -53,8 +53,8 @@ LLNL HPC platforms and ORNL's Summit platform. creating_targets adding_tests host_configs - advanced_topics - external_dependencies - exporting_blt_targets + importing_targets + exporting_targets creating_documentation + advanced_topics recommendations From 808338786ef8cfbe69c7e39899ee9144f9f2a754 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 13:48:41 -0700 Subject: [PATCH 291/330] rename examples --- docs/tutorial/creating_targets.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/tutorial/creating_targets.rst b/docs/tutorial/creating_targets.rst index 9f1d0bdc5..f83c41b22 100644 --- a/docs/tutorial/creating_targets.rst +++ b/docs/tutorial/creating_targets.rst @@ -20,13 +20,13 @@ We begin with a simple executable that calculates :math:`\pi` by numerical integ into a new executable, ``example_2``. -Example 1: Basic executable ---------------------------- +Example 1: Stand-alone Executable +--------------------------------- This example is as basic as it gets. After setting up a BLT CMake project, like the Bare Bones project in the previous section, we can start using BLT's macros. -Creating an executable is as simple as calling the following macro: +Creating a stand-alone executable is as simple as calling the following macro: .. literalinclude:: calc_pi/CMakeLists.txt :start-after: _blt_tutorial_example_executable_start @@ -61,8 +61,8 @@ by running the following commands: will be more on that in the following section. -Example 2: One library, one executable --------------------------------------- +Example 2: Executable with a Library +------------------------------------ This example is a bit more exciting. This time we are creating a library that calculates the value of pi and then linking that library into an executable. From bea76a290dcfc8ae7b21f60cdd610e77b2f1083e Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 15:52:05 -0700 Subject: [PATCH 292/330] missing > --- docs/tutorial/creating_targets.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/creating_targets.rst b/docs/tutorial/creating_targets.rst index f83c41b22..c2b358308 100644 --- a/docs/tutorial/creating_targets.rst +++ b/docs/tutorial/creating_targets.rst @@ -43,7 +43,7 @@ by running the following commands: .. code-block:: bash - cd /docs/tutorial/calc_pi mkdir build cd build cmake -DBLT_SOURCE_DIR=../../.. .. From c3c83d720a345cc9dd723db5393959cf5d7fe8c0 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 18:14:53 -0700 Subject: [PATCH 293/330] Break importing targets into two subpages, add examples of TPL importing --- docs/tutorial/common_hpc_dependencies.rst | 173 +++++++++++++++++ docs/tutorial/importing_targets.rst | 224 ++-------------------- docs/tutorial/third_party_libraries.rst | 149 ++++++++++++++ 3 files changed, 337 insertions(+), 209 deletions(-) create mode 100644 docs/tutorial/common_hpc_dependencies.rst create mode 100644 docs/tutorial/third_party_libraries.rst diff --git a/docs/tutorial/common_hpc_dependencies.rst b/docs/tutorial/common_hpc_dependencies.rst new file mode 100644 index 000000000..9b06770b8 --- /dev/null +++ b/docs/tutorial/common_hpc_dependencies.rst @@ -0,0 +1,173 @@ +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level LICENSE file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +.. _CommonHPCDependencies: + +Common HPC Dependencies +======================= + +BLT creates named targets for the common HPC dependencies that most HPC projects need, such as +MPI, CUDA, HIP, and OpenMP. As previously mentioned in :ref:`AddingTests`, BLT also provides +bundled versions of GoogleTest, GoogleMock, GoogleBenchmark, and FRUIT. Not only are the source +for these included, we provide named CMake targets for them as well. + +BLT's ``mpi``, ``cuda``, ``cuda_runtime``, ``hip``, ``hip_runtime``,and ``openmp`` targets are +all defined via ``blt_import_library()``. This creates a true CMake imported target that is inherited +properly through the CMake dependency DAG. + +.. note:: + If your project exports targets and you would like BLT's provided third-party targets to also be + exported (for example, if a project that imports your project does not use BLT), you can set the + ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other + EXPORTABLE targets created by ``blt_import_library()``, these targets should be prefixed with the name of + the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` + command can be used to modify the name of an installed target. See :ref:`ExportingTargets:` + for more info. + +You have already seen one use of ``DEPENDS_ON`` for a BLT dependency, ``gtest``, in ``test_1``: + +.. literalinclude:: calc_pi/CMakeLists.txt + :start-after: _blt_tutorial_calcpi_test1_executable_start + :end-before: _blt_tutorial_calcpi_test1_executable_end + :language: cmake + + +``gtest`` is the name for the GoogleTest target in BLT registered via +``blt_register_library()``. Even though GoogleTest is built-in and uses CMake, +``blt_register_library()`` allows us to easily set defines needed by all dependent +targets. + + +MPI +~~~ + +Our next example, ``test_2``, builds and tests the ``calc_pi_mpi`` library, +which uses MPI to parallelize the calculation over the integration intervals. + + +To enable MPI, we set ``ENABLE_MPI``, ``MPI_C_COMPILER``, and ``MPI_CXX_COMPILER`` +in our host config file. Here is a snippet with these settings for LLNL's Pascal Cluster: + +.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake + :start-after: _blt_tutorial_mpi_config_start + :end-before: _blt_tutorial_mpi_config_end + :language: cmake + + +Here, you can see how ``calc_pi_mpi`` and ``test_2`` use ``DEPENDS_ON``: + +.. literalinclude:: calc_pi/CMakeLists.txt + :start-after: _blt_tutorial_calcpi_test2_executable_start + :end-before: _blt_tutorial_calcpi_test2_executable_end + :language: cmake + + +For MPI unit tests, you also need to specify the number of MPI Tasks +to launch. We use the ``NUM_MPI_TASKS`` argument to ``blt_add_test()`` macro. + +.. literalinclude:: calc_pi/CMakeLists.txt + :start-after: _blt_tutorial_calcpi_test2_test_start + :end-before: _blt_tutorial_calcpi_test2_test_end + :language: cmake + + +As mentioned in :ref:`AddingTests`, GoogleTest provides a default ``main()`` +driver that will execute all unit tests defined in the source. To test MPI code, +we need to create a main that initializes and finalizes MPI in addition to Google +Test. ``test_2.cpp`` provides an example driver for MPI with GoogleTest. + +.. literalinclude:: calc_pi/test_2.cpp + :start-after: _blt_tutorial_calcpi_test2_main_start + :end-before: _blt_tutorial_calcpi_test2_main_end + :language: cpp + +.. note:: + While we have tried to ensure that BLT chooses the correct setup information + for MPI, there are several niche cases where the default behavior is + insufficient. We have provided several available override variables: + + * ``BLT_MPI_COMPILE_FLAGS`` + * ``BLT_MPI_INCLUDES`` + * ``BLT_MPI_LIBRARIES`` + * ``BLT_MPI_LINK_FLAGS`` + + BLT also has the variable ``ENABLE_FIND_MPI`` which turns off all CMake's ``FindMPI`` + logic and then uses the MPI wrapper directly when you provide them as the default + compilers. + + +CUDA +~~~~ + +Finally, ``test_3`` builds and tests the ``calc_pi_cuda`` library, +which uses CUDA to parallelize the calculation over the integration intervals. + +To enable CUDA, we set ``ENABLE_CUDA``, ``CMAKE_CUDA_COMPILER``, and +``CUDA_TOOLKIT_ROOT_DIR`` in our host config file. Also before enabling the +CUDA language in CMake, you need to set ``CMAKE_CUDA_HOST_COMPILER`` in CMake 3.9+ +or ``CUDA_HOST_COMPILER`` in previous versions. If you do not call +``enable_language(CUDA)``, BLT will set the appropriate host compiler variable +for you and enable the CUDA language. + +Here is a snippet with these settings for LLNL's Pascal Cluster: + +.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake + :start-after: _blt_tutorial_cuda_config_start + :end-before: _blt_tutorial_cuda_config_end + :language: cmake + +Here, you can see how ``calc_pi_cuda`` and ``test_3`` use ``DEPENDS_ON``: + +.. literalinclude:: calc_pi/CMakeLists.txt + :start-after: _blt_tutorial_calcpi_cuda_start + :end-before: _blt_tutorial_calcpi_cuda_end + :language: cmake + +The ``cuda`` dependency for ``calc_pi_cuda`` is a little special, +along with adding the normal CUDA library and headers to your library or executable, +it also tells BLT that this target's C/C++/CUDA source files need to be compiled via +``nvcc`` or ``cuda-clang``. If this is not a requirement, you can use the dependency +``cuda_runtime`` which also adds the CUDA runtime library and headers but will not +compile each source file with ``nvcc``. + +Some other useful CUDA flags are: + +.. literalinclude:: ../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake + :start-after: _blt_tutorial_useful_cuda_flags_start + :end-before: _blt_tutorial_useful_cuda_flags_end + :language: cmake + + +OpenMP +~~~~~~ + +To enable OpenMP, set ``ENABLE_OPENMP`` in your host-config file or before loading +``SetupBLT.cmake``. Once OpenMP is enabled, simply add ``openmp`` to your library +executable's ``DEPENDS_ON`` list. + +Here is an example of how to add an OpenMP enabled executable: + +.. literalinclude:: ../../tests/smoke/CMakeLists.txt + :start-after: _blt_tutorial_openmp_executable_start + :end-before: _blt_tutorial_openmp_executable_end + :language: cmake + +.. note:: + While we have tried to ensure that BLT chooses the correct compile and link flags for + OpenMP, there are several niche cases where the default options are insufficient. + For example, linking with NVCC requires to link in the OpenMP libraries directly instead + of relying on the compile and link flags returned by CMake's FindOpenMP package. An + example of this is in ``host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake``. + We provide two variables to override BLT's OpenMP flag logic: + + * ``BLT_OPENMP_COMPILE_FLAGS`` + * ``BLT_OPENMP_LINK_FLAGS`` + +Here is an example of how to add an OpenMP enabled test that sets the amount of threads used: + +.. literalinclude:: ../../tests/smoke/CMakeLists.txt + :start-after: _blt_tutorial_openmp_test_start + :end-before: _blt_tutorial_openmp_test_end + :language: cmake diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index 76a2deeda..431e5ed33 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -8,216 +8,22 @@ Importing Targets ================= -One key goal for BLT is to simplify the use of external dependencies when building your libraries and executables. +One key goal for BLT is to simplify the use of external dependencies and libraries when building +your project. To accomplish this, BLT provides a ``DEPENDS_ON`` option for the ``blt_add_library()`` +and ``blt_add_executable()`` macros that supports both your own projects CMake targets +and imported targets. We have logically broken this topic into two groups: :ref:`CommonHPCDependencies` +and :ref:`ThirdPartyLibraries`. -To accomplish this BLT provides a ``DEPENDS_ON`` option for the -``blt_add_library()`` and ``blt_add_executable()`` macros that supports both CMake targets -and external dependencies registered using the ``blt_register_library()`` macro. +:ref:`CommonHPCDependencies`, such as MPI, CUDA, HIP, and OpenMP, are bundled and ready to use included +with BLT as regular named CMake targets. For example, just adding ``openmp`` to any ``DEPENDS_ON`` +will add the necessary OpenMP compiler and link flags to any target. -The ``blt_import_library()`` macro allows you to reuse all information needed -for an external dependency under a single name. This includes any include -directories, libraries, compile flags, link flags, defines, etc. You can also -hide any warnings created by their headers by setting the -``TREAT_INCLUDES_AS_SYSTEM`` argument. +:ref:`ThirdPartyLibraries` are imported into your depending on the level of CMake support provided +by that project. BLT provides a macro, ``blt_import_library()``, which allows you to bundle all +necessary information under a single name. Some projects properly export their CMake targets and +only need to be imported via a call to ``include()``. -For example, to find and add the external dependency *axom* as a CMake target, you can simply use: +.. toctree:: -.. code-block:: cmake - - # FindAxom.cmake takes in AXOM_DIR, which is a installed Axom build and - # sets variables AXOM_INCLUDES, AXOM_LIBRARIES - include(FindAxom.cmake) - blt_import_library(NAME axom - TREAT_INCLUDES_AS_SYSTEM ON - DEFINES HAVE_AXOM=1 - INCLUDES ${AXOM_INCLUDES} - LIBRARIES ${AXOM_LIBRARIES} - EXPORTABLE ON) - -Then ``axom`` is available to be used in the ``DEPENDS_ON`` list in the following -``blt_add_executable()`` or ``blt_add_library()`` calls, or in any CMake command that accepts a target. - -CMake targets created by ``blt_import_library()`` are ``INTERFACE`` libraries that can be installed -and exported if the ``EXPORTABLE`` option is enabled. For example, if the ``calc_pi`` project depends on -Axom, it could export its ``axom`` target. To avoid introducing target name conflicts for users of the -``calc_pi`` project who might also create a target called ``axom``, ``axom`` should be exported as -``calc_pi::axom``. - -This is especially helpful for "converting" external libraries that are not built with CMake -into CMake-friendly imported targets. - - -BLT also supports using ``blt_register_library()`` to provide additional options for existing CMake targets. -The implementation doesn't modify the properties of the existing targets, -it just exposes these options via BLT's support for ``DEPENDS_ON``. - -This first-class importing functionality provided by ``blt_import_library()`` should be preferred, -but ``blt_register_library()`` is still available for compatibility. ``blt_import_library()`` -is generally usable as a drop-in replacement, though it does not support the creation of targets -with the same name as a target that already exists. - - -Both ``blt_import_library()`` and ``blt_register_library()`` are compatible with -libraries that *do* provide CMake-friendly targets. - -.. note:: - Because CMake targets are only accessible from within the directory they were defined (including - subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files - that create imported library targets needed in other directories. The GLOBAL option to ``blt_import_library()`` - can also be used to manage visibility. - -BLT's ``mpi``, ``cuda``, ``cuda_runtime``, and ``openmp`` targets are all defined via ``blt_import_library()``. -You can see how in ``blt/thirdparty_builtin/CMakelists.txt``. If your project exports targets and you -would like BLT's provided third-party targets to also be exported (for example, if a project that imports -your project does not use BLT), you can set the ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other -EXPORTABLE targets created by ``blt_import_library()``, these targets should be prefixed with the name of -the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` -command can be used to modify the name of an installed target. See :ref:`ExportingTargets:` -for more info. - -You have already seen one use of ``DEPENDS_ON`` for a BLT -registered dependency in test_1: ``gtest`` - -.. literalinclude:: calc_pi/CMakeLists.txt - :start-after: _blt_tutorial_calcpi_test1_executable_start - :end-before: _blt_tutorial_calcpi_test1_executable_end - :language: cmake - - -``gtest`` is the name for the GoogleTest dependency in BLT registered via -``blt_register_library()``. Even though GoogleTest is built-in and uses CMake, -``blt_register_library()`` allows us to easily set defines needed by all dependent -targets. - - -MPI Example -~~~~~~~~~~~ - -Our next example, ``test_2``, builds and tests the ``calc_pi_mpi`` library, -which uses MPI to parallelize the calculation over the integration intervals. - - -To enable MPI, we set ``ENABLE_MPI``, ``MPI_C_COMPILER``, and ``MPI_CXX_COMPILER`` -in our host config file. Here is a snippet with these settings for LLNL's Pascal Cluster: - -.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake - :start-after: _blt_tutorial_mpi_config_start - :end-before: _blt_tutorial_mpi_config_end - :language: cmake - - -Here, you can see how ``calc_pi_mpi`` and ``test_2`` use ``DEPENDS_ON``: - -.. literalinclude:: calc_pi/CMakeLists.txt - :start-after: _blt_tutorial_calcpi_test2_executable_start - :end-before: _blt_tutorial_calcpi_test2_executable_end - :language: cmake - - -For MPI unit tests, you also need to specify the number of MPI Tasks -to launch. We use the ``NUM_MPI_TASKS`` argument to ``blt_add_test()`` macro. - -.. literalinclude:: calc_pi/CMakeLists.txt - :start-after: _blt_tutorial_calcpi_test2_test_start - :end-before: _blt_tutorial_calcpi_test2_test_end - :language: cmake - - -As mentioned in :ref:`AddingTests`, GoogleTest provides a default ``main()`` -driver that will execute all unit tests defined in the source. To test MPI code, -we need to create a main that initializes and finalizes MPI in addition to Google -Test. ``test_2.cpp`` provides an example driver for MPI with GoogleTest. - -.. literalinclude:: calc_pi/test_2.cpp - :start-after: _blt_tutorial_calcpi_test2_main_start - :end-before: _blt_tutorial_calcpi_test2_main_end - :language: cpp - -.. note:: - While we have tried to ensure that BLT chooses the correct setup information - for MPI, there are several niche cases where the default behavior is - insufficient. We have provided several available override variables: - - * ``BLT_MPI_COMPILE_FLAGS`` - * ``BLT_MPI_INCLUDES`` - * ``BLT_MPI_LIBRARIES`` - * ``BLT_MPI_LINK_FLAGS`` - - BLT also has the variable ``ENABLE_FIND_MPI`` which turns off all CMake's ``FindMPI`` - logic and then uses the MPI wrapper directly when you provide them as the default - compilers. - - -CUDA Example -~~~~~~~~~~~~ - -Finally, ``test_3`` builds and tests the ``calc_pi_cuda`` library, -which uses CUDA to parallelize the calculation over the integration intervals. - -To enable CUDA, we set ``ENABLE_CUDA``, ``CMAKE_CUDA_COMPILER``, and -``CUDA_TOOLKIT_ROOT_DIR`` in our host config file. Also before enabling the -CUDA language in CMake, you need to set ``CMAKE_CUDA_HOST_COMPILER`` in CMake 3.9+ -or ``CUDA_HOST_COMPILER`` in previous versions. If you do not call -``enable_language(CUDA)``, BLT will set the appropriate host compiler variable -for you and enable the CUDA language. - -Here is a snippet with these settings for LLNL's Pascal Cluster: - -.. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake - :start-after: _blt_tutorial_cuda_config_start - :end-before: _blt_tutorial_cuda_config_end - :language: cmake - -Here, you can see how ``calc_pi_cuda`` and ``test_3`` use ``DEPENDS_ON``: - -.. literalinclude:: calc_pi/CMakeLists.txt - :start-after: _blt_tutorial_calcpi_cuda_start - :end-before: _blt_tutorial_calcpi_cuda_end - :language: cmake - -The ``cuda`` dependency for ``calc_pi_cuda`` is a little special, -along with adding the normal CUDA library and headers to your library or executable, -it also tells BLT that this target's C/C++/CUDA source files need to be compiled via -``nvcc`` or ``cuda-clang``. If this is not a requirement, you can use the dependency -``cuda_runtime`` which also adds the CUDA runtime library and headers but will not -compile each source file with ``nvcc``. - -Some other useful CUDA flags are: - -.. literalinclude:: ../../host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake - :start-after: _blt_tutorial_useful_cuda_flags_start - :end-before: _blt_tutorial_useful_cuda_flags_end - :language: cmake - - -OpenMP -~~~~~~ - -To enable OpenMP, set ``ENABLE_OPENMP`` in your host-config file or before loading -``SetupBLT.cmake``. Once OpenMP is enabled, simply add ``openmp`` to your library -executable's ``DEPENDS_ON`` list. - -Here is an example of how to add an OpenMP enabled executable: - -.. literalinclude:: ../../tests/smoke/CMakeLists.txt - :start-after: _blt_tutorial_openmp_executable_start - :end-before: _blt_tutorial_openmp_executable_end - :language: cmake - -.. note:: - While we have tried to ensure that BLT chooses the correct compile and link flags for - OpenMP, there are several niche cases where the default options are insufficient. - For example, linking with NVCC requires to link in the OpenMP libraries directly instead - of relying on the compile and link flags returned by CMake's FindOpenMP package. An - example of this is in ``host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_link_with_nvcc.cmake``. - We provide two variables to override BLT's OpenMP flag logic: - - * ``BLT_OPENMP_COMPILE_FLAGS`` - * ``BLT_OPENMP_LINK_FLAGS`` - -Here is an example of how to add an OpenMP enabled test that sets the amount of threads used: - -.. literalinclude:: ../../tests/smoke/CMakeLists.txt - :start-after: _blt_tutorial_openmp_test_start - :end-before: _blt_tutorial_openmp_test_end - :language: cmake + common_hpc_dependencies + third_party_libraries diff --git a/docs/tutorial/third_party_libraries.rst b/docs/tutorial/third_party_libraries.rst new file mode 100644 index 000000000..83c42c1be --- /dev/null +++ b/docs/tutorial/third_party_libraries.rst @@ -0,0 +1,149 @@ +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level LICENSE file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +.. _ThirdPartyLibraries: + +Third Party Libraries +===================== + +Third party libraries come in three flavors based on the CMake support provided by +the project and the CMake community as a whole: None, Find, and First Class. + +None +~~~~ + +Some libraries have no support for easily importing their CMake targets into +external projects, either through properly exporting their targets themselves +or the CMake community has not written a Find module that eases this work. + +BLT provides a ``blt_import_library()`` macro allows you to reuse all information needed +for an external dependency under a single name. This includes any include +directories, libraries, compile flags, link flags, defines, etc. You can also +hide any warnings created by their headers by setting the +``TREAT_INCLUDES_AS_SYSTEM`` argument. + +We will use Lua as an example of this because up until recently (CMake version 3.18), +there was no Find module. This provides us a great example on how to show two ways +of importing the same library's targets. + +The following example shows how to find a library, Lua this time, manually. By first, +searching for the include directories and then for the library itself. Finally it calls +``blt_import_library()`` to bundle that information under one easy to remember name, ``lua`` : + +.. code-block:: cmake + + # first Check for LUA_DIR + if (NOT EXISTS "${LUA_DIR}") + message(FATAL_ERROR "Given LUA_DIR does not exist: ${LUA_DIR}") + endif() + + if (NOT IS_DIRECTORY "${LUA_DIR}") + message(FATAL_ERROR "Given LUA_DIR is not a directory: ${LUA_DIR}") + endif() + + # Find includes directory + find_path( LUA_INCLUDE_DIR lua.hpp + PATHS ${LUA_DIR}/include/ + ${LUA_DIR}/include/lua + NO_DEFAULT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + + # Find libraries + find_library( LUA_LIBRARY NAMES lua liblua + PATHS ${LUA_DIR}/lib + NO_DEFAULT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + + + include(FindPackageHandleStandardArgs) + # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE + # if all listed variables are TRUE + find_package_handle_standard_args(LUA DEFAULT_MSG + LUA_INCLUDE_DIR + LUA_LIBRARY ) + + if(NOT LUA_FOUND) + message(FATAL_ERROR "LUA_DIR is not a path to a valid Lua install") + endif() + + message(STATUS "Lua Includes: ${LUA_INCLUDE_DIR}") + message(STATUS "Lua Libraries: ${LUA_LIBRARY}") + + blt_import_library(NAME lua + TREAT_INCLUDES_AS_SYSTEM ON + DEFINES HAVE_LUA=1 + INCLUDES ${LUA_LIBRARY} + LIBRARIES ${LUA_INCLUDE_DIR} + EXPORTABLE ON) + +Then ``lua`` is available to be used in the ``DEPENDS_ON`` list in the following +``blt_add_executable()`` or ``blt_add_library()`` calls, or in any CMake command that accepts a target. + +.. note:: + CMake targets created by ``blt_import_library()`` are ``INTERFACE`` libraries that can be installed + and exported if the ``EXPORTABLE`` option is enabled. For example, if the ``calc_pi`` project depends on + Lua, it could export its ``lua`` target. To avoid introducing target name conflicts for users of the + ``calc_pi`` project who might also create a target called ``lua``, ``lua`` should be exported as + ``calc_pi\:\:lua`` . + +.. note:: + Because CMake targets are only accessible from within the directory they were defined (including + subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command + for adding CMake files that create imported library targets needed in other directories. The ``GLOBAL`` + option to ``blt_import_library()`` can also be used to manage visibility. + + +Find Modules +~~~~~~~~~~~~ + +This time we will do exactly the same thing but using the new CMake provided ``FindLua.cmake`` module. +Instead of calling having to ensure correctness and calling ``find_path`` and ``find_library``, we +only have to call ``find_package`` and it handles this for us. Each Find module outputs differently +named variables so it is important to read the documentation on CMake's website. This is where +``blt_import_library`` shines because you only have to figure those variables once then use the +new imported library's ``NAME`` in the rest of your project. + +.. code-block:: cmake + + # FindLua.cmake takes in LUA_DIR, which the directory where Lua was installed to + # and fills variables: LUA_FOUND, LUA_LIBRARIES, and LUA_INCLUDE_DIR + find_package(Lua NO_DEFAULT_PATH + PATHS ${LUA_DIR}) + + if (NOT LUA_FOUND) + MESSAGE(FATAL_ERROR "Could not find Lua in the provided LUA_DIR: ${LUA_DIR}") + endif() + + blt_import_library(NAME lua + TREAT_INCLUDES_AS_SYSTEM ON + DEFINES HAVE_LUA=1 + INCLUDES ${LUA_LIBRARIES} + LIBRARIES ${LUA_INCLUDE_DIR} + EXPORTABLE ON) + + +First Class +~~~~~~~~~~~ + +Some projects provide what we call First Class support. They have gone through the effort of +properly exporting all necessary targets to use their project and +install the necessary configuration files inside of their install directory, usually something +like ``\lib\cmake\Config.cmake``. + +LLNL's `Axom project `_ exports all targets that can be easily +imported into your project with a single CMake function call: + +.. code-block:: cmake + + // use the provided PATH directory and create a cmake target named 'axom' + find_package(axom REQUIRED + NO_DEFAULT_PATH + PATHS ${AXOM_DIR}/lib/cmake) From b915723069a71f61fcee7dfe3ee4dc1e695f3baf Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 7 Apr 2021 18:19:30 -0700 Subject: [PATCH 294/330] change subsections --- docs/tutorial/third_party_libraries.rst | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/tutorial/third_party_libraries.rst b/docs/tutorial/third_party_libraries.rst index 83c42c1be..7fe894809 100644 --- a/docs/tutorial/third_party_libraries.rst +++ b/docs/tutorial/third_party_libraries.rst @@ -9,10 +9,11 @@ Third Party Libraries ===================== Third party libraries come in three flavors based on the CMake support provided by -the project and the CMake community as a whole: None, Find, and First Class. +the project and the CMake community as a whole: no Cmake support, CMake's Find* modules, +and First Class project support. -None -~~~~ +No CMake Support +~~~~~~~~~~~~~~~~ Some libraries have no support for easily importing their CMake targets into external projects, either through properly exporting their targets themselves @@ -101,8 +102,8 @@ Then ``lua`` is available to be used in the ``DEPENDS_ON`` list in the following option to ``blt_import_library()`` can also be used to manage visibility. -Find Modules -~~~~~~~~~~~~ +Cmake's Find Modules +~~~~~~~~~~~~~~~~~~~~ This time we will do exactly the same thing but using the new CMake provided ``FindLua.cmake`` module. Instead of calling having to ensure correctness and calling ``find_path`` and ``find_library``, we @@ -130,8 +131,8 @@ new imported library's ``NAME`` in the rest of your project. EXPORTABLE ON) -First Class -~~~~~~~~~~~ +First Class Project Support +~~~~~~~~~~~~~~~~~~~~~~~~~~~ Some projects provide what we call First Class support. They have gone through the effort of properly exporting all necessary targets to use their project and @@ -147,3 +148,6 @@ imported into your project with a single CMake function call: find_package(axom REQUIRED NO_DEFAULT_PATH PATHS ${AXOM_DIR}/lib/cmake) + +You can then add the created CMake target, ``axom``, to any ``DEPENDS_ON`` list or use any other +regular CMake function to change it. From e6490de5a162385e35006bc456303cbbe0b78520 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 12:53:03 -0700 Subject: [PATCH 295/330] Mention we are using the cmake makefile generator --- docs/tutorial/getting_started.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/getting_started.rst b/docs/tutorial/getting_started.rst index 71f518379..64cbc4b7f 100644 --- a/docs/tutorial/getting_started.rst +++ b/docs/tutorial/getting_started.rst @@ -9,8 +9,8 @@ Getting Started =============== BLT is easy to include in your CMake project whether it is an existing project or -you are starting from scratch. This tutorial assumes you are using git but those -commands can easily be changed or ignored. +you are starting from scratch. This tutorial assumes you are using git and the CMake +Makefile generator but those commands can easily be changed or ignored. Include BLT in your Git Repository From 06a9fa5f546ab064a685dbd0f42d0cc00cb26fbd Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 14:15:44 -0700 Subject: [PATCH 296/330] Address comments --- docs/tutorial/common_hpc_dependencies.rst | 4 ++-- docs/tutorial/creating_targets.rst | 19 +++++++++---------- docs/tutorial/getting_started.rst | 10 ++++++++-- docs/tutorial/host_configs.rst | 6 ++++-- docs/tutorial/importing_targets.rst | 15 ++++++++------- docs/tutorial/index.rst | 3 ++- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/docs/tutorial/common_hpc_dependencies.rst b/docs/tutorial/common_hpc_dependencies.rst index 9b06770b8..3dd492611 100644 --- a/docs/tutorial/common_hpc_dependencies.rst +++ b/docs/tutorial/common_hpc_dependencies.rst @@ -14,8 +14,8 @@ bundled versions of GoogleTest, GoogleMock, GoogleBenchmark, and FRUIT. Not onl for these included, we provide named CMake targets for them as well. BLT's ``mpi``, ``cuda``, ``cuda_runtime``, ``hip``, ``hip_runtime``,and ``openmp`` targets are -all defined via ``blt_import_library()``. This creates a true CMake imported target that is inherited -properly through the CMake dependency DAG. +all defined via the ``blt_import_library()`` macro. This creates a true CMake imported target that is inherited +properly through the CMake's dependency graph. .. note:: If your project exports targets and you would like BLT's provided third-party targets to also be diff --git a/docs/tutorial/creating_targets.rst b/docs/tutorial/creating_targets.rst index c2b358308..92494f713 100644 --- a/docs/tutorial/creating_targets.rst +++ b/docs/tutorial/creating_targets.rst @@ -53,12 +53,11 @@ by running the following commands: :class: hint This is one of the core macros that enables BLT to simplify our CMake-based - project. It unifies many CMake calls into one easy to use macro. - ``blt_add_executable()`` creates a CMake executable target with the - given sources, sets the output directory to ``/bin`` - (unless overridden with the macro parameter ``OUTPUT_DIR``) and handles - internal and external dependencies in a greatly simplified manner. There - will be more on that in the following section. + project. It unifies many CMake calls into one easy to use macro while creating + a CMake executable target with the given parameters. It also greatly simplifies the usage of + internal and external dependencies. The full list of supported parameters + can be found on the :ref:`blt_add_executable` API documentation. + Example 2: Executable with a Library @@ -94,7 +93,7 @@ into this executable without any more work or extra CMake function calls. This is another core BLT macro. It creates a CMake library target and associates the given sources and headers along with handling dependencies the same way as - ``blt_add_executable()`` does. It also provides a few commonly used build options, - such as overriding the output name of the library and the output directory. - It defaults to building a static library unless you override it with - ``SHARED`` or with the global CMake option ``BUILD_SHARED_LIBS``. + ``blt_add_executable()`` does. It defaults to building a static library unless + you override it with ``SHARED`` or with the global CMake option ``BUILD_SHARED_LIBS``. + The full list of supported parameters can be found on the :ref:`blt_add_library` + API documentation. diff --git a/docs/tutorial/getting_started.rst b/docs/tutorial/getting_started.rst index 64cbc4b7f..5715f6032 100644 --- a/docs/tutorial/getting_started.rst +++ b/docs/tutorial/getting_started.rst @@ -95,8 +95,8 @@ If you are using BLT outside of your project pass the location of BLT as follows cmake -DBLT_SOURCE_DIR="path/to/blt" .. -Example: Bare Bones -------------------- +Example: Bare Bones BLT Project +------------------------------- The ``bare_bones`` example project shows you some of BLT's built-in features. It demonstrates the bare minimum required for testing purposes. @@ -148,6 +148,12 @@ This will generate a configured ``Makefile`` in your build directory to build Bare Bones project. The generated makefile includes gtest and several built-in BLT *smoke* tests, depending on the features that you have enabled in your build. +.. note:: A smoke tests are designed to show when basic functionality is not working. + For example, if you have turned on MPI in your project but the MPI compiler wrapper + cannot produce an executable that runs even the most basic MPI code, the + ``blt_mpi_smoke`` test will fail. This helps you know that the problem doesn't + lie in your own code but in the building/linking of MPI. + To build the project, use the following command: .. code-block:: bash diff --git a/docs/tutorial/host_configs.rst b/docs/tutorial/host_configs.rst index 1e6b4a466..b88b07951 100644 --- a/docs/tutorial/host_configs.rst +++ b/docs/tutorial/host_configs.rst @@ -31,7 +31,7 @@ These files use standard CMake commands. CMake ``set()`` commands need to specif set(CMAKE_VARIABLE_NAME {VALUE} CACHE PATH "") Here is a snippet from a host-config file that specifies compiler details for -using gcc 4.9.3 on LLNL's Pascal cluster. +using specific gcc (version 4.9.3 in this case) on the LLNL Pascal cluster. .. literalinclude:: ../../host-configs/llnl/toss_3_x86_64_ib/gcc@4.9.3_nvcc.cmake :start-after: _blt_tutorial_compiler_config_start @@ -42,7 +42,9 @@ using gcc 4.9.3 on LLNL's Pascal cluster. Building and Testing on Pascal ------------------------------ -Here is how you can use the host-config file to configure a build of the ``calc_pi`` project with MPI and CUDA enabled on Pascal: +Since compute nodes on the Pascal cluster have CPUs and GPUs, here is how you +can use the host-config file to configure a build of the ``calc_pi`` project with +MPI and CUDA enabled on Pascal: .. code-block:: bash diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index 431e5ed33..39d31ff67 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -14,14 +14,15 @@ and ``blt_add_executable()`` macros that supports both your own projects CMake t and imported targets. We have logically broken this topic into two groups: :ref:`CommonHPCDependencies` and :ref:`ThirdPartyLibraries`. -:ref:`CommonHPCDependencies`, such as MPI, CUDA, HIP, and OpenMP, are bundled and ready to use included -with BLT as regular named CMake targets. For example, just adding ``openmp`` to any ``DEPENDS_ON`` -will add the necessary OpenMP compiler and link flags to any target. +* :ref:`CommonHPCDependencies`, such as MPI, CUDA, HIP, and OpenMP, are bundled and ready to use included + with BLT as regular named CMake targets. For example, just adding ``openmp`` to any ``DEPENDS_ON`` + will add the necessary OpenMP compiler and link flags to any target. +* :ref:`ThirdPartyLibraries` are imported into your depending on the level of CMake support provided + by that project. BLT provides a macro, ``blt_import_library()``, which allows you to bundle all + necessary information under a single name. Some projects properly export their CMake targets and + only need to be imported via a call to ``include()``. -:ref:`ThirdPartyLibraries` are imported into your depending on the level of CMake support provided -by that project. BLT provides a macro, ``blt_import_library()``, which allows you to bundle all -necessary information under a single name. Some projects properly export their CMake targets and -only need to be imported via a call to ``include()``. +Their following pages describe these topics in more detail. .. toctree:: diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index c6ce9a76e..32dc2d001 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -9,10 +9,11 @@ User Tutorial This tutorial provides instructions for: * Adding BLT to a CMake project - * Setting up *host-config* files to handle multiple platform configurations * Building, linking, and installing libraries and executables * Setting up unit tests with GTest + * Setting up *host-config* files to handle multiple platform configurations * Using external project dependencies + * Exporting your project's CMake targets for outside projects to use * Creating documentation with Sphinx and Doxygen The two example CMake projects used are included in BLT's source tree at: From cbdc08af365947b337b53234d9ee2de2fb817583 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 16:41:39 -0700 Subject: [PATCH 297/330] Fix reference --- docs/tutorial/common_hpc_dependencies.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/common_hpc_dependencies.rst b/docs/tutorial/common_hpc_dependencies.rst index 3dd492611..9443cd3c3 100644 --- a/docs/tutorial/common_hpc_dependencies.rst +++ b/docs/tutorial/common_hpc_dependencies.rst @@ -23,7 +23,7 @@ properly through the CMake's dependency graph. ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other EXPORTABLE targets created by ``blt_import_library()``, these targets should be prefixed with the name of the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` - command can be used to modify the name of an installed target. See :ref:`ExportingTargets:` + command can be used to modify the name of an installed target. See :ref:`ExportingTargets` for more info. You have already seen one use of ``DEPENDS_ON`` for a BLT dependency, ``gtest``, in ``test_1``: From 7288fd006ec67a6714fd8a1509fd2d5a10447956 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:10:57 -0700 Subject: [PATCH 298/330] Address comments --- docs/tutorial/common_hpc_dependencies.rst | 36 +++++++++++++---------- docs/tutorial/exporting_targets.rst | 19 +++++++----- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/docs/tutorial/common_hpc_dependencies.rst b/docs/tutorial/common_hpc_dependencies.rst index 9443cd3c3..80254f5cb 100644 --- a/docs/tutorial/common_hpc_dependencies.rst +++ b/docs/tutorial/common_hpc_dependencies.rst @@ -14,17 +14,12 @@ bundled versions of GoogleTest, GoogleMock, GoogleBenchmark, and FRUIT. Not onl for these included, we provide named CMake targets for them as well. BLT's ``mpi``, ``cuda``, ``cuda_runtime``, ``hip``, ``hip_runtime``,and ``openmp`` targets are -all defined via the ``blt_import_library()`` macro. This creates a true CMake imported target that is inherited +all defined via the :ref:`blt_import_library` macro. This creates a true CMake imported target that is inherited properly through the CMake's dependency graph. .. note:: - If your project exports targets and you would like BLT's provided third-party targets to also be - exported (for example, if a project that imports your project does not use BLT), you can set the - ``BLT_EXPORT_THIRDPARTY`` option to ``ON``. As with other - EXPORTABLE targets created by ``blt_import_library()``, these targets should be prefixed with the name of - the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` - command can be used to modify the name of an installed target. See :ref:`ExportingTargets` - for more info. + BLT also supports exporting its third-party targets via the ``BLT_EXPORT_THIRDPARTY`` option. + See :ref:`ExportingTargets` for more information. You have already seen one use of ``DEPENDS_ON`` for a BLT dependency, ``gtest``, in ``test_1``: @@ -33,13 +28,6 @@ You have already seen one use of ``DEPENDS_ON`` for a BLT dependency, ``gtest``, :end-before: _blt_tutorial_calcpi_test1_executable_end :language: cmake - -``gtest`` is the name for the GoogleTest target in BLT registered via -``blt_register_library()``. Even though GoogleTest is built-in and uses CMake, -``blt_register_library()`` allows us to easily set defines needed by all dependent -targets. - - MPI ~~~ @@ -171,3 +159,21 @@ Here is an example of how to add an OpenMP enabled test that sets the amount of :start-after: _blt_tutorial_openmp_test_start :end-before: _blt_tutorial_openmp_test_end :language: cmake + + +HIP +~~~ + +**HIP tutorial coming soon!** + +BLT also supports AMD's HIP via a mechanism very similar to our CUDA support. + +**Important Setup Variables** + +* ``ENABLE_HIP`` : Enables HIP support in BLT +* ``HIP_ROOT_DIR`` : Root directory for HIP installation + +**BLT Targets** + +* ``hip`` : Adds include directories, hip runtime libraries, and compiles source with hipcc +* ``hip_runtime`` : Adds include directories and hip runtime libraries diff --git a/docs/tutorial/exporting_targets.rst b/docs/tutorial/exporting_targets.rst index ccc920f28..793c4b252 100644 --- a/docs/tutorial/exporting_targets.rst +++ b/docs/tutorial/exporting_targets.rst @@ -10,19 +10,24 @@ Exporting Targets BLT provides several built-in targets for commonly used libraries: - * ``mpi`` (when ``ENABLE_MPI`` is on) - * ``openmp`` (when ``ENABLE_OPENMP`` is on) - * ``cuda`` and ``cuda_runtime`` (when ``ENABLE_CUDA`` is on) - * ``hip`` and ``hip_runtime`` (when ``ENABLE_HIP`` is on) + * ``mpi`` (when ``ENABLE_MPI`` is ``ON``) + * ``openmp`` (when ``ENABLE_OPENMP`` is ``ON``) + * ``cuda`` and ``cuda_runtime`` (when ``ENABLE_CUDA`` is ``ON``) + * ``hip`` and ``hip_runtime`` (when ``ENABLE_HIP`` is ``ON``) These targets can be made exportable in order to make them available to users of your project via CMake's ``install()`` command. Setting BLT's ``BLT_EXPORT_THIRDPARTY`` option to ``ON`` will mark all active targets in the above list as ``EXPORTABLE`` -(see the ``blt_import_library()`` documentation for more info). +(see the :ref:`blt_import_library` API documentation for more info). + +.. note:: As with other ``EXPORTABLE`` targets created by ``blt_import_library()``, + these targets should be prefixed with the name of the project. Either the ``EXPORT_NAME`` + target property or the ``NAMESPACE`` option to CMake's ``install`` + command can be used to modify the name of an installed target. .. note:: If a target in your project is added to an export set, any of its dependencies - marked ``EXPORTABLE`` must be added to the same export set. Failure to add them will - result in a CMake error in the exporting project. + marked ``EXPORTABLE`` must be added to the same export set. Failure to add them will + result in a CMake error in the exporting project. Typical usage of the ``BLT_EXPORT_THIRDPARTY`` option is as follows: From 794a97293272adb045ab143896c6f14bb527483f Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:19:01 -0700 Subject: [PATCH 299/330] Address comments --- docs/index.rst | 2 ++ docs/tutorial/common_hpc_dependencies.rst | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 82cafdfa6..e604a7e8b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -28,6 +28,8 @@ BLT at a Glance * Managing compiler flags * Managing external dependencies + * Handles differences across CMake versions + * Multi-platform support (HPC Platforms, OSX, Windows) * Batteries included diff --git a/docs/tutorial/common_hpc_dependencies.rst b/docs/tutorial/common_hpc_dependencies.rst index 80254f5cb..195b58375 100644 --- a/docs/tutorial/common_hpc_dependencies.rst +++ b/docs/tutorial/common_hpc_dependencies.rst @@ -9,7 +9,10 @@ Common HPC Dependencies ======================= BLT creates named targets for the common HPC dependencies that most HPC projects need, such as -MPI, CUDA, HIP, and OpenMP. As previously mentioned in :ref:`AddingTests`, BLT also provides +MPI, CUDA, HIP, and OpenMP. Something BLT assists it's users with is getting these dependencies +to interoperate within the same library or executable. + +As previously mentioned in :ref:`AddingTests`, BLT also provides bundled versions of GoogleTest, GoogleMock, GoogleBenchmark, and FRUIT. Not only are the source for these included, we provide named CMake targets for them as well. @@ -34,7 +37,6 @@ MPI Our next example, ``test_2``, builds and tests the ``calc_pi_mpi`` library, which uses MPI to parallelize the calculation over the integration intervals. - To enable MPI, we set ``ENABLE_MPI``, ``MPI_C_COMPILER``, and ``MPI_CXX_COMPILER`` in our host config file. Here is a snippet with these settings for LLNL's Pascal Cluster: From adc9795271b32142db9a81d90c1e9b933f90388f Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:24:45 -0700 Subject: [PATCH 300/330] fix formatting --- docs/tutorial/importing_targets.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index 39d31ff67..ada928e6b 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -9,20 +9,23 @@ Importing Targets ================= One key goal for BLT is to simplify the use of external dependencies and libraries when building -your project. To accomplish this, BLT provides a ``DEPENDS_ON`` option for the ``blt_add_library()`` -and ``blt_add_executable()`` macros that supports both your own projects CMake targets -and imported targets. We have logically broken this topic into two groups: :ref:`CommonHPCDependencies` -and :ref:`ThirdPartyLibraries`. +your project. To accomplish this, BLT provides a ``DEPENDS_ON`` option for the :ref:`blt_add_library` +and :ref:`blt_add_executable` macros that supports both your own projects CMake targets +and imported targets. We have logically broken this topic into two groups: -* :ref:`CommonHPCDependencies`, such as MPI, CUDA, HIP, and OpenMP, are bundled and ready to use included +:ref:`CommonHPCDependencies` + Dependencies such as MPI, CUDA, HIP, and OpenMP, are bundled and ready to use included with BLT as regular named CMake targets. For example, just adding ``openmp`` to any ``DEPENDS_ON`` will add the necessary OpenMP compiler and link flags to any target. -* :ref:`ThirdPartyLibraries` are imported into your depending on the level of CMake support provided - by that project. BLT provides a macro, ``blt_import_library()``, which allows you to bundle all + +:ref:`ThirdPartyLibraries` + These are external libraries that your project depend on, such as Lua. They are imported into your + project in different ways depending on the level of CMake support provided + by that project. BLT provides a macro, :ref:`blt_import_library`, which allows you to bundle all necessary information under a single name. Some projects properly export their CMake targets and only need to be imported via a call to ``include()``. -Their following pages describe these topics in more detail. +The following pages describe these topics in more detail. .. toctree:: From 63b0d00878393e58766165fd028918c6b7e9e7b7 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:26:18 -0700 Subject: [PATCH 301/330] Fix pluralness --- docs/tutorial/getting_started.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/getting_started.rst b/docs/tutorial/getting_started.rst index 5715f6032..3f4280b98 100644 --- a/docs/tutorial/getting_started.rst +++ b/docs/tutorial/getting_started.rst @@ -148,7 +148,7 @@ This will generate a configured ``Makefile`` in your build directory to build Bare Bones project. The generated makefile includes gtest and several built-in BLT *smoke* tests, depending on the features that you have enabled in your build. -.. note:: A smoke tests are designed to show when basic functionality is not working. +.. note:: Smoke tests are designed to show when basic functionality is not working. For example, if you have turned on MPI in your project but the MPI compiler wrapper cannot produce an executable that runs even the most basic MPI code, the ``blt_mpi_smoke`` test will fail. This helps you know that the problem doesn't From b2adf589d4323916604027f0d1a72ef1b59f68e5 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:35:16 -0700 Subject: [PATCH 302/330] Formatting --- docs/tutorial/exporting_targets.rst | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/tutorial/exporting_targets.rst b/docs/tutorial/exporting_targets.rst index 793c4b252..dcab45707 100644 --- a/docs/tutorial/exporting_targets.rst +++ b/docs/tutorial/exporting_targets.rst @@ -10,17 +10,24 @@ Exporting Targets BLT provides several built-in targets for commonly used libraries: - * ``mpi`` (when ``ENABLE_MPI`` is ``ON``) - * ``openmp`` (when ``ENABLE_OPENMP`` is ``ON``) - * ``cuda`` and ``cuda_runtime`` (when ``ENABLE_CUDA`` is ``ON``) - * ``hip`` and ``hip_runtime`` (when ``ENABLE_HIP`` is ``ON``) +``mpi`` + Available when ``ENABLE_MPI`` is ``ON`` + +``openmp`` + Available when ``ENABLE_OPENMP`` is ``ON`` + +``cuda`` and ``cuda_runtime`` + Available when ``ENABLE_CUDA`` is ``ON`` + +``hip`` and ``hip_runtime`` + Available when ``ENABLE_HIP`` is ``ON`` These targets can be made exportable in order to make them available to users of your project via CMake's ``install()`` command. Setting BLT's ``BLT_EXPORT_THIRDPARTY`` option to ``ON`` will mark all active targets in the above list as ``EXPORTABLE`` (see the :ref:`blt_import_library` API documentation for more info). -.. note:: As with other ``EXPORTABLE`` targets created by ``blt_import_library()``, +.. note:: As with other ``EXPORTABLE`` targets created by :ref:`blt_import_library`, these targets should be prefixed with the name of the project. Either the ``EXPORT_NAME`` target property or the ``NAMESPACE`` option to CMake's ``install`` command can be used to modify the name of an installed target. @@ -64,8 +71,8 @@ The first is to rename only the ``mpi`` target's exported name: With this approach the ``example_1`` target's exported name is unchanged - a project that imports the ``example-targets`` export set will have ``example_1`` -and ``example::mpi`` targets made available. The imported ``example_1`` will -depend on ``example::mpi``. +and ``example\:\:mpi`` targets made available. The imported ``example_1`` will +depend on ``example\:\:mpi``. Another approach is to install all targets in the export set behind a namespace: @@ -74,5 +81,5 @@ Another approach is to install all targets in the export set behind a namespace: install(EXPORT example-targets NAMESPACE example::) With this approach all targets in the export set are prefixed, so an importing -project will have ``example::example_1`` and ``example::mpi`` targets made available. -The imported ``example::example_1`` will depend on ``example::mpi``. +project will have ``example\:\:example_1`` and ``example\:\:mpi`` targets made available. +The imported ``example\:\:example_1`` will depend on ``example\:\:mpi``. From 0825ecddfb700b9e1454cd5e615e735a5c86dc73 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:40:56 -0700 Subject: [PATCH 303/330] fix formatting --- docs/tutorial/exporting_targets.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tutorial/exporting_targets.rst b/docs/tutorial/exporting_targets.rst index dcab45707..04c358470 100644 --- a/docs/tutorial/exporting_targets.rst +++ b/docs/tutorial/exporting_targets.rst @@ -71,8 +71,8 @@ The first is to rename only the ``mpi`` target's exported name: With this approach the ``example_1`` target's exported name is unchanged - a project that imports the ``example-targets`` export set will have ``example_1`` -and ``example\:\:mpi`` targets made available. The imported ``example_1`` will -depend on ``example\:\:mpi``. +and ``example::mpi`` targets made available. The imported ``example_1`` will +depend on ``example::mpi``. Another approach is to install all targets in the export set behind a namespace: @@ -81,5 +81,5 @@ Another approach is to install all targets in the export set behind a namespace: install(EXPORT example-targets NAMESPACE example::) With this approach all targets in the export set are prefixed, so an importing -project will have ``example\:\:example_1`` and ``example\:\:mpi`` targets made available. -The imported ``example\:\:example_1`` will depend on ``example\:\:mpi``. +project will have ``example::example_1`` and ``example::mpi`` targets made available. +The imported ``example::example_1`` will depend on ``example::mpi``. From 8bb846ebd4355f206fdcedbb000844e3a1c73de9 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:47:05 -0700 Subject: [PATCH 304/330] move exporting to advanced --- docs/tutorial/advanced_topics.rst | 1 + docs/tutorial/index.rst | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/advanced_topics.rst b/docs/tutorial/advanced_topics.rst index beac6994f..c1c286de9 100644 --- a/docs/tutorial/advanced_topics.rst +++ b/docs/tutorial/advanced_topics.rst @@ -15,4 +15,5 @@ This section includes subpages on advanced topics such as: .. toctree:: portable_compiler_flags + exporting_targets object_libraries diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 32dc2d001..a7f4460dc 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -55,7 +55,6 @@ LLNL HPC platforms and ORNL's Summit platform. adding_tests host_configs importing_targets - exporting_targets creating_documentation advanced_topics recommendations From 47add21ebc0faeef6fae35b840d0855c655fa0bc Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:48:49 -0700 Subject: [PATCH 305/330] add exporting targets to lists --- docs/tutorial/advanced_topics.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/tutorial/advanced_topics.rst b/docs/tutorial/advanced_topics.rst index c1c286de9..e065730a1 100644 --- a/docs/tutorial/advanced_topics.rst +++ b/docs/tutorial/advanced_topics.rst @@ -9,6 +9,7 @@ Advanced Topics This section includes subpages on advanced topics such as: * :ref:`PortableCompilerFlags` : Managing compiler flags across compiler families + * :ref:`ExportingTargets` : Exporting your project's CMake Targets for others to use * :ref:`ObjectLibraries` : A collection of object files that are not linked or archived into a library From e93f405d8dc91eae904d47549de736e4a5f61145 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:50:16 -0700 Subject: [PATCH 306/330] hide unneeded toc's --- docs/tutorial/advanced_topics.rst | 1 + docs/tutorial/importing_targets.rst | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/advanced_topics.rst b/docs/tutorial/advanced_topics.rst index e065730a1..c772b7c31 100644 --- a/docs/tutorial/advanced_topics.rst +++ b/docs/tutorial/advanced_topics.rst @@ -14,6 +14,7 @@ This section includes subpages on advanced topics such as: .. toctree:: + :hidden: portable_compiler_flags exporting_targets diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index ada928e6b..241819041 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -25,9 +25,8 @@ and imported targets. We have logically broken this topic into two groups: necessary information under a single name. Some projects properly export their CMake targets and only need to be imported via a call to ``include()``. -The following pages describe these topics in more detail. - .. toctree:: - + :hidden: + common_hpc_dependencies third_party_libraries From 1c7318b74a2b7a30a13251419d47ed75f8978675 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:53:24 -0700 Subject: [PATCH 307/330] test --- docs/tutorial/importing_targets.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index 241819041..0add63b7e 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -26,7 +26,6 @@ and imported targets. We have logically broken this topic into two groups: only need to be imported via a call to ``include()``. .. toctree:: - :hidden: - + common_hpc_dependencies third_party_libraries From 33af21988dca1427c758001832006b5f500c17fb Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 17:58:44 -0700 Subject: [PATCH 308/330] unhide --- docs/tutorial/advanced_topics.rst | 1 - docs/tutorial/importing_targets.rst | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/advanced_topics.rst b/docs/tutorial/advanced_topics.rst index c772b7c31..e065730a1 100644 --- a/docs/tutorial/advanced_topics.rst +++ b/docs/tutorial/advanced_topics.rst @@ -14,7 +14,6 @@ This section includes subpages on advanced topics such as: .. toctree:: - :hidden: portable_compiler_flags exporting_targets diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index 0add63b7e..ada928e6b 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -25,6 +25,8 @@ and imported targets. We have logically broken this topic into two groups: necessary information under a single name. Some projects properly export their CMake targets and only need to be imported via a call to ``include()``. +The following pages describe these topics in more detail. + .. toctree:: common_hpc_dependencies From c15a8132153d94043a85099d11fde1886fb78ccd Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:00:53 -0700 Subject: [PATCH 309/330] Try includehidden --- docs/tutorial/advanced_topics.rst | 1 + docs/tutorial/importing_targets.rst | 3 +-- docs/tutorial/index.rst | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/advanced_topics.rst b/docs/tutorial/advanced_topics.rst index e065730a1..0458f89e2 100644 --- a/docs/tutorial/advanced_topics.rst +++ b/docs/tutorial/advanced_topics.rst @@ -14,6 +14,7 @@ This section includes subpages on advanced topics such as: .. toctree:: + :hidden: portable_compiler_flags exporting_targets diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index ada928e6b..1772557b2 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -25,9 +25,8 @@ and imported targets. We have logically broken this topic into two groups: necessary information under a single name. Some projects properly export their CMake targets and only need to be imported via a call to ``include()``. -The following pages describe these topics in more detail. - .. toctree:: + :hidden: common_hpc_dependencies third_party_libraries diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index a7f4460dc..8acb6ecf4 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -49,6 +49,7 @@ LLNL HPC platforms and ORNL's Summit platform. .. toctree:: :maxdepth: 3 :caption: Tutorial Contents + :includehidden: getting_started creating_targets From 14bbc2aa0af922b8f0102609f0990f7193f6c8c9 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:01:52 -0700 Subject: [PATCH 310/330] Add host-config reference --- docs/tutorial/index.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 8acb6ecf4..76ba8515b 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -41,10 +41,7 @@ The tutorial requires a C++ compiler and CMake, we recommend using CMake 3.8.0 o Parts of the tutorial also require MPI, CUDA, Sphinx, and Doxygen. We provide instructions to build and run these projects on several -LLNL HPC platforms and ORNL's Summit platform. - -.. CYRUS NOTE: IF WE SEPARATE THE HOST CONFIG EXAMPLES, WE SHOULD CROSS LINK HERE. - +LLNL HPC platforms and ORNL's Summit platform. See :ref:`HostConfigs`. .. toctree:: :maxdepth: 3 From c6fd117f136a4c0e4687e8dba4f3656a81c02dfe Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:05:18 -0700 Subject: [PATCH 311/330] fix spacing --- docs/tutorial/advanced_topics.rst | 2 +- docs/tutorial/importing_targets.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/advanced_topics.rst b/docs/tutorial/advanced_topics.rst index 0458f89e2..c772b7c31 100644 --- a/docs/tutorial/advanced_topics.rst +++ b/docs/tutorial/advanced_topics.rst @@ -14,7 +14,7 @@ This section includes subpages on advanced topics such as: .. toctree:: - :hidden: + :hidden: portable_compiler_flags exporting_targets diff --git a/docs/tutorial/importing_targets.rst b/docs/tutorial/importing_targets.rst index 1772557b2..73ce9c183 100644 --- a/docs/tutorial/importing_targets.rst +++ b/docs/tutorial/importing_targets.rst @@ -26,7 +26,7 @@ and imported targets. We have logically broken this topic into two groups: only need to be imported via a call to ``include()``. .. toctree:: - :hidden: + :hidden: common_hpc_dependencies third_party_libraries From 1c396aec87c17e0f6bb09180dc4b5008662d7ec9 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:13:03 -0700 Subject: [PATCH 312/330] fix warnings --- docs/api/target_properties.rst | 4 ++-- docs/tutorial/adding_tests.rst | 2 +- docs/tutorial/third_party_libraries.rst | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index 4fbc0854b..735b5bcff 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -128,8 +128,8 @@ or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` m ``PRIVATE`` flags are used for the given target. ``INTERFACE`` flags are inherited by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. -If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically convert -``-Wl,-rpath,`` to ``-Xlinker -rpath -Xlinker ``. +If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically +convert ``-Wl,-rpath,`` to ``-Xlinker -rpath -Xlinker ``. .. note:: This macro also handles the various changes that CMake made in 3.13. For example, diff --git a/docs/tutorial/adding_tests.rst b/docs/tutorial/adding_tests.rst index a23df9d46..b46d1d41d 100644 --- a/docs/tutorial/adding_tests.rst +++ b/docs/tutorial/adding_tests.rst @@ -264,7 +264,7 @@ CTest's XML and to turn off compressed output: ctest -DCTEST_OUTPUT_ON_FAILURE=1 --no-compress-output -T Test -VV -j8 Then convert the CTest XML file to JUnit's format with the XSL file included -in BLT. This can be done in many ways, but most *nix machines come with +in BLT. This can be done in many ways, but most Linux or Unix machines come with a program called ``xsltproc`` diff --git a/docs/tutorial/third_party_libraries.rst b/docs/tutorial/third_party_libraries.rst index 7fe894809..cc3d30c88 100644 --- a/docs/tutorial/third_party_libraries.rst +++ b/docs/tutorial/third_party_libraries.rst @@ -144,10 +144,8 @@ imported into your project with a single CMake function call: .. code-block:: cmake - // use the provided PATH directory and create a cmake target named 'axom' - find_package(axom REQUIRED - NO_DEFAULT_PATH - PATHS ${AXOM_DIR}/lib/cmake) + # use the provided PATH directory and create a cmake target named 'axom' + find_package(axom REQUIRED) You can then add the created CMake target, ``axom``, to any ``DEPENDS_ON`` list or use any other regular CMake function to change it. From 955dd08b808d791545ce23deeb8d1cf72734fdf1 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:17:24 -0700 Subject: [PATCH 313/330] Fix warning --- docs/api/target_properties.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index 735b5bcff..3af5a8f4e 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -129,7 +129,7 @@ or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` m by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically -convert ``-Wl,-rpath,`` to ``-Xlinker -rpath -Xlinker ``. +convert ``-Wl,-rpath,`` to ``-Xlinker -rpath -Xlinker `` . .. note:: This macro also handles the various changes that CMake made in 3.13. For example, From 97ccc093753b840f7be9c3539582e869020eeb47 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:21:27 -0700 Subject: [PATCH 314/330] Fix warning --- docs/api/target_properties.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index 3af5a8f4e..fe8edbf60 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -129,7 +129,7 @@ or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` m by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically -convert ``-Wl,-rpath,`` to ``-Xlinker -rpath -Xlinker `` . +convert "-Wl,-rpath," to "-Xlinker -rpath -Xlinker ". .. note:: This macro also handles the various changes that CMake made in 3.13. For example, From eb33c32cc1cd0191e3a3ebd7accaf38f903d63a4 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:25:34 -0700 Subject: [PATCH 315/330] use literal --- docs/api/target_properties.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index fe8edbf60..c781a5e3f 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -129,7 +129,7 @@ or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` m by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically -convert "-Wl,-rpath," to "-Xlinker -rpath -Xlinker ". +convert :literal:`-Wl,-rpath,` to :literal:`-Xlinker -rpath -Xlinker `. .. note:: This macro also handles the various changes that CMake made in 3.13. For example, From 6600a2e76cf2e1ccb1e6b0b89d489c497a781d17 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:31:36 -0700 Subject: [PATCH 316/330] convert all blt macro literals to references --- docs/tutorial/common_hpc_dependencies.rst | 2 +- docs/tutorial/creating_documentation.rst | 8 ++++---- docs/tutorial/creating_targets.rst | 4 ++-- docs/tutorial/object_libraries.rst | 2 +- docs/tutorial/portable_compiler_flags.rst | 2 +- docs/tutorial/third_party_libraries.rst | 12 ++++++------ 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/tutorial/common_hpc_dependencies.rst b/docs/tutorial/common_hpc_dependencies.rst index 195b58375..d16ebf8c9 100644 --- a/docs/tutorial/common_hpc_dependencies.rst +++ b/docs/tutorial/common_hpc_dependencies.rst @@ -55,7 +55,7 @@ Here, you can see how ``calc_pi_mpi`` and ``test_2`` use ``DEPENDS_ON``: For MPI unit tests, you also need to specify the number of MPI Tasks -to launch. We use the ``NUM_MPI_TASKS`` argument to ``blt_add_test()`` macro. +to launch. We use the ``NUM_MPI_TASKS`` argument to :ref:`blt_add_test` macro. .. literalinclude:: calc_pi/CMakeLists.txt :start-after: _blt_tutorial_calcpi_test2_test_start diff --git a/docs/tutorial/creating_documentation.rst b/docs/tutorial/creating_documentation.rst index 1354b350c..b4f82e5f2 100644 --- a/docs/tutorial/creating_documentation.rst +++ b/docs/tutorial/creating_documentation.rst @@ -46,7 +46,7 @@ The Sphinx ``sphinx-quickstart`` utility helps you generate a new sphinx project selecting common settings for the ``config.py``. -BLT provides a ``blt_add_sphinx_target()`` macro which, which will look for a ``conf.py`` file +BLT provides a :ref:`blt_add_sphinx_target` macro which, which will look for a ``conf.py`` file in the current directory and add a command to build the Sphinx docs using this file to the ``docs`` CMake target. @@ -58,7 +58,7 @@ CMake target. This macro is active when BLT is configured with a valid ``SPHINX_EXECUTABLE`` path. -Here is an example of using ``blt_add_sphinx_target()`` in a CMakeLists.txt file: +Here is an example of using :ref:`blt_add_sphinx_target` in a CMakeLists.txt file: .. literalinclude:: calc_pi/docs/sphinx/CMakeLists.txt :language: rst @@ -78,7 +78,7 @@ Doxygen is a compiled executable that can be installed via spack, built-by-hand, ``doxygen`` processes a ``Doxyfile`` which specifies options, including where to look for annotated source files. -BLT provides a ``blt_add_doxygen_target()`` macro which, which will look for a ``Doxyfile.in`` +BLT provides a :ref:`blt_add_doxygen_target` macro which, which will look for a ``Doxyfile.in`` file in the current directory, configure this file to create a ``Doxyfile`` in the build directory, and add a command to build the Doxygen docs using this file to the ``docs`` CMake target. @@ -90,7 +90,7 @@ and add a command to build the Doxygen docs using this file to the ``docs`` CMak This macro is active when BLT is configured with a valid ``DOXYGEN_EXECUTABLE`` path. -Here is an example of using ``blt_add_doxygen_target()`` in a CMakeLists.txt file: +Here is an example of using :ref:`blt_add_doxygen_target` in a CMakeLists.txt file: .. literalinclude:: calc_pi/docs/doxygen/CMakeLists.txt :language: rst diff --git a/docs/tutorial/creating_targets.rst b/docs/tutorial/creating_targets.rst index 92494f713..84d6b43d4 100644 --- a/docs/tutorial/creating_targets.rst +++ b/docs/tutorial/creating_targets.rst @@ -13,7 +13,7 @@ project with BLT, how to configure the project and how to build, and test BLT's built-in third party libraries. We now move on to creating CMake targets using two of BLT's core macros: -``blt_add_library()`` and ``blt_add_executable()``. +:ref:`blt_add_library` and :ref:`blt_add_executable`. We begin with a simple executable that calculates :math:`\pi` by numerical integration, ``example_1``. We then extract that code into a library, which we link @@ -93,7 +93,7 @@ into this executable without any more work or extra CMake function calls. This is another core BLT macro. It creates a CMake library target and associates the given sources and headers along with handling dependencies the same way as - ``blt_add_executable()`` does. It defaults to building a static library unless + :ref:`blt_add_executable` does. It defaults to building a static library unless you override it with ``SHARED`` or with the global CMake option ``BUILD_SHARED_LIBS``. The full list of supported parameters can be found on the :ref:`blt_add_library` API documentation. diff --git a/docs/tutorial/object_libraries.rst b/docs/tutorial/object_libraries.rst index 3c5cc36b1..dd1bac9be 100644 --- a/docs/tutorial/object_libraries.rst +++ b/docs/tutorial/object_libraries.rst @@ -9,7 +9,7 @@ Object Libraries ================ BLT has simplified the use of CMake object libraries through the -``blt_add_library()`` macro. Object libraries are a collection of object files +:ref:`blt_add_library` macro. Object libraries are a collection of object files that are not linked or archived into a library. They are used in other libraries or executables through the ``DEPENDS_ON`` macro argument. This is generally useful for combining smaller libraries into a larger library without diff --git a/docs/tutorial/portable_compiler_flags.rst b/docs/tutorial/portable_compiler_flags.rst index 5ba7bb056..0cfce2634 100644 --- a/docs/tutorial/portable_compiler_flags.rst +++ b/docs/tutorial/portable_compiler_flags.rst @@ -9,7 +9,7 @@ Portable Compiler Flags ======================= To simplify the development of code that is portable across different architectures -and compilers, BLT provides the ``blt_append_custom_compiler_flag()`` macro, +and compilers, BLT provides the :ref:`blt_append_custom_compiler_flag` macro, which allows users to easily place a compiler dependent flag into a CMake variable. .. admonition:: blt_append_custom_compiler_flag diff --git a/docs/tutorial/third_party_libraries.rst b/docs/tutorial/third_party_libraries.rst index cc3d30c88..e9f5255d3 100644 --- a/docs/tutorial/third_party_libraries.rst +++ b/docs/tutorial/third_party_libraries.rst @@ -19,7 +19,7 @@ Some libraries have no support for easily importing their CMake targets into external projects, either through properly exporting their targets themselves or the CMake community has not written a Find module that eases this work. -BLT provides a ``blt_import_library()`` macro allows you to reuse all information needed +BLT provides a :ref:`blt_import_library` macro allows you to reuse all information needed for an external dependency under a single name. This includes any include directories, libraries, compile flags, link flags, defines, etc. You can also hide any warnings created by their headers by setting the @@ -31,7 +31,7 @@ of importing the same library's targets. The following example shows how to find a library, Lua this time, manually. By first, searching for the include directories and then for the library itself. Finally it calls -``blt_import_library()`` to bundle that information under one easy to remember name, ``lua`` : +:ref:`blt_import_library` to bundle that information under one easy to remember name, ``lua`` : .. code-block:: cmake @@ -86,10 +86,10 @@ searching for the include directories and then for the library itself. Finally EXPORTABLE ON) Then ``lua`` is available to be used in the ``DEPENDS_ON`` list in the following -``blt_add_executable()`` or ``blt_add_library()`` calls, or in any CMake command that accepts a target. +:ref:`blt_add_executable` or :ref:`blt_add_library` calls, or in any CMake command that accepts a target. .. note:: - CMake targets created by ``blt_import_library()`` are ``INTERFACE`` libraries that can be installed + CMake targets created by :ref:`blt_import_library` are ``INTERFACE`` libraries that can be installed and exported if the ``EXPORTABLE`` option is enabled. For example, if the ``calc_pi`` project depends on Lua, it could export its ``lua`` target. To avoid introducing target name conflicts for users of the ``calc_pi`` project who might also create a target called ``lua``, ``lua`` should be exported as @@ -99,7 +99,7 @@ Then ``lua`` is available to be used in the ``DEPENDS_ON`` list in the following Because CMake targets are only accessible from within the directory they were defined (including subdirectories), the ``include()`` command should be preferred to the ``add_subdirectory()`` command for adding CMake files that create imported library targets needed in other directories. The ``GLOBAL`` - option to ``blt_import_library()`` can also be used to manage visibility. + option to :ref:`blt_import_library` can also be used to manage visibility. Cmake's Find Modules @@ -109,7 +109,7 @@ This time we will do exactly the same thing but using the new CMake provided ``F Instead of calling having to ensure correctness and calling ``find_path`` and ``find_library``, we only have to call ``find_package`` and it handles this for us. Each Find module outputs differently named variables so it is important to read the documentation on CMake's website. This is where -``blt_import_library`` shines because you only have to figure those variables once then use the +:ref:`blt_import_library` shines because you only have to figure those variables once then use the new imported library's ``NAME`` in the rest of your project. .. code-block:: cmake From 2a2391fa2c1def4219ddf82b1fbdf77db790629c Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:33:16 -0700 Subject: [PATCH 317/330] capitalization --- docs/tutorial/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 76ba8515b..d4e0e4c3a 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -30,7 +30,7 @@ Here are direct links to the projects in BLT's GitHub repo: ``bare_bones`` provides a minimum template for starting a new project and ``calc_pi`` provides several examples that calculate the value of :math:`\pi` by approximating the integral :math:`f(x) = \int_0^14/(1+x^2)` using numerical -integration. The code is adapted from ANL's `using mpi examples `_. +integration. The code is adapted from ANL's `using MPI examples `_. Most of the tutorial focuses on the BLT features used to create the complete From 2381c62bad000724124bf593331622835fca6d39 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:36:54 -0700 Subject: [PATCH 318/330] try 14? --- docs/api/target_properties.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index c781a5e3f..ad3366533 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -129,7 +129,7 @@ or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` m by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically -convert :literal:`-Wl,-rpath,` to :literal:`-Xlinker -rpath -Xlinker `. +convert :literal:`-Wl,-rpath,` to :literal:`-Xlinker -rpath -Xlinker `. .. note:: This macro also handles the various changes that CMake made in 3.13. For example, From 05fbc4152ae6200ffc1e34295fde6370dab3d97b Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:43:27 -0700 Subject: [PATCH 319/330] try 16 --- docs/api/target_properties.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index ad3366533..b25cbfdf2 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -129,7 +129,7 @@ or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` m by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically -convert :literal:`-Wl,-rpath,` to :literal:`-Xlinker -rpath -Xlinker `. +convert `-Wl,-rpath,` to :literal:`-Xlinker -rpath -Xlinker\ `. .. note:: This macro also handles the various changes that CMake made in 3.13. For example, From e35192d835513565a0ee1461ccf288b2d218dfed Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 8 Apr 2021 18:45:21 -0700 Subject: [PATCH 320/330] fix first literal --- docs/api/target_properties.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index b25cbfdf2..abfeebaf7 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -129,7 +129,7 @@ or with the corresponding :ref:`blt_add_executable` and :ref:`blt_add_library` m by any target that depends on this target. ``PUBLIC`` flags are both ``INTERFACE`` and ``PRIVATE``. If ``CUDA_LINK_WITH_NVCC`` is set to ``ON``, this macro will automatically -convert `-Wl,-rpath,` to :literal:`-Xlinker -rpath -Xlinker\ `. +convert ``-Wl,-rpath,`` to :literal:`-Xlinker -rpath -Xlinker\ `. .. note:: This macro also handles the various changes that CMake made in 3.13. For example, From f51a1bf09b5c9764cd6aa06f151862b5336f7b37 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 14:21:53 -0700 Subject: [PATCH 321/330] Add release process docs --- docs/developer/index.rst | 14 ++++ docs/developer/release_process.rst | 104 +++++++++++++++++++++++++++++ docs/index.rst | 1 + 3 files changed, 119 insertions(+) create mode 100644 docs/developer/index.rst create mode 100644 docs/developer/release_process.rst diff --git a/docs/developer/index.rst b/docs/developer/index.rst new file mode 100644 index 000000000..5ff1dd7b4 --- /dev/null +++ b/docs/developer/index.rst @@ -0,0 +1,14 @@ +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level LICENSE file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +Developer Guide +=============== + +This section is for information related to being a developer of BLT. + +.. toctree:: + :caption: Developer Guide + + release_process diff --git a/docs/developer/release_process.rst b/docs/developer/release_process.rst new file mode 100644 index 000000000..32abb686d --- /dev/null +++ b/docs/developer/release_process.rst @@ -0,0 +1,104 @@ +.. # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and +.. # other BLT Project Developers. See the top-level LICENSE file for details +.. # +.. # SPDX-License-Identifier: (BSD-3-Clause) + +Release Process +=============== + +.. note:: No significant code development is performed on a release branch. + In addition to preparing release notes and other documentation, the + only code changes that should be done are bug fixes identified + during release preparations + +Here are the steps to follow for an BLT release. + +1: Start Release Candidate Branch +--------------------------------- + +Create a release candidate branch off of the develop branch to initiate a +release. The name of a release branch must contain the associated release version +number. Typically, we use a name like v0.4.0-rc +(i.e., version 0.4.0 release candidate). + +.. code:: bash + + git checkout -b v0.4.0-rc + +2: Update Versions in Code +-------------------------- + +**Update BLT_VERSION** + + * ``SetupBLT.cmake``: ``set(BLT_VERSION "0.4.0" CACHE STRING "")`` + + +**Update Release Notes** + +#. Update ``RELEASE-NOTES.md`` by changing the + ``unreleased`` section from: + +.. code:: none + + ## [Unreleased] - Release date yyyy-mm-dd + +Also add to a versioned section with the current date while leaving the unreleased section: + +.. code:: none + + ## [Unreleased] - Release date yyyy-mm-dd + + ## [Version 0.4.0] - Release date 2021-04-09 + +Finally, add a link to the bottom as well: + +.. code:: none + + [Unreleased]: https://github.com/LLNL/blt/compare/v0.3.6...develop + +to: + +.. code:: none + + [Unreleased]: https://github.com/LLNL/blt/compare/v0.4.0...develop + [Version 0.4.0]: https://github.com/LLNL/blt/compare/v0.3.6...v0.4.0 + + +3: Create Pull Request +---------------------- + +* Commit the changes and push them to Github. +* Create a pull request from release candidate branch to ``main`` branch. +* Merge pull request after reviewed and passing tests. +* Checkout main locally: ``git checkout main && git pull`` +* Create release tag: ``git tag v0.4.0`` +* Push tag to Github: ``git push --tags`` + + +4: Draft a Github Release +------------------------- + +`Draft a new Release on Github `_ + +#. Enter the desired tag version, e.g., *v0.4.0* + +#. Select **main** as the target branch to tag a release. + +#. Enter a Release title with the same as the tag *v0.4.0* + +#. Copy and paste the information for the release from the + ``RELEASE-NOTES.md`` into the release description (omit any sections if empty). + +#. Publish the release. This will add a corresponding entry in the + `Releases section `_ + +.. note:: + + Github will add a corresponding tarball and zip archives consisting of the + source files for each release. + + +6: Merge Main to Develop +--------------------------- + +Create a pull request to merge main into develop. When approved, merge it. diff --git a/docs/index.rst b/docs/index.rst index e604a7e8b..7fa4c8b48 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -76,3 +76,4 @@ Thanks to all of BLT's `contributors API Documentation + Developer Guide From 8f1c3fe0bf9fa3ae7d92ea485ecb10c644b53ce4 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 14:25:33 -0700 Subject: [PATCH 322/330] Add section for release branch --- docs/developer/release_process.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/developer/release_process.rst b/docs/developer/release_process.rst index 32abb686d..e17eb9d8e 100644 --- a/docs/developer/release_process.rst +++ b/docs/developer/release_process.rst @@ -98,6 +98,19 @@ to: source files for each release. +5: Create Release Branch +------------------------ + +Create a branch off main that is for the release branch. + +.. code:: bash + + git pull + git checkout main + git checkout -b release-v0.4.0 + git push --set-upstream origin release-v0.4.0 + + 6: Merge Main to Develop --------------------------- From a2ee9972eae66b456006327c5b4475e2d9affb2f Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 14:26:10 -0700 Subject: [PATCH 323/330] Clarify --- docs/developer/release_process.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developer/release_process.rst b/docs/developer/release_process.rst index e17eb9d8e..ce33dba32 100644 --- a/docs/developer/release_process.rst +++ b/docs/developer/release_process.rst @@ -114,4 +114,4 @@ Create a branch off main that is for the release branch. 6: Merge Main to Develop --------------------------- -Create a pull request to merge main into develop. When approved, merge it. +Create a pull request to merge ``main`` into ``develop`` through Github. When approved, merge it. From 9fe6439cd1ba660be47fbd400b8243a2ab9d63ab Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 14:30:07 -0700 Subject: [PATCH 324/330] Add documentation for creating release branch --- docs/developer/release_process.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/developer/release_process.rst b/docs/developer/release_process.rst index ce33dba32..b8c5eedbd 100644 --- a/docs/developer/release_process.rst +++ b/docs/developer/release_process.rst @@ -112,6 +112,13 @@ Create a branch off main that is for the release branch. 6: Merge Main to Develop ---------------------------- +------------------------ Create a pull request to merge ``main`` into ``develop`` through Github. When approved, merge it. + + +7: Build Release Documentation +------------------------------ + +Enable the build on `readthedocs version page `_ +for the version branch created in step 5. From 9c6d4b7c60a5a34ac70dc5da20ccbc7283dd0319 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 14:34:35 -0700 Subject: [PATCH 325/330] cut-off subsections --- docs/developer/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/developer/index.rst b/docs/developer/index.rst index 5ff1dd7b4..c3f09585a 100644 --- a/docs/developer/index.rst +++ b/docs/developer/index.rst @@ -10,5 +10,6 @@ This section is for information related to being a developer of BLT. .. toctree:: :caption: Developer Guide + :titlesonly: release_process From c765e5d38de8a19a7801b8cec00d09b825311bdd Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 14:40:05 -0700 Subject: [PATCH 326/330] remove title --- docs/developer/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/developer/index.rst b/docs/developer/index.rst index c3f09585a..e2d065519 100644 --- a/docs/developer/index.rst +++ b/docs/developer/index.rst @@ -9,7 +9,6 @@ Developer Guide This section is for information related to being a developer of BLT. .. toctree:: - :caption: Developer Guide :titlesonly: release_process From bfcbc366c4be7165747f2b267ca853995a08e5b7 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 16:28:33 -0700 Subject: [PATCH 327/330] address comments --- docs/developer/index.rst | 2 +- docs/developer/release_process.rst | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/docs/developer/index.rst b/docs/developer/index.rst index e2d065519..e144756d7 100644 --- a/docs/developer/index.rst +++ b/docs/developer/index.rst @@ -6,7 +6,7 @@ Developer Guide =============== -This section is for information related to being a developer of BLT. +This section contains information for BLT developers. .. toctree:: :titlesonly: diff --git a/docs/developer/release_process.rst b/docs/developer/release_process.rst index b8c5eedbd..f075dd68f 100644 --- a/docs/developer/release_process.rst +++ b/docs/developer/release_process.rst @@ -11,7 +11,7 @@ Release Process only code changes that should be done are bug fixes identified during release preparations -Here are the steps to follow for an BLT release. +Here are the steps to follow when creating a BLT release. 1: Start Release Candidate Branch --------------------------------- @@ -38,13 +38,13 @@ number. Typically, we use a name like v0.4.0-rc #. Update ``RELEASE-NOTES.md`` by changing the ``unreleased`` section from: -.. code:: none +.. code:: text ## [Unreleased] - Release date yyyy-mm-dd Also add to a versioned section with the current date while leaving the unreleased section: -.. code:: none +.. code:: ## [Unreleased] - Release date yyyy-mm-dd @@ -52,20 +52,20 @@ Also add to a versioned section with the current date while leaving the unreleas Finally, add a link to the bottom as well: -.. code:: none +.. code:: text [Unreleased]: https://github.com/LLNL/blt/compare/v0.3.6...develop to: -.. code:: none +.. code:: text [Unreleased]: https://github.com/LLNL/blt/compare/v0.4.0...develop [Version 0.4.0]: https://github.com/LLNL/blt/compare/v0.3.6...v0.4.0 -3: Create Pull Request ----------------------- +3: Create and push a git `tag` for the release +---------------------------------------------- * Commit the changes and push them to Github. * Create a pull request from release candidate branch to ``main`` branch. @@ -98,10 +98,10 @@ to: source files for each release. -5: Create Release Branch ------------------------- +5: Create Release Branch and Mergeback to develop +------------------------------------------------- -Create a branch off main that is for the release branch. +# Create a branch off main that is for the release branch. .. code:: bash @@ -111,10 +111,7 @@ Create a branch off main that is for the release branch. git push --set-upstream origin release-v0.4.0 -6: Merge Main to Develop ------------------------- - -Create a pull request to merge ``main`` into ``develop`` through Github. When approved, merge it. +# Create a pull request to merge ``main`` into ``develop`` through Github. When approved, merge it. 7: Build Release Documentation From 8b8f4988721dc865f622feed8cd417aee37a1537 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 16:30:42 -0700 Subject: [PATCH 328/330] Fix numbered list --- docs/developer/release_process.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developer/release_process.rst b/docs/developer/release_process.rst index f075dd68f..133b20657 100644 --- a/docs/developer/release_process.rst +++ b/docs/developer/release_process.rst @@ -101,7 +101,7 @@ to: 5: Create Release Branch and Mergeback to develop ------------------------------------------------- -# Create a branch off main that is for the release branch. +1. Create a branch off main that is for the release branch. .. code:: bash @@ -111,7 +111,7 @@ to: git push --set-upstream origin release-v0.4.0 -# Create a pull request to merge ``main`` into ``develop`` through Github. When approved, merge it. +2. Create a pull request to merge ``main`` into ``develop`` through Github. When approved, merge it. 7: Build Release Documentation From c0ad330dc302f80409bc948288be1cf00d1dc3b4 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 16:31:53 -0700 Subject: [PATCH 329/330] formatting --- docs/developer/release_process.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/developer/release_process.rst b/docs/developer/release_process.rst index 133b20657..587aea94c 100644 --- a/docs/developer/release_process.rst +++ b/docs/developer/release_process.rst @@ -64,15 +64,15 @@ to: [Version 0.4.0]: https://github.com/LLNL/blt/compare/v0.3.6...v0.4.0 -3: Create and push a git `tag` for the release ----------------------------------------------- - -* Commit the changes and push them to Github. -* Create a pull request from release candidate branch to ``main`` branch. -* Merge pull request after reviewed and passing tests. -* Checkout main locally: ``git checkout main && git pull`` -* Create release tag: ``git tag v0.4.0`` -* Push tag to Github: ``git push --tags`` +3: Create Pull Request and push a git `tag` for the release +----------------------------------------------------------- + +#. Commit the changes and push them to Github. +#. Create a pull request from release candidate branch to ``main`` branch. +#. Merge pull request after reviewed and passing tests. +#. Checkout main locally: ``git checkout main && git pull`` +#. Create release tag: ``git tag v0.4.0`` +#. Push tag to Github: ``git push --tags`` 4: Draft a Github Release From 4ebdb327a81529937daae2b1408690075b5f65e9 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Apr 2021 16:44:56 -0700 Subject: [PATCH 330/330] bump version to 0.4.0 --- RELEASE-NOTES.md | 5 ++++- SetupBLT.cmake | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 67e30a9d4..14045ab33 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -9,6 +9,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd +## [Version 0.4.0] - Release date 2021-04-09 + ## Added - Added variable ``BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE`` for filtering link directories implicitly added by CMake. See the following example host-config: @@ -200,7 +202,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ -[Unreleased]: https://github.com/LLNL/blt/compare/v0.3.6...develop +[Unreleased]: https://github.com/LLNL/blt/compare/v0.4.0...develop +[Version 0.4.0]: https://github.com/LLNL/blt/compare/v0.3.6...v0.4.0 [Version 0.3.6]: https://github.com/LLNL/blt/compare/v0.3.5...v0.3.6 [Version 0.3.5]: https://github.com/LLNL/blt/compare/v0.3.0...v0.3.5 [Version 0.3.0]: https://github.com/LLNL/blt/compare/v0.2.5...v0.3.0 diff --git a/SetupBLT.cmake b/SetupBLT.cmake index 18fd75fad..322bde168 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -4,7 +4,7 @@ # SPDX-License-Identifier: (BSD-3-Clause) if (NOT BLT_LOADED) - set(BLT_VERSION "0.3.6" CACHE STRING "") + set(BLT_VERSION "0.4.0" CACHE STRING "") mark_as_advanced(BLT_VERSION) message(STATUS "BLT Version: ${BLT_VERSION}")