diff --git a/.dockerignore b/.dockerignore index d1a0b73ca..0305b35ad 100755 --- a/.dockerignore +++ b/.dockerignore @@ -5,4 +5,3 @@ models @eaDir __pycache__ bazel-* -./vcpkg_installed diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 3f1304365..dc56973c6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -70,7 +70,7 @@ body: id: env-printout attributes: label: Full env printout - description: Please run and paste the output of the `./scripts/print_env.sh` script here, to gather any other relevant environment details + description: Please run and paste the output of the `./external/utilities/scripts/print_env.sh` script here, to gather any other relevant environment details render: shell - type: textarea diff --git a/.gitignore b/.gitignore index c7926ffc4..1a20325a2 100755 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.engine .Dockerfile .gitignore -/vcpkg_installed /*conda-bld*/ # Ignore generated pyi files for pybind and cython modules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..42fbfe928 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "morpheus_utils"] + path = external/utilities + url = ../utilities.git + branch = branch-23.01 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a87ae759..207f6e4ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2018-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2018-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,38 +24,58 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "mrc") option(BUILD_SHARED_LIBS "Default value for whether or not to build shared or static libraries" ON) option(MRC_BUILD_BENCHMARKS "Whether or not to build MRC benchmarks" OFF) option(MRC_BUILD_DOCS "Enable building of API documentation" OFF) -option(MRC_BUILD_LIBRARY "Whether the entire MRC library should be built. If set to OFF, only the pieces needed for a target will be built. Set to ON if installing the library" ON) +option(MRC_BUILD_LIBRARY "Whether the entire MRC library should be built. + If set to OFF, only the pieces needed for a target will be built. Set to ON if installing the library" ON) option(MRC_BUILD_PYTHON "Enable building the python bindings for MRC" ON) option(MRC_BUILD_TESTS "Whether or not to build MRC tests" ON) +option(MRC_ENABLE_CODECOV "Enable gcov code coverage" OFF) +option(MRC_ENABLE_DEBUG_INFO "Enable printing debug information" OFF) option(MRC_USE_CCACHE "Enable caching compilation results with ccache" OFF) option(MRC_USE_CLANG_TIDY "Enable running clang-tidy as part of the build process" OFF) -option(MRC_USE_CONDA "Enables finding dependencies via conda instead of vcpkg. Note: This will disable vcpkg. All dependencies must be installed first in the conda environment" ON) +option(MRC_USE_CONDA "Enables finding dependencies via conda. All dependencies must be installed first in the conda + environment" ON) option(MRC_USE_IWYU "Enable running include-what-you-use as part of the build process" OFF) -option(MRC_ENABLE_CODECOV "Enable gcov code coverage" OFF) set(MRC_RAPIDS_VERSION "22.10" CACHE STRING "Which version of RAPIDS to build for. Sets default versions for RAPIDS CMake and RMM.") set(MRC_CACHE_DIR "${CMAKE_SOURCE_DIR}/.cache" CACHE PATH "Directory to contain all CPM and CCache data") mark_as_advanced(MRC_CACHE_DIR) -# CMake path -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +enable_testing() -include(cmake/setup_package_manager.cmake) +if (MRC_USE_IWYU AND MRC_USE_CCACHE) + message(FATAL_ERROR "MRC_USE_IWYU and MRC_USE_CCACHE cannot be set simultaneously") +endif() -enable_testing() +# MRC CMake path and module extensions +set(MRC_CMAKE_MODULE_PATH_EXTENSIONS + "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/external/utilities/cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/external/utilities/cmake/morpheus_utils/package_search" + ) -# Add the RAPIDS cmake helper scripts -include(cmake/import_rapids_cmake.cmake) +set(MRC_CMAKE_PREFIX_PATH_EXTENSIONS + "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + ) -# Default to using "native" (case-sensitive) for CUDA_ARCHITECTURES to build based on GPU in system -if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) - set(CMAKE_CUDA_ARCHITECTURES "native") - message(STATUS "CMAKE_CUDA_ARCHITECTURES was not defined. Defaulting to '${CMAKE_CUDA_ARCHITECTURES}' to build only for local architecture. Specify -DCMAKE_CUDA_ARCHITECTURES='ALL' to build for all archs.") -endif() +# Prepend path and prefix updates so they take priority in this scope. +list(PREPEND CMAKE_MODULE_PATH "${MRC_CMAKE_MODULE_PATH_EXTENSIONS}") +list(PREPEND CMAKE_PREFIX_PATH "${MRC_CMAKE_PREFIX_PATH_EXTENSIONS}") -rapids_cuda_init_architectures(mrc) +# Load morpheus utils and update CMake paths +set(MORPHEUS_UTILS_RAPIDS_CMAKE_VERSION ${MRC_RAPIDS_VERSION}) +set(MORPHEUS_UTILS_RAPIDS_CPM_INIT_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rapids_cpm_package_overrides.json") +include(morpheus_utils/load) + +# Configure project package manager +morpheus_utils_initialize_package_manager( + MRC_USE_CONDA + BUILD_SHARED_LIBS + ) + +# Configure CUDA architecture +# NOTE: This MUST occur before any 'project' calls because of rapids_cmake requirements. +morpheus_utils_initialize_cuda_arch(mrc) project(mrc VERSION 23.01.00 @@ -72,12 +92,15 @@ if(NOT DEFINED CMAKE_CUDA_HOST_COMPILER) # incompatible with CUDA 11.4/11.5/11.6. See Issue #102 if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER}) + endif() endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # Our version of NVCC officially only supports clang versions 3.2 - 13, we are now using 14 set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -allow-unsupported-compiler") + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines-ts") endif() # Now enable CUDA @@ -90,15 +113,6 @@ set(MRC_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Set a default build type if none was specified rapids_cmake_build_type(Release) -# Once the build type is set, remove any dumb vcpkg debug folders from the -# search paths. Without this FindBoost fails since it defaults to the debug -# binaries -if(DEFINED CACHE{MRC_VCPKG_TOOLCHAIN} AND DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$") - message(STATUS "Release Build: Removing debug Vcpkg paths from CMAKE_PREFIX_PATH and CMAKE_FIND_ROOT_PATH") - list(REMOVE_ITEM CMAKE_PREFIX_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug") - list(REMOVE_ITEM CMAKE_FIND_ROOT_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug") -endif() - set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS ON) @@ -106,17 +120,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # Setup cache before dependencies -include(cmake/setup_cache.cmake) - -# Configure conda -if(MRC_USE_CONDA AND DEFINED ENV{CONDA_PREFIX}) - rapids_cmake_support_conda_env(conda_env MODIFY_PREFIX_PATH) - - if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND DEFINED ENV{CONDA_PREFIX}) - message(STATUS "No CMAKE_INSTALL_PREFIX argument detected, setting to: $ENV{CONDA_PREFIX}") - set(CMAKE_INSTALL_PREFIX "$ENV{CONDA_PREFIX}" CACHE STRING "" FORCE) - endif() -endif() +# Configure CCache if requested +include(environment/init_ccache) # Disable exporting compile commands for dependencies set(CMAKE_EXPORT_COMPILE_COMMANDS OFF) @@ -127,7 +132,7 @@ add_custom_target(${PROJECT_NAME}_style_checks ) # Configure all dependencies -include(cmake/dependencies.cmake) +include(dependencies) # Enable for all first party code set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -141,13 +146,13 @@ add_subdirectory(protos) # ################################### # - Post dependencies setup -------- -include(cmake/setup_compiler.cmake) +morpheus_utils_compiler_set_defaults(MRC_USE_CLANG_TIDY) # Setup code coverage components -include(cmake/setup_coverage.cmake) +include(environment/init_coverage) # Setup IWYU if enabled -include(cmake/setup_iwyu.cmake) +include(environment/init_iwyu) # ################################################################################################## # - subdirectories --------------------------------------------------------------------------------- @@ -162,7 +167,23 @@ if(MRC_BUILD_DOCS) add_subdirectory(docs) endif() -# Uncomment the following to print all available targets -# include(debug_utils) -# print_all_targets() +if (MRC_ENABLE_DEBUG_INFO) + morpheus_utils_print_all_targets() + + morpheus_utils_print_target_properties( + TARGETS + libmrc + pymrc + WRITE_TO_FILE + ) + + morpheus_utils_print_global_properties( + WRITE_TO_FILE + ) +endif() + +# Cleanup the environment after we exit this scope +list(REMOVE_ITEM CMAKE_PREFIX_PATH "${MRC_CMAKE_PREFIX_PATH_EXTENSIONS}") +list(REMOVE_ITEM CMAKE_MODULE_PATH "${MRC_CMAKE_MODULE_PATH_EXTENSIONS}") + list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/ci/conda/environments/dev_env_nogcc.yml b/ci/conda/environments/dev_env_nogcc.yml deleted file mode 100644 index 2468376c8..000000000 --- a/ci/conda/environments/dev_env_nogcc.yml +++ /dev/null @@ -1,38 +0,0 @@ -channels: - - conda-forge - - rapidsai - - nvidia - - rapidsai-nightly -dependencies: - - autoconf>=2.69 - - benchmark=1.6.0 - - boost-cpp=1.74 - - ccache - - cmake>=3.24 - - cython=0.29.24 - - doxygen=1.9.2 - - flatbuffers=2.0 - - gflags=2.2 - - git>=2.35.3 # Needed for wildcards on safe.directory - - glog=0.6 - - gmock=1.10 - - graphviz=3.0 - - grpc-cpp=1.46 - - gtest=1.10 - - isort - - libhwloc=2.5 - - libprotobuf=3.20 - - librmm=22.10 - - ninja=1.10 - - nlohmann_json=3.9 - - pkg-config=0.29 - - python=3.8 - - scikit-build>=0.12 - - spdlog=1.8.5 - - ucx=1.13 - - pip: - - cython - - flake8 - - pytest - - pytest-timeout - - yapf diff --git a/ci/conda/recipes/libmrc/build.sh b/ci/conda/recipes/libmrc/build.sh index e6f0582e4..34246be6f 100644 --- a/ci/conda/recipes/libmrc/build.sh +++ b/ci/conda/recipes/libmrc/build.sh @@ -87,6 +87,8 @@ fi echo "PYTHON: ${PYTHON}" echo "which python: $(which python)" +git submodule update --init --recursive + # Run configure cmake -B ${BUILD_DIR} \ ${CMAKE_ARGS} \ diff --git a/ci/runner/README.md b/ci/runner/README.md deleted file mode 100644 index 912d947f9..000000000 --- a/ci/runner/README.md +++ /dev/null @@ -1,43 +0,0 @@ - - -The `Dockerfile` in this directory defines the images used by the CI runner not for MRC itself. - -# Building CI images -The `Dockerfile` defines two targets: `base` and `driver`. The `driver` target includes the Nvidia driver needed to build MRC on a machine without access to a GPU. - -To build the images from the root of the MRC repo run: -```bash -SKIP_PUSH=1 ci/runner/build_and_push.sh -``` - -# Build and push CI images -This will require being a member of the `Morpheus Early Access CI` group in [NGC](https://catalog.ngc.nvidia.com) and logging into the `nvcr.io` registry prior to running. - -From the root of the MRC repo run: -```bash -ci/runner/build_and_push.sh -``` - -If the images are already built, the build step can be skipped by setting `SKIP_BUILD=1`. - -# Updating CI to use the new images -Update `.github/workflows/pull_request.yml` changing these two lines with the new image names: -```yaml - container: nvcr.io/ea-nvidia-morpheus/morpheus:mrc-ci-driver-221128 - test_container: nvcr.io/ea-nvidia-morpheus/morpheus:mrc-ci-base-221128 -``` diff --git a/ci/runner/build_and_push.sh b/ci/runner/build_and_push.sh deleted file mode 100755 index 5b11f7fc4..000000000 --- a/ci/runner/build_and_push.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -DOCKER_TARGET=${DOCKER_TARGET:-"base" "driver"} -DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} -DOCKER_REGISTRY_SERVER=${DOCKER_REGISTRY_SERVER:-"nvcr.io"} -DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH:-"/ea-nvidia-morpheus/morpheus"} -DOCKER_TAG_PREFIX=${DOCKER_TAG_PREFIX:-"mrc-ci"} -DOCKER_TAG_POSTFIX=${DOCKER_TAG_POSTFIX:-"$(date +'%y%m%d')"} -DOCKER_EXTRA_ARGS=${DOCKER_EXTRA_ARGS:-""} - -SKIP_BUILD=${SKIP_BUILD:-""} -SKIP_PUSH=${SKIP_PUSH:-""} - -set -e - -function get_image_full_name() { - echo "${DOCKER_REGISTRY_SERVER}${DOCKER_REGISTRY_PATH}:${DOCKER_TAG_PREFIX}-${build_target}-${DOCKER_TAG_POSTFIX}" -} - -if [[ "${SKIP_BUILD}" == "" ]]; then - for build_target in ${DOCKER_TARGET[@]}; do - FULL_NAME=$(get_image_full_name) - echo "Building target \"${build_target}\" as ${FULL_NAME}"; - docker buildx build --network=host ${DOCKER_EXTRA_ARGS} --target ${build_target} -t ${FULL_NAME} -f ./Dockerfile . - done -fi - -if [[ "${SKIP_PUSH}" == "" ]]; then - for build_target in ${DOCKER_TARGET[@]}; do - FULL_NAME=$(get_image_full_name) - echo "Pushing ${FULL_NAME}"; - docker push ${FULL_NAME} - done -fi diff --git a/ci/scripts/github/build.sh b/ci/scripts/github/build.sh index 9dab47bca..7e6db5e6a 100755 --- a/ci/scripts/github/build.sh +++ b/ci/scripts/github/build.sh @@ -48,6 +48,7 @@ fi show_conda_info rapids-logger "Configuring for build and test" +git submodule update --init --recursive cmake -B build -G Ninja ${CMAKE_FLAGS} . rapids-logger "Building MRC" diff --git a/ci/scripts/github/checks.sh b/ci/scripts/github/checks.sh index 65ee64ff4..34d1aca95 100755 --- a/ci/scripts/github/checks.sh +++ b/ci/scripts/github/checks.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,7 @@ fetch_base_branch update_conda_env rapids-logger "Configuring CMake" +git submodule update --init --recursive cmake -B build -G Ninja ${CMAKE_BUILD_ALL_FEATURES} . rapids-logger "Building targets that generate source code" diff --git a/ci/scripts/github/common.sh b/ci/scripts/github/common.sh index 4da5afab6..ccd36ab71 100644 --- a/ci/scripts/github/common.sh +++ b/ci/scripts/github/common.sh @@ -1,5 +1,5 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -96,6 +96,7 @@ function fetch_base_branch() { # Change target is the branch name we are merging into but due to the weird way jenkins does # the checkout it isn't recognized by git without the origin/ prefix export CHANGE_TARGET="origin/${BASE_BRANCH}" + git submodule update --init --recursive rapids-logger "Base branch: ${BASE_BRANCH}" } diff --git a/ci/scripts/github/docs.sh b/ci/scripts/github/docs.sh index 8e8c78ee3..2e0a1f64c 100755 --- a/ci/scripts/github/docs.sh +++ b/ci/scripts/github/docs.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,9 +29,9 @@ doxygen --version show_conda_info rapids-logger "Configuring for docs" +git submodule update --init --recursive cmake -B build -G Ninja ${CMAKE_BUILD_ALL_FEATURES} -DMRC_BUILD_DOCS=ON . - rapids-logger "Building docs" cmake --build build --target mrc_docs diff --git a/ci/scripts/github/test.sh b/ci/scripts/github/test.sh index 5cccec867..0aab525a0 100755 --- a/ci/scripts/github/test.sh +++ b/ci/scripts/github/test.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,7 @@ rapids-logger "Installing MRC" cmake -P ${MRC_ROOT}/build/cmake_install.cmake pip install ${MRC_ROOT}/build/python +git submodule update --init --recursive cmake -B build -G Ninja ${CMAKE_BUILD_ALL_FEATURES} . diff --git a/cmake/FindIBVerbs.cmake b/cmake/FindIBVerbs.cmake deleted file mode 100644 index 88a5a92da..000000000 --- a/cmake/FindIBVerbs.cmake +++ /dev/null @@ -1,62 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022,NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Find the ibverbs libraries -# -# The following variables are optionally searched for defaults -# IBVERBS_ROOT_DIR: Base directory where all ibverbs components are found -# IBVERBS_INCLUDE_DIR: Directory where ibverbs headers are found -# IBVERBS_LIB_DIR: Directory where ibverbs libraries are found - -# The following are set after configuration is done: -# IBVERBS_FOUND -# IBVERBS_INCLUDE_DIRS -# IBVERBS_LIBRARIES - -# - Find rdma verbs -# Find the rdma verbs library and includes -# -# VERBS_INCLUDE_DIR - where to find ibverbs.h, etc. -# VERBS_LIBRARIES - List of libraries when using ibverbs. -# VERBS_FOUND - True if ibverbs found. -# HAVE_IBV_EXP - True if experimental verbs is enabled. - -find_path(VERBS_INCLUDE_DIR infiniband/verbs.h) -find_library(VERBS_LIBRARIES ibverbs HINTS /usr/lib) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(verbs DEFAULT_MSG VERBS_LIBRARIES VERBS_INCLUDE_DIR) - -if(VERBS_FOUND) - include(CheckCXXSourceCompiles) - CHECK_CXX_SOURCE_COMPILES(" - #include - int main() { - struct ibv_context* ctxt; - struct ibv_exp_gid_attr gid_attr; - ibv_exp_query_gid_attr(ctxt, 1, 0, &gid_attr); - return 0; - } " HAVE_IBV_EXP) - if(NOT TARGET IBVerbs::verbs) - add_library(IBVerbs::verbs UNKNOWN IMPORTED) - endif() - set_target_properties(IBVerbs::verbs PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${VERBS_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${VERBS_LIBRARIES}") -endif() - -mark_as_advanced( - VERBS_LIBRARIES -) diff --git a/cmake/FindTensorRT.cmake b/cmake/FindTensorRT.cmake deleted file mode 100644 index 2cbfd6071..000000000 --- a/cmake/FindTensorRT.cmake +++ /dev/null @@ -1,87 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2018-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This module defines the following variables: -# -# :: -# -# TensorRT_INCLUDE_DIRS -# TensorRT_LIBRARIES -# TensorRT_FOUND -# -# :: -# -# TensorRT_VERSION_STRING - version (x.y.z) -# TensorRT_VERSION_MAJOR - major version (x) -# TensorRT_VERSION_MINOR - minor version (y) -# TensorRT_VERSION_PATCH - patch version (z) -# -# Hints -# ^^^^^ -# A user may set ``TensorRT_ROOT`` to an installation root to tell this module where to look. -# -set(_TensorRT_SEARCHES) - -if(TensorRT_ROOT) - set(_TensorRT_SEARCH_ROOT PATHS ${TensorRT_ROOT} NO_DEFAULT_PATH) - list(APPEND _TensorRT_SEARCHES _TensorRT_SEARCH_ROOT) -endif() - -# appends some common paths -set(_TensorRT_SEARCH_NORMAL - PATHS "/usr" -) -list(APPEND _TensorRT_SEARCHES _TensorRT_SEARCH_NORMAL) - -# Include dir -foreach(search ${_TensorRT_SEARCHES}) - find_path(TensorRT_INCLUDE_DIR NAMES NvInfer.h ${${search}} PATH_SUFFIXES include) -endforeach() - -if(NOT TensorRT_LIBRARY) - foreach(search ${_TensorRT_SEARCHES}) - find_library(TensorRT_LIBRARY NAMES nvinfer ${${search}} PATH_SUFFIXES lib) - endforeach() -endif() - -mark_as_advanced(TensorRT_INCLUDE_DIR) - -if(TensorRT_INCLUDE_DIR AND EXISTS "${TensorRT_INCLUDE_DIR}/NvInfer.h") - file(STRINGS "${TensorRT_INCLUDE_DIR}/NvInfer.h" TensorRT_MAJOR REGEX "^#define NV_TENSORRT_MAJOR [0-9]+.*$") - file(STRINGS "${TensorRT_INCLUDE_DIR}/NvInfer.h" TensorRT_MINOR REGEX "^#define NV_TENSORRT_MINOR [0-9]+.*$") - file(STRINGS "${TensorRT_INCLUDE_DIR}/NvInfer.h" TensorRT_PATCH REGEX "^#define NV_TENSORRT_PATCH [0-9]+.*$") - - string(REGEX REPLACE "^#define NV_TENSORRT_MAJOR ([0-9]+).*$" "\\1" TensorRT_VERSION_MAJOR "${TensorRT_MAJOR}") - string(REGEX REPLACE "^#define NV_TENSORRT_MINOR ([0-9]+).*$" "\\1" TensorRT_VERSION_MINOR "${TensorRT_MINOR}") - string(REGEX REPLACE "^#define NV_TENSORRT_PATCH ([0-9]+).*$" "\\1" TensorRT_VERSION_PATCH "${TensorRT_PATCH}") - set(TensorRT_VERSION_STRING "${TensorRT_VERSION_MAJOR}.${TensorRT_VERSION_MINOR}.${TensorRT_VERSION_PATCH}") -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(TensorRT REQUIRED_VARS TensorRT_LIBRARY TensorRT_INCLUDE_DIR VERSION_VAR TensorRT_VERSION_STRING) - -if(TensorRT_FOUND) - set(TensorRT_INCLUDE_DIRS ${TensorRT_INCLUDE_DIR}) - - if(NOT TensorRT_LIBRARIES) - set(TensorRT_LIBRARIES ${TensorRT_LIBRARY}) - endif() - - if(NOT TARGET TensorRT::TensorRT) - add_library(TensorRT::TensorRT UNKNOWN IMPORTED) - set_target_properties(TensorRT::TensorRT PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${TensorRT_INCLUDE_DIRS}") - set_property(TARGET TensorRT::TensorRT APPEND PROPERTY IMPORTED_LOCATION "${TensorRT_LIBRARY}") - endif() -endif() diff --git a/cmake/FindTriton.cmake b/cmake/FindTriton.cmake deleted file mode 100644 index 21dd4009d..000000000 --- a/cmake/FindTriton.cmake +++ /dev/null @@ -1,61 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022,NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Find Triton libraries -# -# The following variables are optionally searched for defaults -# TRITON_ROOT_DIR: Base directory where all ibverbs components are found -# TRITON_INCLUDE_DIR: Directory where ibverbs headers are found -# TRITON_LIB_DIR: Directory where ibverbs libraries are found - -# The following are set after configuration is done: -# TRITON_FOUND -# TRITON_INCLUDE_DIRS -# TRITON_LIBRARIES - -# - Find Triton -# Find the Triton library and includes -# -# TRITON_INCLUDE_DIR - where to find headers -# TRITON_LIBRARIES - List of libraries when using triton. -# TRITON_FOUND - True if libtritonserver.so found. - -find_path(TRITON_INCLUDE_DIR triton/core/tritonserver.h HINTS /opt/tritonserver/include) -find_library(TRITON_LIBRARIES libtritonserver.so HINTS /opt/tritonserver/lib) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Triton DEFAULT_MSG TRITON_LIBRARIES TRITON_INCLUDE_DIR) - -if(TRITON_FOUND) -# include(CheckCXXSourceCompiles) -# CHECK_CXX_SOURCE_COMPILES(" -# #include -# int main() { -# struct ibv_context* ctxt; -# struct ibv_exp_gid_attr gid_attr; -# ibv_exp_query_gid_attr(ctxt, 1, 0, &gid_attr); -# return 0; -# } " HAVE_IBV_EXP) - if(NOT TARGET Triton::libtriton) - add_library(Triton::libtriton UNKNOWN IMPORTED) - endif() - set_target_properties(Triton::libtriton PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${TRITON_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${TRITON_LIBRARIES}") -endif() - -mark_as_advanced( - TRITON_LIBRARIES -) diff --git a/cmake/GRPCGenerateCPP.cmake b/cmake/GRPCGenerateCPP.cmake deleted file mode 100644 index 7e864321e..000000000 --- a/cmake/GRPCGenerateCPP.cmake +++ /dev/null @@ -1,131 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2018-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# Separate the output files from protobuf_generate into src, headers and descriptors. Taken from PROTOBUF_GENERATE_CPP -function(protobuf_separate_output output_files) - - cmake_parse_arguments(protobuf_separate_output "" "HDRS;SRCS;DESCRIPTORS" "" "${ARGN}") - - set(SRCS "") - set(HDRS "") - set(DESCRIPTORS "") - - foreach(_file ${output_files}) - if(_file MATCHES "cc$") - list(APPEND SRCS ${_file}) - elseif(_file MATCHES "desc$") - list(APPEND DESCRIPTORS ${_file}) - else() - list(APPEND HDRS ${_file}) - endif() - endforeach() - - if (protobuf_separate_output_HDRS) - list(APPEND ${protobuf_separate_output_HDRS} ${HDRS}) - list(REMOVE_DUPLICATES ${protobuf_separate_output_HDRS}) - set(${protobuf_separate_output_HDRS} ${${protobuf_separate_output_HDRS}} PARENT_SCOPE) - endif() - if (protobuf_separate_output_SRCS) - list(APPEND ${protobuf_separate_output_SRCS} ${SRCS}) - list(REMOVE_DUPLICATES ${protobuf_separate_output_SRCS}) - set(${protobuf_separate_output_SRCS} ${${protobuf_separate_output_SRCS}} PARENT_SCOPE) - endif() - if (protobuf_separate_output_DESCRIPTORS) - list(APPEND ${protobuf_separate_output_DESCRIPTORS} ${DESCRIPTORS}) - list(REMOVE_DUPLICATES ${protobuf_separate_output_DESCRIPTORS}) - set(${protobuf_separate_output_DESCRIPTORS} ${${protobuf_separate_output_DESCRIPTORS}} PARENT_SCOPE) - endif() - -endfunction() - -# Generates CPP gRPC services. Use GEN_GRPC to indicate whether or not to use the gRPC extension -function(protobuf_generate_grpc_cpp target) - - cmake_parse_arguments(protobuf_generate_grpc_cpp "GEN_GRPC" "HDRS;SRCS;DESCRIPTORS" "PROTOS" ${ARGN}) - - set(out_files) - - # Generate the cpp files - protobuf_generate( - LANGUAGE cpp - OUT_VAR out_files - IMPORT_DIRS ${Protobuf_IMPORT_DIRS} - TARGET ${target} - PROTOS ${protobuf_generate_grpc_cpp_PROTOS} - ${protobuf_generate_grpc_cpp_UNPARSED_ARGUMENTS} - ) - - protobuf_separate_output( - "${out_files}" - HDRS ${protobuf_generate_grpc_cpp_HDRS} - SRCS ${protobuf_generate_grpc_cpp_SRCS} - DESCRIPTORS ${protobuf_generate_grpc_cpp_DESCRIPTORS} - ) - - if (protobuf_generate_grpc_cpp_GEN_GRPC) - set(out_files "") - - # Generate the grpc files - protobuf_generate( - LANGUAGE grpc - OUT_VAR out_files - GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc - PLUGIN "protoc-gen-grpc=$" - IMPORT_DIRS ${Protobuf_IMPORT_DIRS} - TARGET ${target} - PROTOS ${protobuf_generate_grpc_cpp_PROTOS} - ${protobuf_generate_grpc_cpp_UNPARSED_ARGUMENTS} - ) - - protobuf_separate_output( - "${out_files}" - HDRS ${protobuf_generate_grpc_cpp_HDRS} - SRCS ${protobuf_generate_grpc_cpp_SRCS} - DESCRIPTORS ${protobuf_generate_grpc_cpp_DESCRIPTORS} - ) - endif() - - # Now configure the target common for all proto targets - target_link_libraries(${target} - PUBLIC - protobuf::libprotobuf - ) - - target_include_directories(${target} - PUBLIC - $ - ) - - # We must always compile protobufs with `NDEBUG` defined due to an issue with - # libprotobuf>=3.20. Their header files can change between Debug/Release which - # causes undefined symbol errors when building and running in Debug. Setting - # this definition gets around this issue by ensuring a consistent value for - # `NDEBUG`. See this issue for more info: - # https://github.com/protocolbuffers/protobuf/issues/9947 - target_compile_definitions(${target} - PRIVATE NDEBUG - ) - - if (protobuf_generate_grpc_cpp_HDRS) - set(${protobuf_generate_grpc_cpp_HDRS} ${${protobuf_generate_grpc_cpp_HDRS}} PARENT_SCOPE) - set_target_properties(${target} PROPERTIES PUBLIC_HEADER "${${protobuf_generate_grpc_cpp_HDRS}}") - endif() - - if (protobuf_generate_grpc_cpp_SRCS) - set(${protobuf_generate_grpc_cpp_SRCS} ${${protobuf_generate_grpc_cpp_SRCS}} PARENT_SCOPE) - endif() - -endfunction() diff --git a/cmake/GRPCGenerateCPPLikeBazel.cmake b/cmake/GRPCGenerateCPPLikeBazel.cmake deleted file mode 100644 index 2a63386f1..000000000 --- a/cmake/GRPCGenerateCPPLikeBazel.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2018-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin) # Get full path to plugin - -function(PROTOBUF_GENERATE_GRPC_CPP_LIKE_BAZEL SRCS HDRS) - cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) - - set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}") - if(NOT PROTO_FILES) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files") - return() - endif() - - if(protobuf_EXPORT_MACRO) - set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:") - endif() - - get_filename_component(ABS_PROTO_PATH ${CMAKE_SOURCE_DIR} ABSOLUTE) - set(EXTRA_ARGS "--proto_path=${ABS_PROTO_PATH}") - file(RELATIVE_PATH Protobuf_PRE_IMPORT_DIRS ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - - if(PROTOBUF_GENERATE_CPP_APPEND_PATH) # This variable is common for all types of output. - # Create an include path for each file specified - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) - set(Protobuf_IMPORT_DIR "${PROTOBUF_IMPORT_DIRS") - endif() - - if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - endif() - - set(${SRCS}) - set(${HDRS}) - foreach(FIL ${PROTO_FILES}) - message(STATUS "grpc_cpp_proto: ${FIL}") - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - message(STATUS "grpc_cpp_proto_abs: ${ABS_FIL}") - - if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") - endif() - endif() - - if(Protobuf_PRE_IMPORT_DIRS) - set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${Protobuf_PRE_IMPORT_DIRS}/${FIL_WE}.grpc.pb.cc") - set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${Protobuf_PRE_IMPORT_DIRS}/${FIL_WE}.grpc.pb.h") - else() - set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.grpc.pb.cc") - set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.grpc.pb.h") - endif() - message(STATUS "grpc_cpp_src: ${_protobuf_protoc_src}") - list(APPEND ${SRCS} "${_protobuf_protoc_src}") - list(APPEND ${HDRS} "${_protobuf_protoc_hdr}") - - add_custom_command( - OUTPUT "${_protobuf_protoc_src}" - "${_protobuf_protoc_hdr}" - COMMAND ${Protobuf_PROTOC_EXECUTABLE} - ${EXTRA_ARGS} - "--grpc_out=${CMAKE_CURRENT_BINARY_DIR}" - "--plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN}" - ${_protobuf_protoc_flags} - ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} ${Protobuf_PROTOC_EXECUTABLE} - COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}" - VERBATIM) - endforeach() - - set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) - set(${SRCS} ${${SRCS}} PARENT_SCOPE) - set(${HDRS} ${${HDRS}} PARENT_SCOPE) -endfunction() diff --git a/cmake/LibFindMacros.cmake b/cmake/LibFindMacros.cmake deleted file mode 100644 index 3ef5844dd..000000000 --- a/cmake/LibFindMacros.cmake +++ /dev/null @@ -1,266 +0,0 @@ -# Version 2.2 -# Public Domain, originally written by Lasse Kärkkäinen -# Maintained at https://github.com/Tronic/cmake-modules -# Please send your improvements as pull requests on Github. - -# Find another package and make it a dependency of the current package. -# This also automatically forwards the "REQUIRED" argument. -# Usage: libfind_package( [extra args to find_package]) -macro (libfind_package PREFIX PKG) - set(${PREFIX}_args ${PKG} ${ARGN}) - if (${PREFIX}_FIND_REQUIRED) - set(${PREFIX}_args ${${PREFIX}_args} REQUIRED) - endif() - find_package(${${PREFIX}_args}) - set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG}) - unset(${PREFIX}_args) -endmacro() - -# A simple wrapper to make pkg-config searches a bit easier. -# Works the same as CMake's internal pkg_check_modules but is always quiet. -macro (libfind_pkg_check_modules) - find_package(PkgConfig QUIET) - if (PKG_CONFIG_FOUND) - pkg_check_modules(${ARGN} QUIET) - endif() -endmacro() - -# Avoid useless copy&pasta by doing what most simple libraries do anyway: -# pkg-config, find headers, find library. -# Usage: libfind_pkg_detect( FIND_PATH [other args] FIND_LIBRARY [other args]) -# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2) -function (libfind_pkg_detect PREFIX) - # Parse arguments - set(argname pkgargs) - foreach (i ${ARGN}) - if ("${i}" STREQUAL "FIND_PATH") - set(argname pathargs) - elseif ("${i}" STREQUAL "FIND_LIBRARY") - set(argname libraryargs) - else() - set(${argname} ${${argname}} ${i}) - endif() - endforeach() - if (NOT pkgargs) - message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.") - endif() - # Find library - libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs}) - if (pathargs) - find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS}) - endif() - if (libraryargs) - find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}) - endif() -endfunction() - -# Extracts a version #define from a version.h file, output stored to _VERSION. -# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR) -# Fourth argument "QUIET" may be used for silently testing different define names. -# This function does nothing if the version variable is already defined. -function (libfind_version_header PREFIX VERSION_H DEFINE_NAME) - # Skip processing if we already have a version or if the include dir was not found - if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR) - return() - endif() - set(quiet ${${PREFIX}_FIND_QUIETLY}) - # Process optional arguments - foreach(arg ${ARGN}) - if (arg STREQUAL "QUIET") - set(quiet TRUE) - else() - message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.") - endif() - endforeach() - # Read the header and parse for version number - set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") - if (NOT EXISTS ${filename}) - if (NOT quiet) - message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") - endif() - return() - endif() - file(READ "${filename}" header) - string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}") - # No regex match? - if (match STREQUAL header) - if (NOT quiet) - message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") - endif() - return() - endif() - # Export the version string - set(${PREFIX}_VERSION "${match}" PARENT_SCOPE) -endfunction() - -# Do the final processing once the paths have been detected. -# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain -# all the variables, each of which contain one include directory. -# Ditto for ${PREFIX}_PROCESS_LIBS and library files. -# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. -# Also handles errors in case library detection was required, etc. -function (libfind_process PREFIX) - # Skip processing if already processed during this configuration run - if (${PREFIX}_FOUND) - return() - endif() - - set(found TRUE) # Start with the assumption that the package was found - - # Did we find any files? Did we miss includes? These are for formatting better error messages. - set(some_files FALSE) - set(missing_headers FALSE) - - # Shorthands for some variables that we need often - set(quiet ${${PREFIX}_FIND_QUIETLY}) - set(required ${${PREFIX}_FIND_REQUIRED}) - set(exactver ${${PREFIX}_FIND_VERSION_EXACT}) - set(findver "${${PREFIX}_FIND_VERSION}") - set(version "${${PREFIX}_VERSION}") - - # Lists of config option names (all, includes, libs) - unset(configopts) - set(includeopts ${${PREFIX}_PROCESS_INCLUDES}) - set(libraryopts ${${PREFIX}_PROCESS_LIBS}) - - # Process deps to add to - foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES}) - if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS) - # The package seems to export option lists that we can use, woohoo! - list(APPEND includeopts ${${i}_INCLUDE_OPTS}) - list(APPEND libraryopts ${${i}_LIBRARY_OPTS}) - else() - # If plural forms don't exist or they equal singular forms - if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR - ({i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES)) - # Singular forms can be used - if (DEFINED ${i}_INCLUDE_DIR) - list(APPEND includeopts ${i}_INCLUDE_DIR) - endif() - if (DEFINED ${i}_LIBRARY) - list(APPEND libraryopts ${i}_LIBRARY) - endif() - else() - # Oh no, we don't know the option names - message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!") - endif() - endif() - endforeach() - - if (includeopts) - list(REMOVE_DUPLICATES includeopts) - endif() - - if (libraryopts) - list(REMOVE_DUPLICATES libraryopts) - endif() - - string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}") - if (NOT tmp STREQUAL "${includeopts} ${libraryopts}") - message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).") - endif() - - # Include/library names separated by spaces (notice: not CMake lists) - unset(includes) - unset(libs) - - # Process all includes and set found false if any are missing - foreach (i ${includeopts}) - list(APPEND configopts ${i}) - if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") - list(APPEND includes "${${i}}") - else() - set(found FALSE) - set(missing_headers TRUE) - endif() - endforeach() - - # Process all libraries and set found false if any are missing - foreach (i ${libraryopts}) - list(APPEND configopts ${i}) - if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") - list(APPEND libs "${${i}}") - else() - set (found FALSE) - endif() - endforeach() - - # Version checks - if (found AND findver) - if (NOT version) - message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.") - elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver)) - set(found FALSE) - set(version_unsuitable TRUE) - endif() - endif() - - # If all-OK, hide all config options, export variables, print status and exit - if (found) - foreach (i ${configopts}) - mark_as_advanced(${i}) - endforeach() - if (NOT quiet) - message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") - if (LIBFIND_DEBUG) - message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}") - message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}") - message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}") - message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}") - message(STATUS " ${PREFIX}_LIBRARIES=${libs}") - endif() - set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE) - set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE) - set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE) - set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE) - set (${PREFIX}_FOUND TRUE PARENT_SCOPE) - endif() - return() - endif() - - # Format messages for debug info and the type of error - set(vars "Relevant CMake configuration variables:\n") - foreach (i ${configopts}) - mark_as_advanced(CLEAR ${i}) - set(val ${${i}}) - if ("${val}" STREQUAL "${i}-NOTFOUND") - set (val "") - elseif (val AND NOT EXISTS ${val}) - set (val "${val} (does not exist)") - else() - set(some_files TRUE) - endif() - set(vars "${vars} ${i}=${val}\n") - endforeach() - set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n") - if (version_unsuitable) - set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but") - if (exactver) - set(msg "${msg} only version ${findver} is acceptable.") - else() - set(msg "${msg} version ${findver} is the minimum requirement.") - endif() - else() - if (missing_headers) - set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?") - elseif (some_files) - set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?") - if(findver) - set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).") - endif() - else() - set(msg "We were unable to find package ${PREFIX}.") - endif() - endif() - - # Fatal error out if REQUIRED - if (required) - set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.") - message(FATAL_ERROR "${msg}\n${vars}") - endif() - # Otherwise just print a nasty warning - if (NOT quiet) - message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}") - endif() -endfunction() - diff --git a/cmake/ProtobufGenerateCPPLikeBazel.cmake b/cmake/ProtobufGenerateCPPLikeBazel.cmake deleted file mode 100644 index 51de730dc..000000000 --- a/cmake/ProtobufGenerateCPPLikeBazel.cmake +++ /dev/null @@ -1,115 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2020-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function(PROTOBUF_GENERATE_CPP_LIKE_BAZEL SRCS HDRS) - cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) - - set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}") - if(NOT PROTO_FILES) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") - return() - endif() - - if(protobuf_EXPORT_MACRO) - set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:") - endif() - - get_filename_component(ABS_PROTO_PATH ${CMAKE_SOURCE_DIR} ABSOLUTE) - set(EXTRA_ARGS "--proto_path=${ABS_PROTO_PATH}") - file(RELATIVE_PATH Protobuf_PRE_IMPORT_DIRS ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - - if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) - set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") - endif() - - if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - endif() - - set(${SRCS}) - set(${HDRS}) - if (protobuf_DESCRIPTORS) - set(${protobuf_DESCRIPTORS}) - endif() - - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") - endif() - endif() - - if(Protobuf_PRE_IMPORT_DIRS) - set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${Protobuf_PRE_IMPORT_DIRS}/${FIL_WE}.pb.cc") - set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${Protobuf_PRE_IMPORT_DIRS}/${FIL_WE}.pb.h") - else() - set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") - set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") - endif() - list(APPEND ${SRCS} "${_protobuf_protoc_src}") - list(APPEND ${HDRS} "${_protobuf_protoc_hdr}") - - if(protobuf_DESCRIPTORS) - set(_protobuf_protoc_desc "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.desc") - set(_protobuf_protoc_flags "--descriptor_set_out=${_protobuf_protoc_desc}") - list(APPEND ${protobuf_DESCRIPTORS} "${_protobuf_protoc_desc}") - else() - set(_protobuf_protoc_desc "") - set(_protobuf_protoc_flags "") - endif() - - add_custom_command( - OUTPUT "${_protobuf_protoc_src}" - "${_protobuf_protoc_hdr}" - ${_protobuf_protoc_desc} - COMMAND protobuf::protoc - ${EXTRA_ARGS} - "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}" - ${_protobuf_protoc_flags} - ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} protobuf::protoc - COMMENT "Running C++ protocol buffer compiler on ${FIL}" - VERBATIM ) - endforeach() - - set(${SRCS} "${${SRCS}}" PARENT_SCOPE) - set(${HDRS} "${${HDRS}}" PARENT_SCOPE) - if(protobuf_DESCRIPTORS) - set(${protobuf_DESCRIPTORS} "${${protobuf_DESCRIPTORS}}" PARENT_SCOPE) - endif() -endfunction() diff --git a/cmake/ccache.conf.in b/cmake/ccache.conf.in deleted file mode 100644 index 5330647b0..000000000 --- a/cmake/ccache.conf.in +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022,NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -max_size = 10G -# hash_dir = false -# let ccache preserve C++ comments, because some of them may be meaningful to the compiler -keep_comments_cpp = true -cache_dir = @CCACHE_DIR@ -compiler_check = %compiler% --version -# Uncomment to debug ccache preprocessor errors/cache misses -log_file = @CCACHE_DIR@/ccache.log - -# Force absolute paths in error output for IDEs -absolute_paths_in_stderr = true diff --git a/cmake/debug_utils.cmake b/cmake/debug_utils.cmake deleted file mode 100644 index b1c7d9331..000000000 --- a/cmake/debug_utils.cmake +++ /dev/null @@ -1,72 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022,NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Get all propreties that cmake supports -if(NOT CMAKE_PROPERTY_LIST) - execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST) - - # Convert command output into a CMake list - string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") - string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") -endif() - -function(print_properties) - message("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}") -endfunction() - -function(print_target_properties target) - if(NOT TARGET ${target}) - message(STATUS "There is no target named '${target}'") - return() - endif() - - foreach(property ${CMAKE_PROPERTY_LIST}) - string(REPLACE "" "${CMAKE_BUILD_TYPE}" property ${property}) - - # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i - if(property STREQUAL "LOCATION" OR property MATCHES "^LOCATION_" OR property MATCHES "_LOCATION$") - continue() - endif() - - get_property(was_set TARGET ${target} PROPERTY ${property} SET) - if(was_set) - get_target_property(value ${target} ${property}) - message("${target} ${property} = ${value}") - endif() - endforeach() -endfunction() - - - -macro(get_all_targets_recursive targets dir) - get_property(subdirectories DIRECTORY ${dir} PROPERTY SUBDIRECTORIES) - foreach(subdir ${subdirectories}) - get_all_targets_recursive(${targets} ${subdir}) - endforeach() - - get_property(current_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS) - list(APPEND ${targets} ${current_targets}) -endmacro() - -function(get_all_targets var) - set(targets) - get_all_targets_recursive(targets ${CMAKE_CURRENT_SOURCE_DIR}) - set(${var} ${targets} PARENT_SCOPE) -endfunction() - -function(print_all_targets) - get_all_targets(all_targets) - message("All targets: ${all_targets}") -endfunction() diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index f2776f6bf..b52cc1245 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,36 +15,11 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "dep") -# Initialize rapids CPM with package overrides -rapids_cpm_init(OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/deps/rapids_cpm_package_overrides.json") - -# Print CMake settings when verbose output is enabled -message(VERBOSE "PROJECT_NAME: " ${PROJECT_NAME}) -message(VERBOSE "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}") -message(VERBOSE "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE}) -message(VERBOSE "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER}) -message(VERBOSE "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID}) -message(VERBOSE "CMAKE_CXX_COMPILER_VERSION: " ${CMAKE_CXX_COMPILER_VERSION}) -message(VERBOSE "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS}) -message(VERBOSE "CMAKE_CUDA_COMPILER: " ${CMAKE_CUDA_COMPILER}) -message(VERBOSE "CMAKE_CUDA_COMPILER_ID: " ${CMAKE_CUDA_COMPILER_ID}) -message(VERBOSE "CMAKE_CUDA_COMPILER_VERSION: " ${CMAKE_CUDA_COMPILER_VERSION}) -message(VERBOSE "CMAKE_CUDA_FLAGS: " ${CMAKE_CUDA_FLAGS}) -message(VERBOSE "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR}) -message(VERBOSE "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR}) -message(VERBOSE "CMAKE_CURRENT_LIST_DIR: " ${CMAKE_CURRENT_LIST_DIR}) -message(VERBOSE "CMAKE_EXE_LINKER_FLAGS: " ${CMAKE_EXE_LINKER_FLAGS}) -message(VERBOSE "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX}) -message(VERBOSE "CMAKE_INSTALL_FULL_INCLUDEDIR: " ${CMAKE_INSTALL_FULL_INCLUDEDIR}) -message(VERBOSE "CMAKE_INSTALL_FULL_LIBDIR: " ${CMAKE_INSTALL_FULL_LIBDIR}) -message(VERBOSE "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH}) -message(VERBOSE "CMAKE_PREFIX_PATH: " ${CMAKE_PREFIX_PATH}) -message(VERBOSE "CMAKE_FIND_ROOT_PATH: " ${CMAKE_FIND_ROOT_PATH}) -message(VERBOSE "CMAKE_LIBRARY_ARCHITECTURE: " ${CMAKE_LIBRARY_ARCHITECTURE}) -message(VERBOSE "FIND_LIBRARY_USE_LIB64_PATHS: " ${FIND_LIBRARY_USE_LIB64_PATHS}) -message(VERBOSE "CMAKE_SYSROOT: " ${CMAKE_SYSROOT}) -message(VERBOSE "CMAKE_STAGING_PREFIX: " ${CMAKE_STAGING_PREFIX}) -message(VERBOSE "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE: " ${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE}) +if (VERBOSE) + morpheus_utils_print_config() +endif() + +morpheus_utils_initialize_cpm(MRC_CACHE_DIR) # Start with CUDA. Need to add it to our export set rapids_find_package(CUDAToolkit @@ -57,33 +32,23 @@ rapids_find_package(CUDAToolkit # ===== # - Use static linking to avoid issues with system-wide installations of Boost. # - Use numa=on to ensure the numa component of fiber gets built -set(BOOST_VERSION "1.74.0" CACHE STRING "Version of boost to use") -include(deps/Configure_boost) +morpheus_utils_configure_boost_boost_cmake() # UCX # === -set(UCX_VERSION "1.13" CACHE STRING "Version of ucx to use") -include(deps/Configure_ucx) +morpheus_utils_configure_ucx() # hwloc # ===== -set(HWLOC_VERSION "2.5" CACHE STRING "Version of hwloc to use") -include(deps/Configure_hwloc) - -# FlatBuffers -# =========== -# rapids_find_package(Flatbuffers REQUIRED -# GLOBAL_TARGETS Flatbuffers -# BUILD_EXPORT_SET ${PROJECT_NAME}-core-exports -# INSTALL_EXPORT_SET ${PROJECT_NAME}-core-exports -# FIND_ARGS -# CONFIG -# ) +morpheus_utils_configure_hwloc() + +# expected +# ======== +morpheus_utils_configure_tl_expected() # NVIDIA RAPIDS RMM # ================= -set(RMM_VERSION "\${MRC_RAPIDS_VERSION}" CACHE STRING "Version of RMM to use. Defaults to \${MRC_RAPIDS_VERSION}") -include(deps/Configure_RMM) +morpheus_utils_configure_rmm() # gflags # ====== @@ -91,17 +56,13 @@ rapids_find_package(gflags REQUIRED GLOBAL_TARGETS gflags BUILD_EXPORT_SET ${PROJECT_NAME}-core-exports INSTALL_EXPORT_SET ${PROJECT_NAME}-core-exports - - # FIND_ARGS - # CONFIG ) # glog # ==== # - link against shared # - todo: compile with -DWITH_GFLAGS=OFF and remove gflags dependency -set(GLOG_VERSION "0.6" CACHE STRING "Version of glog to use") -include(deps/Configure_glog) +morpheus_utils_configure_glog() # nvidia cub # ========== @@ -123,8 +84,7 @@ rapids_find_package(gRPC REQUIRED # RxCpp # ===== -set(RXCPP_VERSION "4.1.1.2" CACHE STRING "Version of RxCpp to use") -include(deps/Configure_rxcpp) +morpheus_utils_configure_rxcpp() # JSON # ====== @@ -138,12 +98,11 @@ rapids_find_package(nlohmann_json REQUIRED # prometheus # ========= -set(PROMETHEUS_CPP_VERSION "1.0.0" CACHE STRING "Version of Prometheus-cpp to use") -include(deps/Configure_prometheus) +morpheus_utils_configure_prometheus_cpp() # libcudacxx # ========= -include(deps/Configure_libcudacxx) +morpheus_utils_configure_libcudacxx() if(MRC_BUILD_BENCHMARKS) # google benchmark diff --git a/cmake/deps/Configure_RMM.cmake b/cmake/deps/Configure_RMM.cmake deleted file mode 100644 index 8cde48ffd..000000000 --- a/cmake/deps/Configure_RMM.cmake +++ /dev/null @@ -1,52 +0,0 @@ -# ============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================= - -function(find_and_configure_rmm version) - list(APPEND CMAKE_MESSAGE_CONTEXT "rmm") - - include(cpm/rmm) - - # Does not work with cudf currently. Once updated to include rmm::Thrust to the GLOBAL_TARGETS. This should be used - # rapids_cpm_rmm( - # BUILD_EXPORT_SET ${PROJECT_NAME}-core-exports - # INSTALL_EXPORT_SET ${PROJECT_NAME}-core-exports - # ) - - # Allow setting version to a variable. If so, evaluate that here. Allows for dependent versions, i.e. RMM_VERSION=${MRC_RAPIDS_VERSION} - if("${version}" MATCHES [=[^\${(.+)}$]=]) - set(version "${${CMAKE_MATCH_1}}") - endif() - - rapids_cpm_find(rmm ${version} - GLOBAL_TARGETS - rmm::rmm rmm::Thrust - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/rapidsai/rmm.git - GIT_TAG branch-${version} - GIT_SHALLOW TRUE - OPTIONS "BUILD_TESTS OFF" - "BUILD_BENCHMARKS OFF" - "CUDA_STATIC_RUNTIME OFF" - "DISABLE_DEPRECATION_WARNING ${DISABLE_DEPRECATION_WARNINGS}" - ) -endfunction() - -find_and_configure_rmm(${RMM_VERSION}) diff --git a/cmake/deps/Configure_boost.cmake b/cmake/deps/Configure_boost.cmake deleted file mode 100644 index e618cb501..000000000 --- a/cmake/deps/Configure_boost.cmake +++ /dev/null @@ -1,83 +0,0 @@ -#============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -# This function is for when boost fully supports CMake. As of 1.76.0 the -# functionality is not supported but is in the master branch. Check in version -# 1.77 -function(find_and_configure_boost_true_cmake version) - - list(APPEND CMAKE_MESSAGE_CONTEXT "boost") - - cmake_policy(SET CMP0097 OLD) - set(Boost_ENABLE_CMAKE ON) - set(Boost_INCLUDE_LIBRARIES "fiber thread" CACHE STRING "") - set(Boost_EXCLUDE_LIBRARIES "leaf property_tree" CACHE STRING "") - set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs - - rapids_cpm_find(Boost ${version} - GLOBAL_TARGETS - Boost::context Boost::fiber Boost::hana Boost::filesystem Boost::system - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/boostorg/boost.git - GIT_TAG v${version} - GIT_SHALLOW TRUE - GIT_SUBMODULES "" - OPTIONS "BUILD_TESTING OFF" - FIND_PACKAGE_ARGUMENTS "COMPONENTS context fiber filesystem system" - ) -endfunction() - -# This function uses boost-cmake (https://github.com/Orphis/boost-cmake) to -# configure boost. Not always up to date. -function(find_and_configure_boost_boost_cmake version) - - list(APPEND CMAKE_MESSAGE_CONTEXT "boost") - - set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs - - rapids_cpm_find(Boost ${version} - GLOBAL_TARGETS - Boost::context Boost::fiber Boost::hana Boost::filesystem Boost::system - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/Orphis/boost-cmake.git - GIT_TAG "7f97a08b64bd5d2e53e932ddf80c40544cf45edf" - GIT_SHALLOW TRUE - OPTIONS "BUILD_TESTING OFF" - FIND_PACKAGE_ARGUMENTS "COMPONENTS context fiber filesystem system" - ) - - if (NOT Boost_ADDED) - # Now add it to the list of packages to install - rapids_export_package(INSTALL Boost - ${PROJECT_NAME}-core-exports - GLOBAL_TARGETS Boost::context Boost::fiber Boost::hana Boost::filesystem Boost::system - ) - - # Overwrite the default package contents - file(WRITE "${CMAKE_BINARY_DIR}/rapids-cmake/${PROJECT_NAME}-core-exports/install/package_Boost.cmake" "find_dependency(Boost REQUIRED COMPONENTS context fiber filesystem system)") - endif() -endfunction() - -find_and_configure_boost_boost_cmake(${BOOST_VERSION}) diff --git a/cmake/deps/Configure_gcov.cmake b/cmake/deps/Configure_gcov.cmake deleted file mode 100644 index f13f4a01e..000000000 --- a/cmake/deps/Configure_gcov.cmake +++ /dev/null @@ -1,725 +0,0 @@ -# Copyright (c) 2012 - 2017, Lars Bilke -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# CHANGES: -# -# 2012-01-31, Lars Bilke -# - Enable Code Coverage -# -# 2013-09-17, Joakim Söderberg -# - Added support for Clang. -# - Some additional usage instructions. -# -# 2016-02-03, Lars Bilke -# - Refactored functions to use named parameters -# -# 2017-06-02, Lars Bilke -# - Merged with modified version from github.com/ufz/ogs -# -# 2019-05-06, Anatolii Kurotych -# - Remove unnecessary --coverage flag -# -# 2019-12-13, FeRD (Frank Dana) -# - Deprecate COVERAGE_LCOVR_EXCLUDES and COVERAGE_GCOVR_EXCLUDES lists in favor -# of tool-agnostic COVERAGE_EXCLUDES variable, or EXCLUDE setup arguments. -# - CMake 3.4+: All excludes can be specified relative to BASE_DIRECTORY -# - All setup functions: accept BASE_DIRECTORY, EXCLUDE list -# - Set lcov basedir with -b argument -# - Add automatic --demangle-cpp in lcovr, if 'c++filt' is available (can be -# overridden with NO_DEMANGLE option in setup_target_for_coverage_lcovr().) -# - Delete output dir, .info file on 'make clean' -# - Remove Python detection, since version mismatches will break gcovr -# - Minor cleanup (lowercase function names, update examples...) -# -# 2019-12-19, FeRD (Frank Dana) -# - Rename Lcov outputs, make filtered file canonical, fix cleanup for targets -# -# 2020-01-19, Bob Apthorpe -# - Added gfortran support -# -# 2020-02-17, FeRD (Frank Dana) -# - Make all add_custom_target()s VERBATIM to auto-escape wildcard characters -# in EXCLUDEs, and remove manual escaping from gcovr targets -# -# 2021-01-19, Robin Mueller -# - Add CODE_COVERAGE_VERBOSE option which will allow to print out commands which are run -# - Added the option for users to set the GCOVR_ADDITIONAL_ARGS variable to supply additional -# flags to the gcovr command -# -# 2020-05-04, Mihchael Davis -# - Add -fprofile-abs-path to make gcno files contain absolute paths -# - Fix BASE_DIRECTORY not working when defined -# - Change BYPRODUCT from folder to index.html to stop ninja from complaining about double defines -# -# 2021-05-10, Martin Stump -# - Check if the generator is multi-config before warning about non-Debug builds -# -# 2022-02-22, Marko Wehle -# - Change gcovr output from -o for --xml and --html output respectively. -# This will allow for Multiple Output Formats at the same time by making use of GCOVR_ADDITIONAL_ARGS, e.g. GCOVR_ADDITIONAL_ARGS "--txt". -# -# USAGE: -# -# 1. Copy this file into your cmake modules path. -# -# 2. Add the following line to your CMakeLists.txt (best inside an if-condition -# using a CMake option() to enable it just optionally): -# include(CodeCoverage) -# -# 3. Append necessary compiler flags for all supported source files: -# append_coverage_compiler_flags() -# Or for specific target: -# append_coverage_compiler_flags_to_target(YOUR_TARGET_NAME) -# -# 3.a (OPTIONAL) Set appropriate optimization flags, e.g. -O0, -O1 or -Og -# -# 4. If you need to exclude additional directories from the report, specify them -# using full paths in the COVERAGE_EXCLUDES variable before calling -# setup_target_for_coverage_*(). -# Example: -# set(COVERAGE_EXCLUDES -# '${PROJECT_SOURCE_DIR}/src/dir1/*' -# '/path/to/my/src/dir2/*') -# Or, use the EXCLUDE argument to setup_target_for_coverage_*(). -# Example: -# setup_target_for_coverage_lcov( -# NAME coverage -# EXECUTABLE testrunner -# EXCLUDE "${PROJECT_SOURCE_DIR}/src/dir1/*" "/path/to/my/src/dir2/*") -# -# 4.a NOTE: With CMake 3.4+, COVERAGE_EXCLUDES or EXCLUDE can also be set -# relative to the BASE_DIRECTORY (default: PROJECT_SOURCE_DIR) -# Example: -# set(COVERAGE_EXCLUDES "dir1/*") -# setup_target_for_coverage_gcovr_html( -# NAME coverage -# EXECUTABLE testrunner -# BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/src" -# EXCLUDE "dir2/*") -# -# 5. Use the functions described below to create a custom make target which -# runs your test executable and produces a code coverage report. -# -# 6. Build a Debug build: -# cmake -DCMAKE_BUILD_TYPE=Debug .. -# make -# make my_coverage_target -# - -include(CMakeParseArguments) - -option(CODE_COVERAGE_VERBOSE "Verbose information" FALSE) - -# Check prereqs -find_program( GCOV_PATH gcov ) -find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl) -find_program( FASTCOV_PATH NAMES fastcov fastcov.py ) -find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat ) -find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test) -find_program( CPPFILT_PATH NAMES c++filt ) - -if(NOT GCOV_PATH) - message(FATAL_ERROR "gcov not found! Aborting...") -endif() # NOT GCOV_PATH - -get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) -list(GET LANGUAGES 0 LANG) - -if("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang") - if("${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS 3) - message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...") - endif() -elseif(NOT CMAKE_COMPILER_IS_GNUCXX) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "[Ff]lang") - # Do nothing; exit conditional without error if true - elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - # Do nothing; exit conditional without error if true - else() - message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") - endif() -endif() - -set(COVERAGE_COMPILER_FLAGS "-g" "-fprofile-arcs" "-ftest-coverage" - CACHE INTERNAL "") -if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") - include(CheckCXXCompilerFlag) - check_cxx_compiler_flag(-fprofile-abs-path HAVE_fprofile_abs_path) - if(HAVE_fprofile_abs_path) - set(COVERAGE_COMPILER_FLAGS ${COVERAGE_COMPILER_FLAGS} "-fprofile-abs-path") - endif() -endif() - -set(CMAKE_Fortran_FLAGS_COVERAGE - ${COVERAGE_COMPILER_FLAGS} - CACHE STRING "Flags used by the Fortran compiler during coverage builds." - FORCE ) -set(CMAKE_CXX_FLAGS_COVERAGE - ${COVERAGE_COMPILER_FLAGS} - CACHE STRING "Flags used by the C++ compiler during coverage builds." - FORCE ) -set(CMAKE_C_FLAGS_COVERAGE - ${COVERAGE_COMPILER_FLAGS} - CACHE STRING "Flags used by the C compiler during coverage builds." - FORCE ) -set(CMAKE_EXE_LINKER_FLAGS_COVERAGE - "" - CACHE STRING "Flags used for linking binaries during coverage builds." - FORCE ) -set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE - "" - CACHE STRING "Flags used by the shared libraries linker during coverage builds." - FORCE ) -mark_as_advanced( - CMAKE_Fortran_FLAGS_COVERAGE - CMAKE_CXX_FLAGS_COVERAGE - CMAKE_C_FLAGS_COVERAGE - CMAKE_EXE_LINKER_FLAGS_COVERAGE - CMAKE_SHARED_LINKER_FLAGS_COVERAGE ) - -get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG)) - message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading") -endif() # NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG) - -if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - link_libraries(gcov) -endif() - -# Defines a target for running and collection code coverage information -# Builds dependencies, runs the given executable and outputs reports. -# NOTE! The executable should always have a ZERO as exit code otherwise -# the coverage generation will not complete. -# -# setup_target_for_coverage_lcov( -# NAME testrunner_coverage # New target name -# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR -# DEPENDENCIES testrunner # Dependencies to build first -# BASE_DIRECTORY "../" # Base directory for report -# # (defaults to PROJECT_SOURCE_DIR) -# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative -# # to BASE_DIRECTORY, with CMake 3.4+) -# NO_DEMANGLE # Don't demangle C++ symbols -# # even if c++filt is found -# ) -function(setup_target_for_coverage_lcov) - - set(options NO_DEMANGLE) - set(oneValueArgs BASE_DIRECTORY NAME) - set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS) - cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(NOT LCOV_PATH) - message(FATAL_ERROR "lcov not found! Aborting...") - endif() # NOT LCOV_PATH - - if(NOT GENHTML_PATH) - message(FATAL_ERROR "genhtml not found! Aborting...") - endif() # NOT GENHTML_PATH - - # Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR - if(DEFINED Coverage_BASE_DIRECTORY) - get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE) - else() - set(BASEDIR ${PROJECT_SOURCE_DIR}) - endif() - - # Collect excludes (CMake 3.4+: Also compute absolute paths) - set(LCOV_EXCLUDES "") - foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_LCOV_EXCLUDES}) - if(CMAKE_VERSION VERSION_GREATER 3.4) - get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR}) - endif() - list(APPEND LCOV_EXCLUDES "${EXCLUDE}") - endforeach() - list(REMOVE_DUPLICATES LCOV_EXCLUDES) - - # Conditional arguments - if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE}) - set(GENHTML_EXTRA_ARGS "--demangle-cpp") - endif() - - # Setting up commands which will be run to generate coverage data. - # Cleanup lcov - set(LCOV_CLEAN_CMD - ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -directory . - -b ${BASEDIR} --zerocounters - ) - # Create baseline to make sure untouched files show up in the report - set(LCOV_BASELINE_CMD - ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d . -b - ${BASEDIR} -o ${Coverage_NAME}.base - ) - # Run tests - set(LCOV_EXEC_TESTS_CMD - ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS} - ) - # Capturing lcov counters and generating report - set(LCOV_CAPTURE_CMD - ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory . -b - ${BASEDIR} --capture --output-file ${Coverage_NAME}.capture - ) - # add baseline counters - set(LCOV_BASELINE_COUNT_CMD - ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base - -a ${Coverage_NAME}.capture --output-file ${Coverage_NAME}.total - ) - # filter collected data to final coverage report - set(LCOV_FILTER_CMD - ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove - ${Coverage_NAME}.total ${LCOV_EXCLUDES} --output-file ${Coverage_NAME}.info - ) - # Generate HTML output - set(LCOV_GEN_HTML_CMD - ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o - ${Coverage_NAME} ${Coverage_NAME}.info - ) - - - if(CODE_COVERAGE_VERBOSE) - message(STATUS "Executed command report") - message(STATUS "Command to clean up lcov: ") - string(REPLACE ";" " " LCOV_CLEAN_CMD_SPACED "${LCOV_CLEAN_CMD}") - message(STATUS "${LCOV_CLEAN_CMD_SPACED}") - - message(STATUS "Command to create baseline: ") - string(REPLACE ";" " " LCOV_BASELINE_CMD_SPACED "${LCOV_BASELINE_CMD}") - message(STATUS "${LCOV_BASELINE_CMD_SPACED}") - - message(STATUS "Command to run the tests: ") - string(REPLACE ";" " " LCOV_EXEC_TESTS_CMD_SPACED "${LCOV_EXEC_TESTS_CMD}") - message(STATUS "${LCOV_EXEC_TESTS_CMD_SPACED}") - - message(STATUS "Command to capture counters and generate report: ") - string(REPLACE ";" " " LCOV_CAPTURE_CMD_SPACED "${LCOV_CAPTURE_CMD}") - message(STATUS "${LCOV_CAPTURE_CMD_SPACED}") - - message(STATUS "Command to add baseline counters: ") - string(REPLACE ";" " " LCOV_BASELINE_COUNT_CMD_SPACED "${LCOV_BASELINE_COUNT_CMD}") - message(STATUS "${LCOV_BASELINE_COUNT_CMD_SPACED}") - - message(STATUS "Command to filter collected data: ") - string(REPLACE ";" " " LCOV_FILTER_CMD_SPACED "${LCOV_FILTER_CMD}") - message(STATUS "${LCOV_FILTER_CMD_SPACED}") - - message(STATUS "Command to generate lcov HTML output: ") - string(REPLACE ";" " " LCOV_GEN_HTML_CMD_SPACED "${LCOV_GEN_HTML_CMD}") - message(STATUS "${LCOV_GEN_HTML_CMD_SPACED}") - endif() - - # Setup target - add_custom_target(${Coverage_NAME} - COMMAND ${LCOV_CLEAN_CMD} - COMMAND ${LCOV_BASELINE_CMD} - COMMAND ${LCOV_EXEC_TESTS_CMD} - COMMAND ${LCOV_CAPTURE_CMD} - COMMAND ${LCOV_BASELINE_COUNT_CMD} - COMMAND ${LCOV_FILTER_CMD} - COMMAND ${LCOV_GEN_HTML_CMD} - - # Set output files as GENERATED (will be removed on 'make clean') - BYPRODUCTS - ${Coverage_NAME}.base - ${Coverage_NAME}.capture - ${Coverage_NAME}.total - ${Coverage_NAME}.info - ${Coverage_NAME}/index.html - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - DEPENDS ${Coverage_DEPENDENCIES} - VERBATIM # Protect arguments to commands - COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." - ) - - # Show where to find the lcov info report - add_custom_command(TARGET ${Coverage_NAME} POST_BUILD - COMMAND ; - COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info." - ) - - # Show info where to find the report - add_custom_command(TARGET ${Coverage_NAME} POST_BUILD - COMMAND ; - COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." - ) - -endfunction() # setup_target_for_coverage_lcov - -# Defines a target for running and collection code coverage information -# Builds dependencies, runs the given executable and outputs reports. -# NOTE! The executable should always have a ZERO as exit code otherwise -# the coverage generation will not complete. -# -# setup_target_for_coverage_gcovr_xml( -# NAME ctest_coverage # New target name -# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR -# DEPENDENCIES executable_target # Dependencies to build first -# BASE_DIRECTORY "../" # Base directory for report -# # (defaults to PROJECT_SOURCE_DIR) -# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative -# # to BASE_DIRECTORY, with CMake 3.4+) -# ) -# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the -# GCVOR command. -function(setup_target_for_coverage_gcovr_xml) - - set(options NONE) - set(oneValueArgs BASE_DIRECTORY NAME) - set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) - cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(NOT GCOVR_PATH) - message(FATAL_ERROR "gcovr not found! Aborting...") - endif() # NOT GCOVR_PATH - - # Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR - if(DEFINED Coverage_BASE_DIRECTORY) - get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE) - else() - set(BASEDIR ${PROJECT_SOURCE_DIR}) - endif() - - # Collect excludes (CMake 3.4+: Also compute absolute paths) - set(GCOVR_EXCLUDES "") - foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES}) - if(CMAKE_VERSION VERSION_GREATER 3.4) - get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR}) - endif() - list(APPEND GCOVR_EXCLUDES "${EXCLUDE}") - endforeach() - list(REMOVE_DUPLICATES GCOVR_EXCLUDES) - - # Combine excludes to several -e arguments - set(GCOVR_EXCLUDE_ARGS "") - foreach(EXCLUDE ${GCOVR_EXCLUDES}) - list(APPEND GCOVR_EXCLUDE_ARGS "-e") - list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}") - endforeach() - - # Set up commands which will be run to generate coverage data - # Run tests - set(GCOVR_XML_EXEC_TESTS_CMD - ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS} - ) - # Running gcovr - set(GCOVR_XML_CMD - ${GCOVR_PATH} --xml ${Coverage_NAME}.xml -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS} - ${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR} - ) - - if(CODE_COVERAGE_VERBOSE) - message(STATUS "Executed command report") - - message(STATUS "Command to run tests: ") - string(REPLACE ";" " " GCOVR_XML_EXEC_TESTS_CMD_SPACED "${GCOVR_XML_EXEC_TESTS_CMD}") - message(STATUS "${GCOVR_XML_EXEC_TESTS_CMD_SPACED}") - - message(STATUS "Command to generate gcovr XML coverage data: ") - string(REPLACE ";" " " GCOVR_XML_CMD_SPACED "${GCOVR_XML_CMD}") - message(STATUS "${GCOVR_XML_CMD_SPACED}") - endif() - - add_custom_target(${Coverage_NAME} - COMMAND ${GCOVR_XML_EXEC_TESTS_CMD} - COMMAND ${GCOVR_XML_CMD} - - BYPRODUCTS ${Coverage_NAME}.xml - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - DEPENDS ${Coverage_DEPENDENCIES} - VERBATIM # Protect arguments to commands - COMMENT "Running gcovr to produce Cobertura code coverage report." - ) - - # Show info where to find the report - add_custom_command(TARGET ${Coverage_NAME} POST_BUILD - COMMAND ; - COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml." - ) -endfunction() # setup_target_for_coverage_gcovr_xml - -# Defines a target for running and collection code coverage information -# Builds dependencies, runs the given executable and outputs reports. -# NOTE! The executable should always have a ZERO as exit code otherwise -# the coverage generation will not complete. -# -# setup_target_for_coverage_gcovr_html( -# NAME ctest_coverage # New target name -# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR -# DEPENDENCIES executable_target # Dependencies to build first -# BASE_DIRECTORY "../" # Base directory for report -# # (defaults to PROJECT_SOURCE_DIR) -# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative -# # to BASE_DIRECTORY, with CMake 3.4+) -# ) -# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the -# GCVOR command. -function(setup_target_for_coverage_gcovr_html) - - set(options NONE) - set(oneValueArgs BASE_DIRECTORY NAME) - set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) - cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(NOT GCOVR_PATH) - message(FATAL_ERROR "gcovr not found! Aborting...") - endif() # NOT GCOVR_PATH - - # Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR - if(DEFINED Coverage_BASE_DIRECTORY) - get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE) - else() - set(BASEDIR ${PROJECT_SOURCE_DIR}) - endif() - - # Collect excludes (CMake 3.4+: Also compute absolute paths) - set(GCOVR_EXCLUDES "") - foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES}) - if(CMAKE_VERSION VERSION_GREATER 3.4) - get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR}) - endif() - list(APPEND GCOVR_EXCLUDES "${EXCLUDE}") - endforeach() - list(REMOVE_DUPLICATES GCOVR_EXCLUDES) - - # Combine excludes to several -e arguments - set(GCOVR_EXCLUDE_ARGS "") - foreach(EXCLUDE ${GCOVR_EXCLUDES}) - list(APPEND GCOVR_EXCLUDE_ARGS "-e") - list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}") - endforeach() - - # Set up commands which will be run to generate coverage data - # Run tests - set(GCOVR_HTML_EXEC_TESTS_CMD - ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS} - ) - # Create folder - set(GCOVR_HTML_FOLDER_CMD - ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME} - ) - # Running gcovr - set(GCOVR_HTML_CMD - ${GCOVR_PATH} --html ${Coverage_NAME}/index.html --html-details -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS} - ${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR} - ) - - if(CODE_COVERAGE_VERBOSE) - message(STATUS "Executed command report") - - message(STATUS "Command to run tests: ") - string(REPLACE ";" " " GCOVR_HTML_EXEC_TESTS_CMD_SPACED "${GCOVR_HTML_EXEC_TESTS_CMD}") - message(STATUS "${GCOVR_HTML_EXEC_TESTS_CMD_SPACED}") - - message(STATUS "Command to create a folder: ") - string(REPLACE ";" " " GCOVR_HTML_FOLDER_CMD_SPACED "${GCOVR_HTML_FOLDER_CMD}") - message(STATUS "${GCOVR_HTML_FOLDER_CMD_SPACED}") - - message(STATUS "Command to generate gcovr HTML coverage data: ") - string(REPLACE ";" " " GCOVR_HTML_CMD_SPACED "${GCOVR_HTML_CMD}") - message(STATUS "${GCOVR_HTML_CMD_SPACED}") - endif() - - add_custom_target(${Coverage_NAME} - COMMAND ${GCOVR_HTML_EXEC_TESTS_CMD} - COMMAND ${GCOVR_HTML_FOLDER_CMD} - COMMAND ${GCOVR_HTML_CMD} - - BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html # report directory - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - DEPENDS ${Coverage_DEPENDENCIES} - VERBATIM # Protect arguments to commands - COMMENT "Running gcovr to produce HTML code coverage report." - ) - - # Show info where to find the report - add_custom_command(TARGET ${Coverage_NAME} POST_BUILD - COMMAND ; - COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." - ) - -endfunction() # setup_target_for_coverage_gcovr_html - -# Defines a target for running and collection code coverage information -# Builds dependencies, runs the given executable and outputs reports. -# NOTE! The executable should always have a ZERO as exit code otherwise -# the coverage generation will not complete. -# -# setup_target_for_coverage_fastcov( -# NAME testrunner_coverage # New target name -# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR -# DEPENDENCIES testrunner # Dependencies to build first -# BASE_DIRECTORY "../" # Base directory for report -# # (defaults to PROJECT_SOURCE_DIR) -# EXCLUDE "src/dir1/" "src/dir2/" # Patterns to exclude. -# NO_DEMANGLE # Don't demangle C++ symbols -# # even if c++filt is found -# SKIP_HTML # Don't create html report -# POST_CMD perl -i -pe s!${PROJECT_SOURCE_DIR}/!!g ctest_coverage.json # E.g. for stripping source dir from file paths -# ) -function(setup_target_for_coverage_fastcov) - - set(options NO_DEMANGLE SKIP_HTML) - set(oneValueArgs BASE_DIRECTORY NAME) - set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES FASTCOV_ARGS GENHTML_ARGS POST_CMD) - cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(NOT FASTCOV_PATH) - message(FATAL_ERROR "fastcov not found! Aborting...") - endif() - - if(NOT Coverage_SKIP_HTML AND NOT GENHTML_PATH) - message(FATAL_ERROR "genhtml not found! Aborting...") - endif() - - # Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR - if(Coverage_BASE_DIRECTORY) - get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE) - else() - set(BASEDIR ${PROJECT_SOURCE_DIR}) - endif() - - # Collect excludes (Patterns, not paths, for fastcov) - set(FASTCOV_EXCLUDES "") - foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_FASTCOV_EXCLUDES}) - list(APPEND FASTCOV_EXCLUDES "${EXCLUDE}") - endforeach() - list(REMOVE_DUPLICATES FASTCOV_EXCLUDES) - - # Conditional arguments - if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE}) - set(GENHTML_EXTRA_ARGS "--demangle-cpp") - endif() - - # Set up commands which will be run to generate coverage data - set(FASTCOV_EXEC_TESTS_CMD ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}) - - set(FASTCOV_CAPTURE_CMD ${FASTCOV_PATH} ${Coverage_FASTCOV_ARGS} --gcov ${GCOV_PATH} - --search-directory ${BASEDIR} - --process-gcno - --output ${Coverage_NAME}.json - --exclude ${FASTCOV_EXCLUDES} - --exclude ${FASTCOV_EXCLUDES} - ) - - set(FASTCOV_CONVERT_CMD ${FASTCOV_PATH} - -C ${Coverage_NAME}.json --lcov --output ${Coverage_NAME}.info - ) - - if(Coverage_SKIP_HTML) - set(FASTCOV_HTML_CMD ";") - else() - set(FASTCOV_HTML_CMD ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} - -o ${Coverage_NAME} ${Coverage_NAME}.info - ) - endif() - - set(FASTCOV_POST_CMD ";") - if(Coverage_POST_CMD) - set(FASTCOV_POST_CMD ${Coverage_POST_CMD}) - endif() - - if(CODE_COVERAGE_VERBOSE) - message(STATUS "Code coverage commands for target ${Coverage_NAME} (fastcov):") - - message(" Running tests:") - string(REPLACE ";" " " FASTCOV_EXEC_TESTS_CMD_SPACED "${FASTCOV_EXEC_TESTS_CMD}") - message(" ${FASTCOV_EXEC_TESTS_CMD_SPACED}") - - message(" Capturing fastcov counters and generating report:") - string(REPLACE ";" " " FASTCOV_CAPTURE_CMD_SPACED "${FASTCOV_CAPTURE_CMD}") - message(" ${FASTCOV_CAPTURE_CMD_SPACED}") - - message(" Converting fastcov .json to lcov .info:") - string(REPLACE ";" " " FASTCOV_CONVERT_CMD_SPACED "${FASTCOV_CONVERT_CMD}") - message(" ${FASTCOV_CONVERT_CMD_SPACED}") - - if(NOT Coverage_SKIP_HTML) - message(" Generating HTML report: ") - string(REPLACE ";" " " FASTCOV_HTML_CMD_SPACED "${FASTCOV_HTML_CMD}") - message(" ${FASTCOV_HTML_CMD_SPACED}") - endif() - if(Coverage_POST_CMD) - message(" Running post command: ") - string(REPLACE ";" " " FASTCOV_POST_CMD_SPACED "${FASTCOV_POST_CMD}") - message(" ${FASTCOV_POST_CMD_SPACED}") - endif() - endif() - - # Setup target - add_custom_target(${Coverage_NAME} - - # Cleanup fastcov - COMMAND ${FASTCOV_PATH} ${Coverage_FASTCOV_ARGS} --gcov ${GCOV_PATH} - --search-directory ${BASEDIR} - --zerocounters - - COMMAND ${FASTCOV_EXEC_TESTS_CMD} - COMMAND ${FASTCOV_CAPTURE_CMD} - COMMAND ${FASTCOV_CONVERT_CMD} - COMMAND ${FASTCOV_HTML_CMD} - COMMAND ${FASTCOV_POST_CMD} - - # Set output files as GENERATED (will be removed on 'make clean') - BYPRODUCTS - ${Coverage_NAME}.info - ${Coverage_NAME}.json - ${Coverage_NAME}/index.html # report directory - - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - DEPENDS ${Coverage_DEPENDENCIES} - VERBATIM # Protect arguments to commands - COMMENT "Resetting code coverage counters to zero. Processing code coverage counters and generating report." - ) - - set(INFO_MSG "fastcov code coverage info report saved in ${Coverage_NAME}.info and ${Coverage_NAME}.json.") - if(NOT Coverage_SKIP_HTML) - string(APPEND INFO_MSG " Open ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html in your browser to view the coverage report.") - endif() - # Show where to find the fastcov info report - add_custom_command(TARGET ${Coverage_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo ${INFO_MSG} - ) - -endfunction() # setup_target_for_coverage_fastcov - -function(append_coverage_compiler_flags) - foreach(FLAG IN LISTS COVERAGE_COMPILER_FLAGS) - string(APPEND CMAKE_C_FLAGS " ${FLAG}") - string(APPEND CMAKE_CXX_FLAGS " ${FLAG}") - string(APPEND CMAKE_Fortran_FLAGS " ${FLAG}") - endforeach() - - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" PARENT_SCOPE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE) - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" PARENT_SCOPE) - message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}") -endfunction() # append_coverage_compiler_flags - -# Setup coverage for specific library -function(append_coverage_compiler_flags_to_target name) - target_compile_options(${name} - PRIVATE ${COVERAGE_COMPILER_FLAGS}) -endfunction() \ No newline at end of file diff --git a/cmake/deps/Configure_glog.cmake b/cmake/deps/Configure_glog.cmake deleted file mode 100644 index dad8a36ed..000000000 --- a/cmake/deps/Configure_glog.cmake +++ /dev/null @@ -1,40 +0,0 @@ -#============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -function(find_and_configure_glog version) - - list(APPEND CMAKE_MESSAGE_CONTEXT "glog") - - rapids_cpm_find(glog ${version} - GLOBAL_TARGETS - glog glog::glog - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/google/glog.git - GIT_TAG v${version} - GIT_SHALLOW TRUE - OPTIONS "WITH_CUSTOM_PREFIX ON" - "WITH_PKGCONFIG OFF" - "BUILD_TESTING OFF" - ) - -endfunction() - -find_and_configure_glog(${GLOG_VERSION}) diff --git a/cmake/deps/Configure_hwloc.cmake b/cmake/deps/Configure_hwloc.cmake deleted file mode 100644 index bcf03956c..000000000 --- a/cmake/deps/Configure_hwloc.cmake +++ /dev/null @@ -1,161 +0,0 @@ -#============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -find_package(CUDAToolkit) - -function(find_and_configure_hwloc version) - - list(APPEND CMAKE_MESSAGE_CONTEXT "hwloc") - - set(oneValueArgs VERSION PINNED_TAG) - cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" - "${multiValueArgs}" ${ARGN} ) - - # # Generate the find modules since hwloc doesnt do this for us - # rapids_find_generate_module(hwloc - # HEADER_NAMES - # hwloc.h - # LIBRARY_NAMES - # hwloc - # VERSION - # hwloc_VERSION - # ) - - find_package(PkgConfig) - - pkg_check_modules(hwloc IMPORTED_TARGET GLOBAL hwloc) - - if (hwloc_FOUND) - - message(STATUS "Found hwloc with pkg-config at: ${hwloc_LIBRARY_DIRS}") - - # Add an alias to the imported target - add_library(hwloc::hwloc ALIAS PkgConfig::hwloc) - - set(name "hwloc") - - # Now add it to the list of packages to install - rapids_export_package(INSTALL hwloc - ${PROJECT_NAME}-core-exports - GLOBAL_TARGETS hwloc::hwloc - ) - - # Overwrite the default package contents - configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/templates/pkgconfig_package.cmake.in" - "${CMAKE_BINARY_DIR}/rapids-cmake/${PROJECT_NAME}-core-exports/install/package_hwloc.cmake" @ONLY) - - else() - - # Try to find hwloc and download from source if not found - rapids_cpm_find(hwloc ${version} - GLOBAL_TARGETS - hwloc hwloc::hwloc - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/open-mpi/hwloc.git - GIT_TAG "hwloc-${version}" - DOWNLOAD_ONLY TRUE - FIND_PACKAGE_ARGUMENTS "EXACT" - ) - - if (hwloc_ADDED) - # If we got here, hwloc wasnt found. Add custom targets to build from source. - message(STATUS "hwloc not installed. Building from source.") - - # Location where all files will be temp installed - set(hwloc_INSTALL_DIR ${hwloc_BINARY_DIR}/install) - - # Ensure the output exists - # file(MAKE_DIRECTORY ${hwloc_INSTALL_DIR}) - file(MAKE_DIRECTORY ${hwloc_INSTALL_DIR}/include) - # file(MAKE_DIRECTORY ${hwloc_BINARY_DIR}/include) - - include(ExternalProject) - - string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UC) - - # Get the Compiler settings to forward onto autoconf - set(COMPILER_SETTINGS - "CXX=${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}" - "CPP=${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER} -E" - "CC=${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}" - "AR=${CMAKE_C_COMPILER_AR}" - "RANLIB=${CMAKE_C_COMPILER_RANLIB}" - "NM=${CMAKE_NM}" - "STRIP=${CMAKE_STRIP}" - "CFLAGS=${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}" - "CPPFLAGS=${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}} -I${CUDAToolkit_INCLUDE_DIRS}" # Add CUDAToolkit here - "CXXFLAGS=${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BUILD_TYPE_UC}}" - "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE_UC}}" - ) - - ExternalProject_Add(hwloc - PREFIX ${hwloc_BINARY_DIR} - SOURCE_DIR ${hwloc_BINARY_DIR} - INSTALL_DIR ${hwloc_INSTALL_DIR} - # Copy from CPM cache into the build tree - DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${hwloc_SOURCE_DIR} ${hwloc_BINARY_DIR} - # Note, we set SED and GREP here since they can be hard coded in the conda libtoolize - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env SED=sed GREP=grep /autogen.sh - COMMAND /configure ${COMPILER_SETTINGS} --prefix=${CMAKE_INSTALL_PREFIX} --enable-plugins=linux,x86,nvml,pcie,xml --enable-static - BUILD_COMMAND make -j - BUILD_IN_SOURCE TRUE - BUILD_BYPRODUCTS /lib/libhwloc.a - INSTALL_COMMAND make install prefix= - LOG_CONFIGURE TRUE - LOG_BUILD TRUE - LOG_INSTALL TRUE - # Add a target for configuring to allow for style checks on source code - STEP_TARGETS install - ) - - # Install only the headers - install( - DIRECTORY ${hwloc_INSTALL_DIR}/include - TYPE INCLUDE - ) - - add_library(hwloc::hwloc STATIC IMPORTED GLOBAL) - - set_target_properties(hwloc::hwloc PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$;$" - INTERFACE_POSITION_INDEPENDENT_CODE "ON" - ) - set_property(TARGET hwloc::hwloc APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(hwloc::hwloc PROPERTIES - IMPORTED_LOCATION_RELEASE "${hwloc_INSTALL_DIR}/lib/libhwloc.a" - IMPORTED_SONAME_RELEASE "libhwloc.a" - ) - - # # Add public dependency of xml2 - # set_target_properties(hwloc::hwloc PROPERTIES - # INTERFACE_LINK_LIBRARIES "xml2" - # ) - add_dependencies(hwloc::hwloc hwloc) - - # Finally, add this to the style check dependencies - add_dependencies(${PROJECT_NAME}_style_checks hwloc-install) - - endif() - endif() - -endfunction() - -find_and_configure_hwloc(${HWLOC_VERSION}) diff --git a/cmake/deps/Configure_libcudacxx.cmake b/cmake/deps/Configure_libcudacxx.cmake deleted file mode 100644 index 47745b50b..000000000 --- a/cmake/deps/Configure_libcudacxx.cmake +++ /dev/null @@ -1,38 +0,0 @@ -#============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -function(find_and_configure_libcudacxx) - - list(APPEND CMAKE_MESSAGE_CONTEXT "libcudacxx") - - include("${rapids-cmake-dir}/cpm/libcudacxx.cmake") - - # Use rapids-cpm to load libcudacxx. This makes an interface library - # libcudacxx::libcudacxx that you can link against. If rapids_cpm_libcudaxx is - # removed, be sure to set `libcudacxx_SOURCE_DIR` since other libraries can - # depend on this variable. Set it in the parent scope to ensure its valid - # See: https://github.com/rapidsai/rapids-cmake/issues/117 - rapids_cpm_libcudacxx( - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - ) - -endfunction() - -find_and_configure_libcudacxx() diff --git a/cmake/deps/Configure_prometheus.cmake b/cmake/deps/Configure_prometheus.cmake deleted file mode 100644 index ca65aca6c..000000000 --- a/cmake/deps/Configure_prometheus.cmake +++ /dev/null @@ -1,50 +0,0 @@ -#============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -function(find_and_configure_prometheus_cpp version) - list(APPEND CMAKE_MESSAGE_CONTEXT "prometheus_cpp") - - rapids_cpm_find(prometheus-cpp ${version} - GLOBAL_TARGETS - prometheus-cpp prometheus-cpp::core - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/jupp0r/prometheus-cpp.git - GIT_TAG "v${version}" - GIT_SHALLOW TRUE - PATCH_COMMAND git checkout -- . && git apply --whitespace=fix ${PROJECT_SOURCE_DIR}/cmake/deps/patches/prometheus_export_fix.patch - OPTIONS "BUILD_SHARED_LIBS OFF" - "ENABLE_PULL OFF" - "ENABLE_PUSH OFF" - "ENABLE_COMPRESSION OFF" - "ENABLE_TESTING OFF" - "USE_THIRDPARTY_LIBRARIES OFF" - "OVERRIDE_CXX_STANDARD_FLAGS OFF" - "THIRDPARTY_CIVETWEB_WITH_SSL OFF" - "GENERATE_PKGCONFIG OFF" - ) - -endfunction() - -find_and_configure_prometheus_cpp(${PROMETHEUS_CPP_VERSION}) -## Manually export prometheus-core. Use this if we don't want to apply the export fix patch. -#add_library(prometheus-cpp-core STATIC IMPORTED) -#set_property(TARGET prometheus-cpp-core PROPERTY -# IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/_deps/prometheus-cpp-build/lib/libprometheus-cpp-core.a") diff --git a/cmake/deps/Configure_pybind11.cmake b/cmake/deps/Configure_pybind11.cmake deleted file mode 100644 index 64919315c..000000000 --- a/cmake/deps/Configure_pybind11.cmake +++ /dev/null @@ -1,40 +0,0 @@ -#============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -function(find_and_configure_pybind11 version) - - list(APPEND CMAKE_MESSAGE_CONTEXT "pybind11") - - # Needs a patch to change the internal tracker to use fiber specific storage instead of TSS - rapids_cpm_find(pybind11 ${version} - GLOBAL_TARGETS - pybind11 pybind11::pybind11 - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/pybind/pybind11.git - GIT_TAG "v${version}" - GIT_SHALLOW TRUE - PATCH_COMMAND git checkout -- . && git apply --whitespace=fix ${PROJECT_SOURCE_DIR}/cmake/deps/patches/pybind11.patch - OPTIONS "PYBIND11_INSTALL ON" - "PYBIND11_TEST OFF" - ) -endfunction() - -find_and_configure_pybind11(${PYBIND11_VERSION}) diff --git a/cmake/deps/Configure_rxcpp.cmake b/cmake/deps/Configure_rxcpp.cmake deleted file mode 100644 index 66de7a6e5..000000000 --- a/cmake/deps/Configure_rxcpp.cmake +++ /dev/null @@ -1,40 +0,0 @@ -#============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -function(find_and_configure_rxcpp version) - - list(APPEND CMAKE_MESSAGE_CONTEXT "rxcpp") - - rapids_cpm_find(rxcpp ${version} - GLOBAL_TARGETS - rxcpp rxcpp::rxcpp - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/mdemoret-nv/RxCpp.git # TODO(MDD): Move RxCpp fork to nv-morpheus - GIT_TAG v${version} - GIT_SHALLOW TRUE - OPTIONS "RX_BUILD_TESTING OFF" - "RX_BUILD_EXAMPLES OFF" - "RXCPP_USE_FIBERS ON" - ) - -endfunction() - -find_and_configure_rxcpp(${RXCPP_VERSION}) diff --git a/cmake/deps/Configure_ucx.cmake b/cmake/deps/Configure_ucx.cmake deleted file mode 100644 index 550999d30..000000000 --- a/cmake/deps/Configure_ucx.cmake +++ /dev/null @@ -1,182 +0,0 @@ -#============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -function(find_and_configure_ucx version) - - list(APPEND CMAKE_MESSAGE_CONTEXT "ucx") - - # Try to find UCX and download from source if not found - rapids_cpm_find(ucx ${version} - GLOBAL_TARGETS - ucx ucx::ucp ucx::uct ucx_ucx ucx::ucp ucx::uct ucx::ucx - BUILD_EXPORT_SET - ${PROJECT_NAME}-core-exports - INSTALL_EXPORT_SET - ${PROJECT_NAME}-core-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/openucx/ucx.git - GIT_TAG "v${version}" - DOWNLOAD_ONLY TRUE - ) - - if (ucx_ADDED) - # If we got here, UCX wasnt found. Add custom targets to build from source. - message(STATUS "UCX Not Found. Building from source.") - - # Location where all files will be temp installed - set(ucx_INSTALL_DIR ${ucx_BINARY_DIR}/install) - - # Because libtool shows an error when calling `make install - # prefix=`. We have to use DESTDIR instead. Make a symbolic - # link to prevent very long names in the include paths - set(ucx_DEST_DIR ${ucx_BINARY_DIR}/install_dest) - - # Ensure the output exists - file(MAKE_DIRECTORY ${ucx_DEST_DIR}/${CMAKE_INSTALL_PREFIX}) - file(CREATE_LINK ${ucx_DEST_DIR}/${CMAKE_INSTALL_PREFIX} ${ucx_INSTALL_DIR} SYMBOLIC) - file(MAKE_DIRECTORY ${ucx_BINARY_DIR}/install) - file(MAKE_DIRECTORY ${ucx_INSTALL_DIR}/include) - - # file(MAKE_DIRECTORY ${ucx_BINARY_DIR}/src) - - include(ExternalProject) - - string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UC) - - # Get the Compiler settings to forward onto autoconf - set(COMPILER_SETTINGS - "CXX=${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}" - "CPP=${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER} -E" - "CC=${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}" - "AR=${CMAKE_C_COMPILER_AR}" - "RANLIB=${CMAKE_C_COMPILER_RANLIB}" - "NM=${CMAKE_NM}" - "STRIP=${CMAKE_STRIP}" - "CFLAGS=${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}" - "CPPFLAGS=${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}" - "CXXFLAGS=${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BUILD_TYPE_UC}}" - "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE_UC}}" - ) - - # Use BUILD_IN_SOURCE because UCX cant do out of source builds and CMake sucks at change directory - ExternalProject_Add(ucx - PREFIX ${ucx_BINARY_DIR} - SOURCE_DIR ${ucx_BINARY_DIR} - INSTALL_DIR ${ucx_INSTALL_DIR} - # Copy from CPM cache into the build tree - DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${ucx_SOURCE_DIR} ${ucx_BINARY_DIR} - # The io_demo fails to build in out of source builds. So remove that from - # the Makefile (wish we could just disable all test/examples/apps) as a - # part of the download command - PATCH_COMMAND git checkout -- . && git apply --whitespace=fix ${PROJECT_SOURCE_DIR}/cmake/deps/patches/ucx.patch - # Note, we set SED and GREP here since they can be hard coded in the conda libtoolize - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env SED=sed GREP=grep /autogen.sh - COMMAND /contrib/configure-release ${COMPILER_SETTINGS} --prefix=${CMAKE_INSTALL_PREFIX} --enable-mt --without-rdmacm --disable-gtest --disable-examples - BUILD_COMMAND make -j - BUILD_IN_SOURCE TRUE - BUILD_BYPRODUCTS /lib/libuct.a - /lib/libucp.a - /lib/libucs.a - /lib/libucm.a - INSTALL_COMMAND make DESTDIR=${ucx_DEST_DIR} install - LOG_CONFIGURE TRUE - LOG_BUILD TRUE - LOG_INSTALL TRUE - # Add a target for configuring to allow for style checks on source code - STEP_TARGETS install - ) - - # Install only the headers - install( - DIRECTORY ${ucx_INSTALL_DIR}/include - TYPE INCLUDE - ) - - # TODO: We support components in the custom build branch but not when UCX is found via find_package. - # UCT Library - add_library(ucx::uct STATIC IMPORTED GLOBAL) - set_target_properties(ucx::uct PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$;$" - INTERFACE_POSITION_INDEPENDENT_CODE "ON" - ) - set_property(TARGET ucx::uct APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(ucx::uct PROPERTIES - IMPORTED_LOCATION_RELEASE "${ucx_INSTALL_DIR}/lib/libuct.a" - IMPORTED_SONAME_RELEASE "libuct.a" - ) - add_dependencies(ucx::uct ucx) - - # UCP Library - add_library(ucx::ucp STATIC IMPORTED GLOBAL) - set_target_properties(ucx::ucp PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$;$" - INTERFACE_POSITION_INDEPENDENT_CODE "ON" - ) - set_property(TARGET ucx::ucp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(ucx::ucp PROPERTIES - IMPORTED_LOCATION_RELEASE "${ucx_INSTALL_DIR}/lib/libucp.a" - IMPORTED_SONAME_RELEASE "libucp.a" - ) - add_dependencies(ucx::ucp ucx) - - # UCS Library - add_library(ucx::ucs STATIC IMPORTED GLOBAL) - set_target_properties(ucx::ucs PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$;$" - INTERFACE_POSITION_INDEPENDENT_CODE "ON" - ) - set_property(TARGET ucx::ucs APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(ucx::ucs PROPERTIES - IMPORTED_LOCATION_RELEASE "${ucx_INSTALL_DIR}/lib/libucs.a" - IMPORTED_SONAME_RELEASE "libucs.a" - ) - add_dependencies(ucx::ucs ucx) - - # UCM Library - add_library(ucx::ucm STATIC IMPORTED GLOBAL) - set_target_properties(ucx::ucm PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$;$" - INTERFACE_POSITION_INDEPENDENT_CODE "ON" - ) - set_property(TARGET ucx::ucm APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(ucx::ucm PROPERTIES - IMPORTED_LOCATION_RELEASE "${ucx_INSTALL_DIR}/lib/libucm.a" - IMPORTED_SONAME_RELEASE "libucm.a" - ) - add_dependencies(ucx::ucm ucx) - - # Combined ucx::ucx target - add_library(ucx::ucx INTERFACE IMPORTED) - set_target_properties(ucx::ucx PROPERTIES - INTERFACE_LINK_LIBRARIES "ucx::uct;ucx::ucp;ucx::ucs;ucx::ucm" - ) - - # Finally, add this to the style check dependencies - add_dependencies(${PROJECT_NAME}_style_checks ucx-install) - else() - # Found installed UCX. Make sure to call rapids_export_package without a version. - # Otherwise CMake fails with trying to add the dependency twice - rapids_export_package( - INSTALL ucx ${PROJECT_NAME}-core-exports - GLOBAL_TARGETS ucx ucx::ucp ucx::uct ucx_ucx ucx::ucp ucx::uct ucx::ucx - ) - - endif() - -endfunction() - -find_and_configure_ucx(${UCX_VERSION}) diff --git a/cmake/deps/patches/cpuaff.patch b/cmake/deps/patches/cpuaff.patch deleted file mode 100644 index e4b32c692..000000000 --- a/cmake/deps/patches/cpuaff.patch +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022,NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -diff --git a/Makefile.am b/Makefile.am -index b8051b0..25ef0e5 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -1,2 +1,2 @@ --SUBDIRS = include examples tests -+SUBDIRS = include - TESTS = tests/test diff --git a/cmake/deps/patches/prometheus_export_fix.patch b/cmake/deps/patches/prometheus_export_fix.patch deleted file mode 100644 index 8ff6db71c..000000000 --- a/cmake/deps/patches/prometheus_export_fix.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4ee6812..3f52d0a 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -121,6 +121,12 @@ endif() - - include(CMakePackageConfigHelpers) - -+export( -+ EXPORT ${PROJECT_NAME}-targets -+ FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}-targets.cmake" -+ NAMESPACE ${PROJECT_NAME}:: -+) -+ - install( - EXPORT ${PROJECT_NAME}-targets - NAMESPACE ${PROJECT_NAME}:: diff --git a/cmake/deps/patches/pybind11.patch b/cmake/deps/patches/pybind11.patch deleted file mode 100644 index 186897119..000000000 --- a/cmake/deps/patches/pybind11.patch +++ /dev/null @@ -1,74 +0,0 @@ -/* - pybind11/detail/type_caster_base.h (originally first part of pybind11/cast.h) - Copyright (c) 2016 Wenzel Jakob - All rights reserved. Use of this source code is governed by a - BSD-style license that can be found in the - LICENSE file https://github.com/pybind/pybind11/blob/master/LICENSE. -*/ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: BSD-3-Clause -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h -index f804d9d..a579a7f 100644 ---- a/include/pybind11/detail/type_caster_base.h -+++ b/include/pybind11/detail/type_caster_base.h -@@ -25,6 +25,12 @@ - #include - #include - -+#define WITH_FIBERS -+ -+#ifdef WITH_FIBERS -+#include -+#endif -+ - PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) - PYBIND11_NAMESPACE_BEGIN(detail) - -@@ -35,7 +41,20 @@ private: - loader_life_support* parent = nullptr; - std::unordered_set keep_alive; - --#if defined(WITH_THREAD) -+#if defined(WITH_FIBERS) -+ // Store stack pointer in thread-local storage. -+ static boost::fibers::fiber_specific_ptr& get_stack_tls_key() { -+ static boost::fibers::fiber_specific_ptr fiber_stack([](loader_life_support* x){}); -+ return fiber_stack; -+ } -+ static loader_life_support *get_stack_top() { -+ return get_stack_tls_key().get(); -+ } -+ static void set_stack_top(loader_life_support *value) { -+ get_stack_tls_key().reset(value); -+ } -+ -+#elif defined(WITH_THREAD) - // Store stack pointer in thread-local storage. - static PYBIND11_TLS_KEY_REF get_stack_tls_key() { - # if PYBIND11_INTERNALS_VERSION == 4 diff --git a/cmake/deps/patches/ucx.patch b/cmake/deps/patches/ucx.patch deleted file mode 100644 index 2b7449629..000000000 --- a/cmake/deps/patches/ucx.patch +++ /dev/null @@ -1,35 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022,NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -diff --git a/Makefile.am b/Makefile.am -index 073ead3..85f9d01 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -41,15 +41,6 @@ if HAVE_UCG - SUBDIRS += $(UCG_SUBDIR) - endif - --SUBDIRS += \ -- src/tools/vfs \ -- src/tools/info \ -- src/tools/perf \ -- src/tools/profile \ -- bindings/java \ -- test/apps \ -- examples -- - if HAVE_GTEST - SUBDIRS += test/gtest - endif diff --git a/cmake/deps/templates/pkgconfig_package.cmake.in b/cmake/deps/templates/pkgconfig_package.cmake.in deleted file mode 100644 index a3d2991d3..000000000 --- a/cmake/deps/templates/pkgconfig_package.cmake.in +++ /dev/null @@ -1,13 +0,0 @@ -#============================================================================= -# pkg-config Search for @name@ -# -find_package(PkgConfig) - -pkg_check_modules(@name@ IMPORTED_TARGET GLOBAL @name@) - -if(@name@_FOUND) - # Add an alias to the imported target - add_library(@name@::@name@ ALIAS PkgConfig::@name@) -endif() - -#============================================================================= diff --git a/cmake/vcpkg_triplets/x64-linux-dynamic.cmake b/cmake/environment/init_ccache.cmake similarity index 69% rename from cmake/vcpkg_triplets/x64-linux-dynamic.cmake rename to cmake/environment/init_ccache.cmake index b2a029000..2e84c6476 100644 --- a/cmake/vcpkg_triplets/x64-linux-dynamic.cmake +++ b/cmake/environment/init_ccache.cmake @@ -13,11 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(VCPKG_TARGET_ARCHITECTURE x64) -set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE dynamic) +include_guard(GLOBAL) -set(VCPKG_CMAKE_SYSTEM_NAME Linux) +list(APPEND CMAKE_MESSAGE_CONTEXT "cache") -# Set the RPATH to allow finding other libraries in the same folder -set(VCPKG_LINKER_FLAGS "-Wl,-rpath,'$ORIGIN':'$ORIGIN/../lib'") +morpheus_utils_check_cache_path(MRC_CACHE_DIR) + +# Configure CCache if requested +if(MRC_USE_CCACHE) + morpheus_utils_initialize_ccache(MRC_CACHE_DIR) +endif() + +morpheus_utils_initialize_cpm(MRC_CACHE_DIR) + +list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/cmake/setup_coverage.cmake b/cmake/environment/init_coverage.cmake similarity index 95% rename from cmake/setup_coverage.cmake rename to cmake/environment/init_coverage.cmake index 3e3d44260..8edb1fac7 100644 --- a/cmake/setup_coverage.cmake +++ b/cmake/environment/init_coverage.cmake @@ -1,5 +1,5 @@ # ============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,9 +22,9 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "coverage") # Include coverage tools if enabled if(MRC_ENABLE_CODECOV) - include(cmake/deps/Configure_gcov.cmake) - message(STATUS "MRC_ENABLE_CODECOV is ON, configuring report exclusions and setting up coverage build targets") + morpheus_utils_initialize_code_coverage() + set(CODECOV_REPORT_EXCLUSIONS "${CMAKE_BINARY_DIR}/protos/*" # Remove this if/when we get protobuf code unit tested. ".cache/*" diff --git a/cmake/run_iwyu.sh.in b/cmake/environment/init_iwyu.cmake old mode 100755 new mode 100644 similarity index 57% rename from cmake/run_iwyu.sh.in rename to cmake/environment/init_iwyu.cmake index 0c7762bc4..d5faebec6 --- a/cmake/run_iwyu.sh.in +++ b/cmake/environment/init_iwyu.cmake @@ -1,5 +1,5 @@ -#!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# ============================================================================= +# SPDX-FileCopyrightText: Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +13,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# ============================================================================= -# Allows running ccache with options inside of CMake. CMake does not work well -# with setting variables before calling a command -${MRC_IWYU_PROGRAM} ${MRC_IWYU_OPTIONS} "$@" +if(MRC_USE_IWYU) + morpheus_utils_initialize_iwyu( + MRC_USE_IWYU + MRC_IWYU_VERBOSITY + MRC_IWYU_PROGRAM + MRC_IWYU_OPTIONS + ) +endif(MRC_USE_IWYU) diff --git a/cmake/import_rapids_cmake.cmake b/cmake/import_rapids_cmake.cmake deleted file mode 100644 index f6a5b8ed8..000000000 --- a/cmake/import_rapids_cmake.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Ensure this is only run once -include_guard(GLOBAL) - -set(RAPIDS_CMAKE_VERSION "${MRC_RAPIDS_VERSION}" CACHE STRING "Version of rapids-cmake to use") - -# Download and load the repo according to the rapids-cmake instructions if it does not exist -if(NOT EXISTS ${CMAKE_BINARY_DIR}/RAPIDS_CMAKE.cmake) - message(STATUS "Downloading RAPIDS CMake Version: ${RAPIDS_CMAKE_VERSION}") - file( - DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_CMAKE_VERSION}/RAPIDS.cmake - ${CMAKE_BINARY_DIR}/RAPIDS_CMAKE.cmake - ) -endif() - -# Now load the file -include(${CMAKE_BINARY_DIR}/RAPIDS_CMAKE.cmake) - -# Load Rapids Cmake packages -include(rapids-cmake) -include(rapids-cpm) -include(rapids-cuda) -include(rapids-export) -include(rapids-find) diff --git a/cmake/python_module_tools.cmake b/cmake/python_module_tools.cmake deleted file mode 100644 index 8f20aee5e..000000000 --- a/cmake/python_module_tools.cmake +++ /dev/null @@ -1,629 +0,0 @@ -# ============================================================================= -# Copyright (c) 2020-2022, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except -# in compliance with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License -# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -# or implied. See the License for the specific language governing permissions and limitations under -# the License. -# ============================================================================= - -## TODO: these need to be extracted to a cmake utilities repo - -# Ensure we only include this once -include_guard(DIRECTORY) - -# Get the project name in uppercase if OPTION_PREFIX is not defined -if(NOT DEFINED OPTION_PREFIX) - string(TOUPPER "${PROJECT_NAME}" OPTION_PREFIX) -endif() - -option(${OPTION_PREFIX}_PYTHON_INPLACE_BUILD "Whether or not to copy built python modules back to the source tree for debug purposes." OFF) -option(${OPTION_PREFIX}_PYTHON_PERFORM_INSTALL "Whether or not to automatically `pip install` any built python library. WARNING: This may overwrite any existing installation of the same name." OFF) -option(${OPTION_PREFIX}_PYTHON_BUILD_STUBS "Whether or not to generated .pyi stub files for C++ Python modules. Disable to avoid requiring loading the NVIDIA GPU Driver during build" ON) - -set(Python3_FIND_VIRTUALENV "FIRST") -set(Python3_FIND_STRATEGY "LOCATION") - -message(VERBOSE "Python3_EXECUTABLE (before find_package): ${Python3_EXECUTABLE}") -message(VERBOSE "Python3_ROOT_DIR (before find_package): ${Python3_ROOT_DIR}") -message(VERBOSE "FIND_PYTHON_STRATEGY (before find_package): ${FIND_PYTHON_STRATEGY}") - -find_package(Python3 REQUIRED COMPONENTS Development Interpreter) - -message(VERBOSE "Python3_FOUND: " ${Python3_FOUND}) -message(VERBOSE "Python3_EXECUTABLE: ${Python3_EXECUTABLE}") -message(VERBOSE "Python3_INTERPRETER_ID: " ${Python3_INTERPRETER_ID}) -message(VERBOSE "Python3_STDLIB: " ${Python3_STDLIB}) -message(VERBOSE "Python3_STDARCH: " ${Python3_STDARCH}) -message(VERBOSE "Python3_SITELIB: " ${Python3_SITELIB}) -message(VERBOSE "Python3_SITEARCH: " ${Python3_SITEARCH}) -message(VERBOSE "Python3_SOABI: " ${Python3_SOABI}) -message(VERBOSE "Python3_INCLUDE_DIRS: " ${Python3_INCLUDE_DIRS}) -message(VERBOSE "Python3_LIBRARIES: " ${Python3_LIBRARIES}) -message(VERBOSE "Python3_LIBRARY_DIRS: " ${Python3_LIBRARY_DIRS}) -message(VERBOSE "Python3_VERSION: " ${Python3_VERSION}) -message(VERBOSE "Python3_NumPy_FOUND: " ${Python3_NumPy_FOUND}) -message(VERBOSE "Python3_NumPy_INCLUDE_DIRS: " ${Python3_NumPy_INCLUDE_DIRS}) -message(VERBOSE "Python3_NumPy_VERSION: " ${Python3_NumPy_VERSION}) - -# After finding python, now find pybind11 - -# pybind11 -# ========= -set(PYBIND11_VERSION "2.8.1" CACHE STRING "Version of Pybind11 to use") -include(deps/Configure_pybind11) - -if (NOT EXISTS ${Python3_SITELIB}/skbuild) - # In case this is messed up by `/usr/local/python/site-packages` vs `/usr/python/site-packages`, check pip itself. - execute_process( - COMMAND bash "-c" "${Python3_EXECUTABLE} -m pip show scikit-build | sed -n -e 's/Location: //p'" - OUTPUT_VARIABLE PYTHON_SITE_PACKAGES - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - if (NOT EXISTS ${PYTHON_SITE_PACKAGES}/skbuild) - message(SEND_ERROR "Scikit-build is not installed. CMake may not be able to find Cython. Install scikit-build with `pip install scikit-build`") - else() - list(APPEND CMAKE_MODULE_PATH "${PYTHON_SITE_PACKAGES}/skbuild/resources/cmake") - endif() -else () - list(APPEND CMAKE_MODULE_PATH "${Python3_SITELIB}/skbuild/resources/cmake") -endif () - -set(CYTHON_FLAGS "--directive binding=True,boundscheck=False,wraparound=False,embedsignature=True,always_allow_keywords=True" CACHE STRING "The directives for Cython compilation.") - -# Now we can find pybind11 -find_package(pybind11 REQUIRED) -find_package(Cython REQUIRED) - - -function(create_python_package PACKAGE_NAME) - - list(APPEND CMAKE_MESSAGE_CONTEXT "${PACKAGE_NAME}") - set(CMAKE_MESSAGE_CONTEXT ${CMAKE_MESSAGE_CONTEXT} PARENT_SCOPE) - - if(PYTHON_ACTIVE_PACKAGE_NAME) - message(FATAL_ERROR "An active wheel has already been created. Must call create_python_package/build_python_package in pairs") - endif() - - message(STATUS "Creating python package '${PACKAGE_NAME}'") - - # Set the active wheel in the parent scipe - set(PYTHON_ACTIVE_PACKAGE_NAME ${PACKAGE_NAME}-package) - - # Create a dummy source that holds all of the source files as resources - add_custom_target(${PYTHON_ACTIVE_PACKAGE_NAME}-sources ALL) - - # Make it depend on the sources - add_custom_target(${PYTHON_ACTIVE_PACKAGE_NAME}-modules ALL - DEPENDS ${PYTHON_ACTIVE_PACKAGE_NAME}-sources - ) - - # Outputs target depends on all sources, generated files, and modules - add_custom_target(${PYTHON_ACTIVE_PACKAGE_NAME}-outputs ALL - DEPENDS ${PYTHON_ACTIVE_PACKAGE_NAME}-modules - ) - - # Now setup some simple globbing for common files to move to the build directory - file(GLOB_RECURSE wheel_python_files - LIST_DIRECTORIES FALSE - CONFIGURE_DEPENDS - "*.py" - "py.typed" - "pyproject.toml" - "setup.cfg" - "MANIFEST.in" - ) - - add_python_sources(${wheel_python_files}) - - # Set the active wheel in the parent scope so it will appear in any subdirectories - set(PYTHON_ACTIVE_PACKAGE_NAME ${PYTHON_ACTIVE_PACKAGE_NAME} PARENT_SCOPE) - -endfunction() - -function(add_target_resources) - - set(flags "") - set(singleValues TARGET_NAME) - set(multiValues "") - - include(CMakeParseArguments) - cmake_parse_arguments(_ARGS - "${flags}" - "${singleValues}" - "${multiValues}" - ${ARGN} - ) - - # Get the current target resources - get_target_property(target_resources ${_ARGS_TARGET_NAME} RESOURCE) - - set(args_absolute_paths) - - foreach(resource ${_ARGS_UNPARSED_ARGUMENTS}) - - cmake_path(ABSOLUTE_PATH resource NORMALIZE OUTPUT_VARIABLE resource_absolute) - - list(APPEND args_absolute_paths "${resource_absolute}") - - endforeach() - - if(target_resources) - # Append the list of supplied resources - list(APPEND target_resources "${args_absolute_paths}") - else() - set(target_resources "${args_absolute_paths}") - endif() - - set_target_properties(${_ARGS_TARGET_NAME} PROPERTIES RESOURCE "${target_resources}") - -endfunction() - -function(add_python_sources) - - if(NOT PYTHON_ACTIVE_PACKAGE_NAME) - message(FATAL_ERROR "Must call create_python_wheel() before calling add_python_sources") - endif() - - # Append any arguments to the python_sources_target - add_target_resources(TARGET_NAME ${PYTHON_ACTIVE_PACKAGE_NAME}-sources ${ARGN}) - -endfunction() - -function(copy_target_resources TARGET_NAME COPY_DIRECTORY) - - # See if there are any resources associated with this target - get_target_property(target_resources ${TARGET_NAME} RESOURCE) - - if(target_resources) - - # Get the build and src locations - get_target_property(target_source_dir ${TARGET_NAME} SOURCE_DIR) - get_target_property(target_binary_dir ${TARGET_NAME} BINARY_DIR) - - set(resource_outputs "") - - # Create the copy command for each resource - foreach(resource ${target_resources}) - - # Get the absolute path of the resource in case its relative. - cmake_path(ABSOLUTE_PATH resource NORMALIZE) - - cmake_path(IS_PREFIX target_source_dir "${resource}" NORMALIZE is_source_relative) - cmake_path(IS_PREFIX target_binary_dir "${resource}" NORMALIZE is_binary_relative) - - # Get the relative path to the source or binary directories - if(is_binary_relative) - # This must come first because build is relative to source - cmake_path(RELATIVE_PATH resource BASE_DIRECTORY "${target_binary_dir}" OUTPUT_VARIABLE resource_relative) - elseif(is_source_relative) - cmake_path(RELATIVE_PATH resource BASE_DIRECTORY "${target_source_dir}" OUTPUT_VARIABLE resource_relative) - else() - message(SEND_ERROR "Target resource is not relative to the source or binary directory. Target: ${TARGET_NAME}, Resource: ${resource}") - endif() - - # Get the final copied location - cmake_path(APPEND COPY_DIRECTORY "${resource_relative}" OUTPUT_VARIABLE resource_output) - - message(VERBOSE "Copying ${resource} to ${resource_output}") - - # Pretty up the output message - set(top_level_source_dir ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}) - cmake_path(RELATIVE_PATH resource BASE_DIRECTORY "${top_level_source_dir}" OUTPUT_VARIABLE resource_source_relative) - cmake_path(RELATIVE_PATH resource_output BASE_DIRECTORY "${top_level_source_dir}" OUTPUT_VARIABLE resource_output_source_relative) - - add_custom_command( - OUTPUT ${resource_output} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${resource} ${resource_output} - DEPENDS ${resource} - COMMENT "Copying \${SOURCE_DIR}/${resource_source_relative} to \${SOURCE_DIR}/${resource_output_source_relative}" - ) - - list(APPEND resource_outputs ${resource_output}) - endforeach() - - # Final target to depend on the copied files - add_custom_target(${TARGET_NAME}-copy-resources ALL - DEPENDS ${resource_outputs} - ) - endif() - -endfunction() - -function(inplace_build_copy TARGET_NAME INPLACE_DIR) - message(VERBOSE "Inplace build: (${TARGET_NAME}) ${INPLACE_DIR}") - - add_custom_command( - TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${INPLACE_DIR} - COMMENT "Moving target ${TARGET_NAME} to ${INPLACE_DIR} for inplace build" - ) - - copy_target_resources(${TARGET_NAME} ${INPLACE_DIR}) - -endfunction() - -function(build_python_package PACKAGE_NAME) - - if(NOT PYTHON_ACTIVE_PACKAGE_NAME) - message(FATAL_ERROR "Must call create_python_package() before calling add_python_sources") - endif() - - if(NOT "${PACKAGE_NAME}-package" STREQUAL "${PYTHON_ACTIVE_PACKAGE_NAME}") - message(FATAL_ERROR "Mismatched package name supplied to create_python_package/build_python_package") - endif() - - set(flags BUILD_WHEEL INSTALL_WHEEL IS_INPLACE) - set(singleValues "") - set(multiValues PYTHON_DEPENDENCIES) - - include(CMakeParseArguments) - cmake_parse_arguments(_ARGS - "${flags}" - "${singleValues}" - "${multiValues}" - ${ARGN} - ) - - message(STATUS "Finalizing python package '${PACKAGE_NAME}'") - - get_target_property(sources_source_dir ${PYTHON_ACTIVE_PACKAGE_NAME}-sources SOURCE_DIR) - get_target_property(sources_binary_dir ${PYTHON_ACTIVE_PACKAGE_NAME}-sources BINARY_DIR) - - # First copy the source files - copy_target_resources(${PYTHON_ACTIVE_PACKAGE_NAME}-sources ${sources_binary_dir}) - - set(module_dependencies ${PYTHON_ACTIVE_PACKAGE_NAME}-sources-copy-resources) - - if(_ARGS_PYTHON_DEPENDENCIES) - list(APPEND module_dependencies ${_ARGS_PYTHON_DEPENDENCIES}) - endif() - - # Now ensure that the targets only get built after the files have been copied - add_dependencies(${PYTHON_ACTIVE_PACKAGE_NAME}-modules ${module_dependencies}) - - # Next step is to build the wheel file - if(_ARGS_BUILD_WHEEL) - set(wheel_stamp ${sources_binary_dir}/${PYTHON_ACTIVE_PACKAGE_NAME}-wheel.stamp) - - # The command to actually generate the wheel - add_custom_command( - OUTPUT ${wheel_stamp} - COMMAND python setup.py bdist_wheel - COMMAND ${CMAKE_COMMAND} -E touch ${wheel_stamp} - WORKING_DIRECTORY ${sources_binary_dir} - # Depend on any of the output python files - DEPENDS ${PYTHON_ACTIVE_PACKAGE_NAME}-outputs - COMMENT "Building ${PACKAGE_NAME} wheel" - ) - - # Create a dummy target to ensure the above custom command is always run - add_custom_target(${PYTHON_ACTIVE_PACKAGE_NAME}-wheel ALL - DEPENDS ${install_stamp} - ) - - message(STATUS "Creating python wheel for library '${PACKAGE_NAME}'") - endif() - - # Now build up the pip arguments to either install the package or print a message with the install command - set(_pip_command) - - list(APPEND _pip_command "${Python3_EXECUTABLE}" "-m" "pip" "install") - - # detect virtualenv and set Pip args accordingly - if(NOT DEFINED ENV{VIRTUAL_ENV} AND NOT DEFINED ENV{CONDA_PREFIX}) - list(APPEND _pip_command "--user") - endif() - - if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - list(APPEND _pip_command "-e") - endif() - - # Change which setup we use if we are using inplace - if(_ARGS_IS_INPLACE) - list(APPEND _pip_command "${sources_source_dir}") - else() - list(APPEND _pip_command "${sources_binary_dir}") - endif() - - if(_ARGS_INSTALL_WHEEL) - message(STATUS "Automatically installing Python package '${PACKAGE_NAME}' into current python environment. This may overwrite any existing library with the same name") - - # Now actually install the package - set(install_stamp ${sources_binary_dir}/${PYTHON_ACTIVE_PACKAGE_NAME}-install.stamp) - - add_custom_command( - OUTPUT ${install_stamp} - COMMAND ${_pip_command} - COMMAND ${CMAKE_COMMAND} -E touch ${install_stamp} - DEPENDS ${PYTHON_ACTIVE_PACKAGE_NAME}-outputs - COMMENT "Installing ${PACKAGE_NAME} python package" - ) - - add_custom_target(${PYTHON_ACTIVE_PACKAGE_NAME}-install ALL - DEPENDS ${install_stamp} - ) - else() - list(JOIN _pip_command " " _pip_command_str) - message(STATUS "Python package '${PACKAGE_NAME}' has been built but has not been installed. Use `${_pip_command_str}` to install the library manually") - endif() - - # Finally, unset the active package - unset(PYTHON_ACTIVE_PACKAGE_NAME PARENT_SCOPE) - - list(POP_BACK CMAKE_MESSAGE_CONTEXT) - set(CMAKE_MESSAGE_CONTEXT ${CMAKE_MESSAGE_CONTEXT} PARENT_SCOPE) - -endfunction() - - -#[=======================================================================[ -@brief : given a module name, and potentially a root path, resolves the -fully qualified python module path. If MODULE_ROOT is not provided, it -will default to ${CMAKE_CURRENT_SOURCE_DIR} -- the context of -the caller. - -ex. resolve_python_module_name(my_module MODULE_ROOT morpheus/_lib) -results -- - MODULE_TARGET_NAME: morpheus._lib.my_module - OUTPUT_MODULE_NAME: my_module - OUTPUT_RELATIVE_PATH: morpheus/_lib - -resolve_python_module_name - [MODULE_ROOT] - [OUTPUT_TARGET_NAME] - [OUTPUT_MODULE_NAME] - [OUTPUT_RELATIVE_PATH] -#]=======================================================================] - -function(resolve_python_module_name MODULE_NAME) - set(prefix _ARGS) # Prefix parsed args - set(flags "") - set(singleValues - MODULE_ROOT - OUTPUT_TARGET_NAME - OUTPUT_MODULE_NAME - OUTPUT_RELATIVE_PATH) - set(multiValues "") - - include(CMakeParseArguments) - cmake_parse_arguments(${prefix} - "${flags}" - "${singleValues}" - "${multiValues}" - ${ARGN}) - - set(py_module_name ${MODULE_NAME}) - set(py_module_namespace "") - set(py_module_path "") - - if(_ARGS_MODULE_ROOT) - file(RELATIVE_PATH py_module_path ${_ARGS_MODULE_ROOT} ${CMAKE_CURRENT_SOURCE_DIR}) - - if(NOT ${py_module_path} STREQUAL "") - # Convert the relative path to a namespace. i.e. `cuml/package/module` -> `cuml::package::module - # Always add a trailing / to ensure we end with a . - string(REPLACE "/" "." py_module_namespace "${py_module_path}/") - endif() - endif() - - if (_ARGS_OUTPUT_TARGET_NAME) - set(${_ARGS_OUTPUT_TARGET_NAME} "${py_module_namespace}${py_module_name}" PARENT_SCOPE) - endif() - if (_ARGS_OUTPUT_MODULE_NAME) - set(${_ARGS_OUTPUT_MODULE_NAME} "${py_module_name}" PARENT_SCOPE) - endif() - if (_ARGS_OUTPUT_RELATIVE_PATH) - set(${_ARGS_OUTPUT_RELATIVE_PATH} "${py_module_path}" PARENT_SCOPE) - endif() -endfunction() - -#[=======================================================================[ -@brief : TODO -ex. add_python_module -results -- - -add_python_module - -#]=======================================================================] -macro(_create_python_library MODULE_NAME) - - list(APPEND CMAKE_MESSAGE_CONTEXT "${MODULE_NAME}") - - if(NOT PYTHON_ACTIVE_PACKAGE_NAME) - message(FATAL_ERROR "Must call create_python_wheel() before calling add_python_sources") - endif() - - set(prefix _ARGS) - set(flags IS_PYBIND11 IS_CYTHON IS_MODULE COPY_INPLACE BUILD_STUBS) - set(singleValues INSTALL_DEST OUTPUT_TARGET MODULE_ROOT PYX_FILE) - set(multiValues INCLUDE_DIRS LINK_TARGETS SOURCE_FILES) - - include(CMakeParseArguments) - cmake_parse_arguments(${prefix} - "${flags}" - "${singleValues}" - "${multiValues}" - ${ARGN}) - - if(NOT _ARGS_MODULE_ROOT) - get_target_property(_ARGS_MODULE_ROOT ${PYTHON_ACTIVE_PACKAGE_NAME}-modules SOURCE_DIR) - endif() - - # Normalize the module root - cmake_path(SET _ARGS_MODULE_ROOT "${_ARGS_MODULE_ROOT}") - - resolve_python_module_name(${MODULE_NAME} - MODULE_ROOT ${_ARGS_MODULE_ROOT} - OUTPUT_TARGET_NAME TARGET_NAME - OUTPUT_MODULE_NAME MODULE_NAME - OUTPUT_RELATIVE_PATH SOURCE_RELATIVE_PATH - ) - - set(lib_type SHARED) - - if(_ARGS_IS_MODULE) - set(lib_type MODULE) - endif() - - # Create the module target - if(_ARGS_IS_PYBIND11) - message(VERBOSE "Adding Pybind11 Module: ${TARGET_NAME}") - pybind11_add_module(${TARGET_NAME} ${lib_type} ${_ARGS_SOURCE_FILES}) - elseif(_ARGS_IS_CYTHON) - message(VERBOSE "Adding Cython Module: ${TARGET_NAME}") - add_cython_target(${MODULE_NAME} "${_ARGS_PYX_FILE}" CXX PY3) - add_library(${TARGET_NAME} ${lib_type} ${${MODULE_NAME}} ${_ARGS_SOURCE_FILES}) - - # Need to set -fvisibility=hidden for cython according to https://pybind11.readthedocs.io/en/stable/faq.html - # set_target_properties(${TARGET_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) - else() - message(FATAL_ERROR "Must specify either IS_PYBIND11 or IS_CYTHON") - endif() - - set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "") - set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "${MODULE_NAME}") - - set(_link_libs "") - if(_ARGS_LINK_TARGETS) - foreach(target IN LISTS _ARGS_LINK_TARGETS) - list(APPEND _link_libs ${target}) - endforeach() - endif() - - target_link_libraries(${TARGET_NAME} - PUBLIC - ${_link_libs} - ) - - # Tell CMake to use relative paths in the build directory. This is necessary for relocatable packages - set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN") - - if(_ARGS_INCLUDE_DIRS) - target_include_directories(${TARGET_NAME} - PRIVATE - "${_ARGS_INCLUDE_DIRS}" - ) - endif() - - # Cython targets need the current dir for generated files - if(_ARGS_IS_CYTHON) - target_include_directories(${TARGET_NAME} - PUBLIC - "${CMAKE_CURRENT_BINARY_DIR}" - ) - endif() - - # Set all_python_targets to depend on this module. This ensures that all python targets have been built before any - # post build actions are taken. This is often necessary to allow post build actions that load the python modules to - # succeed - add_dependencies(${PYTHON_ACTIVE_PACKAGE_NAME}-modules ${TARGET_NAME}) - - if(_ARGS_BUILD_STUBS) - # Get the relative path from the project source to the module root - cmake_path(RELATIVE_PATH _ARGS_MODULE_ROOT BASE_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE module_root_relative) - - cmake_path(APPEND PROJECT_BINARY_DIR ${module_root_relative} OUTPUT_VARIABLE module_root_binary_dir) - cmake_path(APPEND module_root_binary_dir ${SOURCE_RELATIVE_PATH} ${MODULE_NAME} "__init__.pyi" OUTPUT_VARIABLE module_binary_stub_file) - - # Before installing, create the custom command to generate the stubs - add_custom_command( - OUTPUT ${module_binary_stub_file} - COMMAND ${Python3_EXECUTABLE} -m pybind11_stubgen ${TARGET_NAME} --no-setup-py --log-level WARN -o ./ --root-module-suffix \"\" - DEPENDS ${PYTHON_ACTIVE_PACKAGE_NAME}-modules - COMMENT "Building stub for python module ${TARGET_NAME}..." - WORKING_DIRECTORY ${module_root_binary_dir} - ) - - # Add a custom target to ensure the stub generation runs - add_custom_target(${TARGET_NAME}-stubs ALL - DEPENDS ${module_binary_stub_file} - ) - - # Make the outputs depend on the stub - add_dependencies(${PYTHON_ACTIVE_PACKAGE_NAME}-outputs ${TARGET_NAME}-stubs) - - # Save the output as a target property - add_target_resources(TARGET_NAME ${TARGET_NAME} "${module_binary_stub_file}") - endif() - - if(_ARGS_INSTALL_DEST) - message(VERBOSE "Install dest: (${TARGET_NAME}) ${_ARGS_INSTALL_DEST}") - install( - TARGETS - ${TARGET_NAME} - EXPORT - ${PROJECT_NAME}-exports - LIBRARY - DESTINATION - "${_ARGS_INSTALL_DEST}" - COMPONENT Wheel - RESOURCE - DESTINATION - "${_ARGS_INSTALL_DEST}/${MODULE_NAME}" - COMPONENT Wheel - ) - endif() - - # Set the output target - if(_ARGS_OUTPUT_TARGET) - set(${_ARGS_OUTPUT_TARGET} "${TARGET_NAME}" PARENT_SCOPE) - endif() - - if(_ARGS_COPY_INPLACE) - # Copy the target inplace - inplace_build_copy(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - list(POP_BACK CMAKE_MESSAGE_CONTEXT) - -endmacro() - -#[=======================================================================[ -@brief : TODO -ex. add_cython_library -results -- - -add_cython_library - -#]=======================================================================] -function(add_cython_library MODULE_NAME) - - _create_python_library(${MODULE_NAME} IS_CYTHON ${ARGN}) - -endfunction() - -#[=======================================================================[ -@brief : TODO -ex. add_pybind11_module -results -- - -add_pybind11_module - -#]=======================================================================] -function(add_pybind11_module MODULE_NAME) - - # Add IS_MODULE to make a MODULE instead of a SHARED - _create_python_library(${MODULE_NAME} IS_PYBIND11 IS_MODULE ${ARGN}) - -endfunction() - -#[=======================================================================[ -@brief : TODO -ex. add_pybind11_library -results -- - -add_pybind11_library - -#]=======================================================================] -function(add_pybind11_library MODULE_NAME) - - _create_python_library(${MODULE_NAME} IS_PYBIND11 ${ARGN}) - -endfunction() diff --git a/cmake/deps/rapids_cpm_package_overrides.json b/cmake/rapids_cpm_package_overrides.json similarity index 100% rename from cmake/deps/rapids_cpm_package_overrides.json rename to cmake/rapids_cpm_package_overrides.json diff --git a/cmake/run_ccache.sh.in b/cmake/run_ccache.sh.in deleted file mode 100755 index 8577075bc..000000000 --- a/cmake/run_ccache.sh.in +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Optionally, remove some arguments. For example, when using IWYU and ccache -# together, CMake passes `--driver-mode` which breaks gcc -ARGS_TO_REMOVE="@CCACHE_REMOVE_ARGS@" - -if [[ -n "$ARGS_TO_REMOVE" ]]; then - for arg in "$@"; do - shift - [[ "$arg" =~ $ARGS_TO_REMOVE ]] && continue - set -- "$@" "$arg" - done -fi - -# Set a default for CCACHE_BASEDIR. Allows overriding during build phase -export CCACHE_BASEDIR=${CCACHE_BASEDIR:-"@CCACHE_BASEDIR@"} -export CCACHE_CONFIGPATH=${CCACHE_CONFIGPATH:-"@CCACHE_CONFIGPATH@"} -export CCACHE_SLOPPINESS="system_headers" -export CCACHE_COMPILERTYPE="@CCACHE_COMPILERTYPE@" - -# Uncomment the following to enable debug logs -# export CCACHE_DEBUG=1 -# export CCACHE_DEBUGDIR="@CMAKE_CURRENT_BINARY_DIR@/ccache_debug" - -# Allows running ccache with options inside of CMake. CMake does not work well -# with setting variables before calling a command -@CCACHE_PROGRAM_PATH@ "$@" diff --git a/cmake/run_ccache_prefix.sh.in b/cmake/run_ccache_prefix.sh.in deleted file mode 100755 index f1c223502..000000000 --- a/cmake/run_ccache_prefix.sh.in +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# The first argument is treated as the prefix command to run -export CCACHE_PREFIX="$1" - -shift - -# Pass all remaining arguments to ccache -${MRC_CCACHE_WRAPPER} "$@" diff --git a/cmake/setup_cache.cmake b/cmake/setup_cache.cmake deleted file mode 100644 index d3c914a95..000000000 --- a/cmake/setup_cache.cmake +++ /dev/null @@ -1,144 +0,0 @@ -# ============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================= - -# ###################################################################################################################### -# * CMake properties ------------------------------------------------------------------------------ - -list(APPEND CMAKE_MESSAGE_CONTEXT "cache") - -function(configure_ccache cache_dir_name) - list(APPEND CMAKE_MESSAGE_CONTEXT "ccache") - - find_program(CCACHE_PROGRAM_PATH ccache DOC "Location of ccache executable") - - if(NOT CCACHE_PROGRAM_PATH) - message(WARNING "CCache option, ${cache_dir_name}, is enabled but ccache was not found. Check ccache installation.") - return() - endif() - - message(STATUS "Using ccache: ${CCACHE_PROGRAM_PATH}") - - set(LOCAL_MODULES_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - set(CCACHE_DIR "${${cache_dir_name}}/ccache") - - message(STATUS "Using ccache directory: ${CCACHE_DIR}") - - # Write or update the ccache configuration file - configure_file("${LOCAL_MODULES_PATH}/ccache.conf.in" "${CCACHE_DIR}/ccache.conf") - - # Set the ccache options we need - set(CCACHE_CONFIGPATH "${CCACHE_DIR}/ccache.conf") - - # Because CMake doesnt allow settings variables `CCACHE_COMPILERTYPE=gcc - # ccache` in CMAKE_C_COMPILER_LAUNCHER, we need to put everything into a - # single script and use that for CMAKE_C_COMPILER_LAUNCHER. Also, since - # gxx_linux-64 sets the compiler to c++ instead of g++, we need to set the - # value of CCACHE_COMPILERTYPE otherwise caching doesnt work correctly. So - # we need to make separate runners for each language with specific ccache - # settings for each - if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CCACHE_REMOVE_ARGS "^--driver-mode=.*") - endif() - - # Set the base dir for relative ccache - set(CCACHE_BASEDIR "${PROJECT_SOURCE_DIR}") - - # Configure ccache for C - if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") - set(CCACHE_COMPILERTYPE "gcc") - elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") - set(CCACHE_COMPILERTYPE "clang") - else() - set(CCACHE_COMPILERTYPE "auto") - endif() - - configure_file("${LOCAL_MODULES_PATH}/run_ccache.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/run_ccache_c.sh" @ONLY) - - # Configure ccache for CXX - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CCACHE_COMPILERTYPE "gcc") - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CCACHE_COMPILERTYPE "clang") - else() - set(CCACHE_COMPILERTYPE "auto") - endif() - - configure_file("${LOCAL_MODULES_PATH}/run_ccache.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/run_ccache_cxx.sh" @ONLY) - - # Configure ccache for CUDA - set(CCACHE_COMPILERTYPE "nvcc") - configure_file("${LOCAL_MODULES_PATH}/run_ccache.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/run_ccache_cuda.sh" @ONLY) - - # Finally, set the compiler option - set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/run_ccache_c.sh" PARENT_SCOPE) - set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/run_ccache_cxx.sh" PARENT_SCOPE) - set(CMAKE_CUDA_COMPILER_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/run_ccache_cuda.sh" PARENT_SCOPE) - - # PARENT_SCOPE here so others can use this value - set(CCACHE_DIR "${CCACHE_DIR}" PARENT_SCOPE) -endfunction() - -function(configure_cpm cache_dir_name) - list(APPEND CMAKE_MESSAGE_CONTEXT "cpm") - - # Set the CPM cache variable - set(ENV{CPM_SOURCE_CACHE} "${${cache_dir_name}}/cpm") - - message(STATUS "Using CPM source cache: $ENV{CPM_SOURCE_CACHE}") - - # # Set the FetchContent default download folder to be the same as CPM - # set(FETCHCONTENT_BASE_DIR "${${cache_dir_name}}/fetch" CACHE STRING "" FORCE) -endfunction() - -function(check_cache_path cache_dir_name) - # First, ensure that the current cache dir can be found by find_package/find_path/etc - if((NOT "${CMAKE_FIND_ROOT_PATH}" STREQUAL "") AND("${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE}" STREQUAL "ONLY")) - set(is_contained FALSE) - - # Now check if ${cache_dir_name} is under anything in CMAKE_FIND_ROOT_PATH - foreach(path_to_search ${CMAKE_FIND_ROOT_PATH}) - # Check if we are contained by the find path - cmake_path(IS_PREFIX path_to_search ${${cache_dir_name}} is_relative) - - if(is_relative) - set(is_contained TRUE) - break() - endif() - endforeach() - - if(NOT is_contained) - message(WARNING "The value for ${cache_dir_name} (${${cache_dir_name}}) is not contained in any CMAKE_FIND_ROOT_PATH (${CMAKE_FIND_ROOT_PATH}). " - "This will result in cmake being unable to find any downloaded packages. The cache path has been appended to the back " - "of CMAKE_FIND_ROOT_PATH") - - list(APPEND CMAKE_FIND_ROOT_PATH ${${cache_dir_name}}) - - set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} PARENT_SCOPE) - endif() - endif() -endfunction() - -check_cache_path(MRC_CACHE_DIR) - -# Configure CCache if requested -if(MRC_USE_CCACHE) - configure_ccache(MRC_CACHE_DIR) -endif() - -configure_cpm(MRC_CACHE_DIR) - -list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/cmake/setup_compiler.cmake b/cmake/setup_compiler.cmake deleted file mode 100644 index 3ea617d5f..000000000 --- a/cmake/setup_compiler.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# ============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================= - -# ###################################################################################################################### -# * CMake properties ------------------------------------------------------------------------------ - -list(APPEND CMAKE_MESSAGE_CONTEXT "compiler") - -include(CheckCCompilerFlag) -include(CheckCXXCompilerFlag) - -# ################################### -# - Compiler Flags ----------------- -check_c_compiler_flag("-O0" COMPILER_C_HAS_O0) - -if(COMPILER_C_HAS_O0) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0") -endif() - -check_cxx_compiler_flag("-O0" COMPILER_CXX_HAS_O0) - -if(COMPILER_CXX_HAS_O0) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") - - # Also set cuda here - set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -O0") -endif() - -# ################################### -# - Compiler Checks ---------------- - -# Only set the clang-tidy options for our source code targets -if(MRC_USE_CLANG_TIDY) - set(CMAKE_C_CLANG_TIDY "clang-tidy") - set(CMAKE_CXX_CLANG_TIDY "clang-tidy") - message(STATUS "Enabling clang-tidy for targets in project ${PROJECT_NAME}") -endif() - -list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/cmake/setup_iwyu.cmake b/cmake/setup_iwyu.cmake deleted file mode 100644 index 759446e3a..000000000 --- a/cmake/setup_iwyu.cmake +++ /dev/null @@ -1,60 +0,0 @@ -# ============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================= - -function(configure_iwyu) - list(APPEND CMAKE_MESSAGE_CONTEXT "iwyu") - - set(MRC_IWYU_VERBOSITY "1" CACHE STRING "Set verbosity level for include-what-you-use, 1 is default, 1 only shows recomendations and 11+ prints everything") - - find_program(MRC_IWYU_PROGRAM "include-what-you-use") - - if(MRC_IWYU_PROGRAM) - set(MRC_IWYU_OPTIONS - -Xiwyu; --mapping_file=${PROJECT_SOURCE_DIR}/ci/iwyu/mappings.imp; - -Xiwyu; --max_line_length=120; - -Xiwyu; --verbose=${MRC_IWYU_VERBOSITY}; - -Xiwyu; --quoted_includes_first; - -Xiwyu; --cxx17ns; - -Xiwyu --no_comments) - - # Convert these to space separated arguments - string(REPLACE ";" " " MRC_IWYU_OPTIONS "${MRC_IWYU_OPTIONS}") - - message(STATUS "Enabling include-what-you-use for MRC targets") - - set(IWYU_WRAPPER "${CMAKE_CURRENT_BINARY_DIR}/run_iwyu.sh") - - # Make a ccache runner file with the necessary settings. MRC_CCACHE_OPTIONS must be set! - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/run_iwyu.sh.in" "${IWYU_WRAPPER}") - - if(MRC_USE_CCACHE) - set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${CMAKE_CURRENT_BINARY_DIR}/run_ccache_prefix.sh;${IWYU_WRAPPER};${CMAKE_C_COMPILER}" PARENT_SCOPE) - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${CMAKE_CURRENT_BINARY_DIR}/run_ccache_prefix.sh;${IWYU_WRAPPER};${CMAKE_CXX_COMPILER}" PARENT_SCOPE) - else() - set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${IWYU_WRAPPER}" PARENT_SCOPE) - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU_WRAPPER}" PARENT_SCOPE) - endif() - - else() - message(WARNING "IWYU option MRC_USE_IWYU is enabled but the include-what-you-use was not found. Check iwyu installation and add the iwyu bin dir to your PATH variable.") - endif(MRC_IWYU_PROGRAM) -endfunction() - -# Configure IWYU if requested -if(MRC_USE_IWYU) - configure_iwyu() -endif(MRC_USE_IWYU) diff --git a/cmake/setup_package_manager.cmake b/cmake/setup_package_manager.cmake deleted file mode 100644 index 01ef4fdad..000000000 --- a/cmake/setup_package_manager.cmake +++ /dev/null @@ -1,101 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Determine if we should use Vcpkg or Conda for dependencies -if(MRC_USE_CONDA) - # Using conda path. Check for conda environment - if(NOT DEFINED ENV{CONDA_PREFIX}) - message(WARNING "Option 'MRC_USE_CONDA' is set to ON but no conda environment detected! Ensure you have called `conda activate` before configuring. Third party dependencies are likely to not be found.") - else() - message(STATUS "Conda environment detected at '$ENV{CONDA_PREFIX}'. Skipping Vcpkg") - endif() - - # # Strip any CUDA includes in the CXX_FLAGS and rely on find_package(CUDAToolkit). The conda package nvcc_linux-64 sets - # # this which causes compilation errors/warnings due to the order of includes being incorrect - # string(REPLACE "/" "\\/" match_cuda_home "-(I|isystem) *$ENV{CUDA_HOME}/include") - - # message(VERBOSE "match_cuda_home: ${match_cuda_home}") - - # if(CMAKE_C_FLAGS AND "${CMAKE_C_FLAGS}" MATCHES "${match_cuda_home}") - # string(REGEX REPLACE "${match_cuda_home}" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) - # message(VERBOSE "Removing CUDA path from $CMAKE_C_FLAGS") - # endif() - - # if(CMAKE_CXX_FLAGS AND "${CMAKE_CXX_FLAGS}" MATCHES "${match_cuda_home}") - # string(REGEX REPLACE "${match_cuda_home}" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - # message(VERBOSE "Removing CUDA path from $CMAKE_CXX_FLAGS") - # endif() - - # if(CMAKE_CUDA_FLAGS AND "${CMAKE_CUDA_FLAGS}" MATCHES "${match_cuda_home}") - # string(REGEX REPLACE "${match_cuda_home}" "" CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS}) - # message(VERBOSE "Removing CUDA path from $CMAKE_CUDA_FLAGS") - # endif() - - # Disable vcpkg toolchain option (in case the user has switched between the two) - unset(MRC_VCPKG_TOOLCHAIN CACHE) -else() - # Use Vcpkg if variable is set. Must be done before first call to project()! - # This will automatically install all dependencies in vcpkg.json - if(NOT DEFINED CACHE{MRC_VCPKG_TOOLCHAIN}) - # First run, set this to prevent entering this on a second run - set(MRC_VCPKG_TOOLCHAIN "" CACHE INTERNAL "Vcpkg Toolchain file to load at startup") - - # Check firs to see if Vcpkg is defined/configured - if(DEFINED ENV{VCPKG_ROOT}) - if(NOT EXISTS "$ENV{VCPKG_ROOT}") - message(FATAL_ERROR "Vcpkg env 'VCPKG_ROOT' set to '$ENV{VCPKG_ROOT}' but file does not exist! Exiting...") - return() - endif() - - # Set the toolchain file to run - set(MRC_VCPKG_TOOLCHAIN "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE INTERNAL "") - - # Default Vcpkg cache to - set(MRC_VCPKG_DEFAULT_BINARY_CACHE "${MRC_CACHE_DIR}/vcpkg" CACHE PATH "The location to use for storing Vcpkg binaries between builds. Defaults to environment variable \$VCPKG_DEFAULT_BINARY_CACHE") - mark_as_advanced(MRC_VCPKG_DEFAULT_BINARY_CACHE) - - # If using shared libs (the default) use a custom triplet file to use dynamic linking - if(BUILD_SHARED_LIBS) - set(VCPKG_OVERLAY_TRIPLETS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/vcpkg_triplets") - set(VCPKG_TARGET_TRIPLET "x64-linux-dynamic") - endif() - else() - # No Vcpkg. Still continue, but show warning - message(WARNING "Option 'MRC_USE_CONDA' is set to OFF but no 'VCPKG_ROOT' environment set has been detected. When using Vcpkg, either the environment variable 'VCPKG_ROOT' should be set, or 'CMAKE_TOOLCHAIN_FILE' should be specified. Third party dependencies are likely to not be found.") - endif() - endif() - - # Check if we have a toolchain file to apply - if(EXISTS "${MRC_VCPKG_TOOLCHAIN}") - # Make sure we keep any value set by the user environment - if(DEFINED ENV{VCPKG_DEFAULT_BINARY_CACHE}) - set(MRC_VCPKG_DEFAULT_BINARY_CACHE "$ENV{VCPKG_DEFAULT_BINARY_CACHE}" CACHE INTERNAL "The location to use for storing Vcpkg binaries between builds") - endif() - - # Now set the environment variable before loading the vcpkg stuff - set(ENV{VCPKG_DEFAULT_BINARY_CACHE} "${MRC_VCPKG_DEFAULT_BINARY_CACHE}") - - # Ensure the cache exists - if(DEFINED ENV{VCPKG_DEFAULT_BINARY_CACHE} AND NOT EXISTS "$ENV{VCPKG_DEFAULT_BINARY_CACHE}") - message(STATUS "Vcpkg binary cache missing. Creating directory. Cache location: $ENV{VCPKG_DEFAULT_BINARY_CACHE}") - file(MAKE_DIRECTORY "$ENV{VCPKG_DEFAULT_BINARY_CACHE}") - else() - message(STATUS "Vcpkg binary cache found. Cache location: $ENV{VCPKG_DEFAULT_BINARY_CACHE}") - endif() - - # Load the toolchain - include("${MRC_VCPKG_TOOLCHAIN}") - endif() -endif() diff --git a/cpp/mrc/CMakeLists.txt b/cpp/mrc/CMakeLists.txt index 2e140e191..8593778ca 100644 --- a/cpp/mrc/CMakeLists.txt +++ b/cpp/mrc/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -208,7 +208,8 @@ target_compile_features(libmrc PUBLIC cxx_std_20) set_target_properties(libmrc PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) # Finally, set the install RPATH to include the stubs folder for CUDA::nvml. If thats made private, this can be removed -set_target_properties(libmrc PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN:${CMAKE_INSTALL_PREFIX}/lib/stubs") +set_target_properties(libmrc PROPERTIES INSTALL_RPATH + "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN:${CMAKE_INSTALL_PREFIX}/lib/stubs") # ################################################################################################## # - install targets -------------------------------------------------------------------------------- @@ -277,3 +278,4 @@ rapids_export(BUILD ${PROJECT_NAME} DOCUMENTATION doc_string FINAL_CODE_BLOCK code_string ) + diff --git a/cpp/mrc/include/mrc/runnable/types.hpp b/cpp/mrc/include/mrc/runnable/types.hpp index 483380480..ba672501e 100644 --- a/cpp/mrc/include/mrc/runnable/types.hpp +++ b/cpp/mrc/include/mrc/runnable/types.hpp @@ -1,5 +1,5 @@ /** - * SPDX-FileCopyrightText: Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,7 +37,7 @@ std::string engine_type_string(const EngineType& engine_type); */ inline std::string default_engine_factory_name() { - return std::string("default"); + return {"default"}; } } // namespace mrc::runnable diff --git a/cpp/mrc/include/mrc/utils/type_utils.hpp b/cpp/mrc/include/mrc/utils/type_utils.hpp index 69c4b7bf3..1d2c93868 100644 --- a/cpp/mrc/include/mrc/utils/type_utils.hpp +++ b/cpp/mrc/include/mrc/utils/type_utils.hpp @@ -1,5 +1,5 @@ /** - * SPDX-FileCopyrightText: Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -108,47 +108,47 @@ struct DataType { if constexpr (std::is_integral_v && std::is_signed_v && size_in_bits() == 8) { - return DataType(TypeId::INT8); + return {TypeId::INT8}; } else if constexpr (std::is_integral_v && std::is_signed_v && size_in_bits() == 16) { - return DataType(TypeId::INT16); + return {TypeId::INT16}; } else if constexpr (std::is_integral_v && std::is_signed_v && size_in_bits() == 32) { - return DataType(TypeId::INT32); + return {TypeId::INT32}; } else if constexpr (std::is_integral_v && std::is_signed_v && size_in_bits() == 64) { - return DataType(TypeId::INT64); + return {TypeId::INT64}; } else if constexpr (std::is_integral_v && std::is_unsigned_v && size_in_bits() == 8) { - return DataType(TypeId::UINT8); + return {TypeId::UINT8}; } else if constexpr (std::is_integral_v && std::is_unsigned_v && size_in_bits() == 16) { - return DataType(TypeId::UINT16); + return {TypeId::UINT16}; } else if constexpr (std::is_integral_v && std::is_unsigned_v && size_in_bits() == 32) { - return DataType(TypeId::UINT32); + return {TypeId::UINT32}; } else if constexpr (std::is_integral_v && std::is_unsigned_v && size_in_bits() == 64) { - return DataType(TypeId::UINT64); + return {TypeId::UINT64}; } else if constexpr (std::is_floating_point_v && size_in_bits() == 32) { - return DataType(TypeId::FLOAT32); + return {TypeId::FLOAT32}; } else if constexpr (std::is_floating_point_v && size_in_bits() == 64) { - return DataType(TypeId::FLOAT64); + return {TypeId::FLOAT64}; } else if constexpr (std::is_same_v) { - return DataType(TypeId::BOOL8); + return {TypeId::BOOL8}; } else { @@ -156,7 +156,7 @@ struct DataType } // To hide compiler warnings - return DataType(TypeId::EMPTY); + return {TypeId::EMPTY}; } // From numpy diff --git a/cpp/mrc/src/public/utils/type_utils.cpp b/cpp/mrc/src/public/utils/type_utils.cpp index 457331595..71d57f394 100644 --- a/cpp/mrc/src/public/utils/type_utils.cpp +++ b/cpp/mrc/src/public/utils/type_utils.cpp @@ -1,5 +1,5 @@ /** - * SPDX-FileCopyrightText: Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -127,7 +127,7 @@ DataType DataType::from_numpy(const std::string& numpy_str) CHECK(found_enum != found_type->second.end()) << "Type str '" << type_char << dtype_size << "' not supported"; - return DataType(found_enum->second); + return {found_enum->second}; } char DataType::type_char() const diff --git a/cpp/mrc/tests/modules/test_segment_modules.cpp b/cpp/mrc/tests/modules/test_segment_modules.cpp index 35039c9c4..d9a9bc902 100644 --- a/cpp/mrc/tests/modules/test_segment_modules.cpp +++ b/cpp/mrc/tests/modules/test_segment_modules.cpp @@ -406,13 +406,15 @@ TEST_F(TestSegmentModules, ModuleTemplateTest) } #if !defined(__clang__) && defined(__GNUC__) -// Work around for GCC : https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83258 + // Work around for GCC : https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83258 + #pragma GCC visibility push(default) auto F_1 = []() -> int { return 15; }; auto F_2 = []() -> std::string { return "test string"; }; + #pragma GCC visibility pop #endif TEST_F(TestSegmentModules, ModuleTemplateWithInitTest) diff --git a/docs/quickstart/CMakeLists.txt b/docs/quickstart/CMakeLists.txt index 89f193140..216955826 100644 --- a/docs/quickstart/CMakeLists.txt +++ b/docs/quickstart/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,7 @@ cmake_minimum_required(VERSION 3.24 FATAL_ERROR) list(PREPEND CMAKE_PREFIX_PATH "$ENV{CONDA_PREFIX}") list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake") -# Add the RAPIDS cmake helper scripts -include(import_rapids_cmake) +morpheus_utils_python_modules_ensure_python3() project(mrc-quickstart VERSION 23.01 @@ -34,7 +33,7 @@ rapids_cpm_init() # Set the option prefix to match the outer project before including. Must be before find_package(mrc) set(OPTION_PREFIX "MRC") -include(python_module_tools) +include(morpheus_utils/python/register_api) rapids_find_package(mrc REQUIRED) rapids_find_package(CUDAToolkit REQUIRED) diff --git a/docs/quickstart/hybrid/CMakeLists.txt b/docs/quickstart/hybrid/CMakeLists.txt index 1da80a33f..c7a6eb862 100644 --- a/docs/quickstart/hybrid/CMakeLists.txt +++ b/docs/quickstart/hybrid/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,7 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "hybrid") set(QUICKSTART_HYBRID_HOME "${CMAKE_CURRENT_SOURCE_DIR}") -create_python_package(mrc_qs_hybrid) +morpheus_utils_create_python_package(mrc_qs_hybrid) add_subdirectory(mrc_qs_hybrid/common) @@ -34,6 +34,6 @@ if(TARGET mrc-package-install) list(APPEND extra_args "PYTHON_DEPENDENCIES" "mrc-package-install") endif() -build_python_package(mrc_qs_hybrid ${extra_args}) +morpheus_utils_build_python_package(mrc_qs_hybrid ${extra_args}) list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/docs/quickstart/hybrid/mrc_qs_hybrid/_version.py b/docs/quickstart/hybrid/mrc_qs_hybrid/_version.py index 30c03d776..60d48d0ef 100644 --- a/docs/quickstart/hybrid/mrc_qs_hybrid/_version.py +++ b/docs/quickstart/hybrid/mrc_qs_hybrid/_version.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,12 +24,13 @@ """Git implementation of _version.py.""" import errno +import functools import os import re import subprocess import sys -from typing import Callable, Dict -import functools +from typing import Callable +from typing import Dict def get_keywords(): diff --git a/docs/quickstart/hybrid/mrc_qs_hybrid/common/CMakeLists.txt b/docs/quickstart/hybrid/mrc_qs_hybrid/common/CMakeLists.txt index c65401258..a53462b00 100644 --- a/docs/quickstart/hybrid/mrc_qs_hybrid/common/CMakeLists.txt +++ b/docs/quickstart/hybrid/mrc_qs_hybrid/common/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,36 +13,36 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_pybind11_library( +morpheus_utils_add_pybind11_library( data # MODULE_ROOT # ${QUICKSTART_HYBRID_HOME} SOURCE_FILES - data.cpp + data.cpp LINK_TARGETS - mrc::pymrc + mrc::pymrc OUTPUT_TARGET - common_data_target + common_data_target ) target_include_directories(${common_data_target} PUBLIC - ./include + ./include ) -inplace_build_copy(${common_data_target} ${CMAKE_CURRENT_SOURCE_DIR}) +morpheus_utils_inplace_build_copy(${common_data_target} ${CMAKE_CURRENT_SOURCE_DIR}) -add_pybind11_library( +morpheus_utils_add_pybind11_library( nodes SOURCE_FILES - nodes.cpp + nodes.cpp LINK_TARGETS - ${common_data_target} + ${common_data_target} OUTPUT_TARGET - nodes_data_target + nodes_data_target ) -inplace_build_copy(${nodes_data_target} ${CMAKE_CURRENT_SOURCE_DIR}) +morpheus_utils_inplace_build_copy(${nodes_data_target} ${CMAKE_CURRENT_SOURCE_DIR}) # Set this variable in the parent scope so other examples can link to it set(common_data_target ${common_data_target} PARENT_SCOPE) diff --git a/docs/quickstart/hybrid/mrc_qs_hybrid/ex00_wrap_data_objects/CMakeLists.txt b/docs/quickstart/hybrid/mrc_qs_hybrid/ex00_wrap_data_objects/CMakeLists.txt index 18723f68c..7cd4e0ce8 100644 --- a/docs/quickstart/hybrid/mrc_qs_hybrid/ex00_wrap_data_objects/CMakeLists.txt +++ b/docs/quickstart/hybrid/mrc_qs_hybrid/ex00_wrap_data_objects/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_pybind11_module( +morpheus_utils_add_pybind11_module( data MODULE_ROOT ${QUICKSTART_HYBRID_HOME} @@ -25,4 +25,4 @@ add_pybind11_module( data_target ) -inplace_build_copy(${data_target} ${CMAKE_CURRENT_SOURCE_DIR}) +morpheus_utils_inplace_build_copy(${data_target} ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/docs/quickstart/hybrid/mrc_qs_hybrid/ex01_wrap_nodes/CMakeLists.txt b/docs/quickstart/hybrid/mrc_qs_hybrid/ex01_wrap_nodes/CMakeLists.txt index 9a1633f0a..6b3b429a2 100644 --- a/docs/quickstart/hybrid/mrc_qs_hybrid/ex01_wrap_nodes/CMakeLists.txt +++ b/docs/quickstart/hybrid/mrc_qs_hybrid/ex01_wrap_nodes/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_pybind11_module( +morpheus_utils_add_pybind11_module( nodes MODULE_ROOT ${QUICKSTART_HYBRID_HOME} @@ -25,4 +25,4 @@ add_pybind11_module( nodes_target ) -inplace_build_copy(${nodes_target} ${CMAKE_CURRENT_SOURCE_DIR}) +morpheus_utils_inplace_build_copy(${nodes_target} ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/docs/quickstart/hybrid/versioneer.py b/docs/quickstart/hybrid/versioneer.py index a142bf53e..5e21cd07d 100644 --- a/docs/quickstart/hybrid/versioneer.py +++ b/docs/quickstart/hybrid/versioneer.py @@ -1,6 +1,4 @@ - # Version: 0.22 - """The Versioneer - like a rocketeer, but for versions. The Versioneer @@ -282,13 +280,14 @@ import configparser import errno +import functools import json import os import re import subprocess import sys -from typing import Callable, Dict -import functools +from typing import Callable +from typing import Dict class VersioneerConfig: @@ -327,8 +326,7 @@ def get_root(): me_dir = os.path.normcase(os.path.splitext(my_path)[0]) vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0]) if me_dir != vsr_dir: - print("Warning: build in %s is using versioneer.py from %s" - % (os.path.dirname(my_path), versioneer_py)) + print("Warning: build in %s is using versioneer.py from %s" % (os.path.dirname(my_path), versioneer_py)) except NameError: pass return root @@ -373,15 +371,16 @@ class NotThisMethod(Exception): def register_vcs_handler(vcs, method): # decorator """Create decorator to mark a method as the handler of a VCS.""" + def decorate(f): """Store f in HANDLERS[vcs][method].""" HANDLERS.setdefault(vcs, {})[method] = f return f + return decorate -def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, - env=None): +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None): """Call the given command(s).""" assert isinstance(commands, list) process = None @@ -397,10 +396,12 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, try: dispcmd = str([command] + args) # remember shell=False, so use git.cmd on windows, not just git - process = subprocess.Popen([command] + args, cwd=cwd, env=env, + process = subprocess.Popen([command] + args, + cwd=cwd, + env=env, stdout=subprocess.PIPE, - stderr=(subprocess.PIPE if hide_stderr - else None), **popen_kwargs) + stderr=(subprocess.PIPE if hide_stderr else None), + **popen_kwargs) break except OSError: e = sys.exc_info()[1] @@ -412,7 +413,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, return None, None else: if verbose: - print("unable to find command, tried %s" % (commands,)) + print("unable to find command, tried %s" % (commands, )) return None, None stdout = process.communicate()[0].strip().decode() if process.returncode != 0: @@ -1164,16 +1165,19 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): continue if verbose: print("picking %s" % r) - return {"version": r, - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": None, - "date": date} + return { + "version": r, "full-revisionid": keywords["full"].strip(), "dirty": False, "error": None, "date": date + } # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: print("no suitable tags, using unknown + full revision id") - return {"version": "0+unknown", - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": "no suitable tags", "date": None} + return { + "version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, + "error": "no suitable tags", + "date": None + } @register_vcs_handler("git", "pieces_from_vcs") @@ -1195,8 +1199,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): env.pop("GIT_DIR", None) runner = functools.partial(runner, env=env) - _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, - hide_stderr=True) + _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True) if rc != 0: if verbose: print("Directory %s not under git control" % root) @@ -1206,9 +1209,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty", - "--always", "--long", *MATCH_ARGS], - cwd=root) + describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty", "--always", "--long", *MATCH_ARGS], cwd=root) # --long was added in git-1.5.5 if describe_out is None: raise NotThisMethod("'git describe' failed") @@ -1223,8 +1224,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): pieces["short"] = full_out[:7] # maybe improved later pieces["error"] = None - branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], - cwd=root) + branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], cwd=root) # --abbrev-ref was added in git-1.6.3 if rc != 0 or branch_name is None: raise NotThisMethod("'git rev-parse --abbrev-ref' returned error") @@ -1273,8 +1273,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: # unparsable. Maybe git-describe is misbehaving? - pieces["error"] = ("unable to parse git-describe output: '%s'" - % describe_out) + pieces["error"] = ("unable to parse git-describe output: '%s'" % describe_out) return pieces # tag @@ -1283,8 +1282,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): if verbose: fmt = "tag '%s' doesn't start with prefix '%s'" print(fmt % (full_tag, tag_prefix)) - pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" - % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" % (full_tag, tag_prefix)) return pieces pieces["closest-tag"] = full_tag[len(tag_prefix):] @@ -1359,15 +1357,18 @@ def versions_from_parentdir(parentdir_prefix, root, verbose): for _ in range(3): dirname = os.path.basename(root) if dirname.startswith(parentdir_prefix): - return {"version": dirname[len(parentdir_prefix):], - "full-revisionid": None, - "dirty": False, "error": None, "date": None} + return { + "version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, + "error": None, + "date": None + } rootdirs.append(root) root = os.path.dirname(root) # up a level if verbose: - print("Tried directories %s but none started with prefix %s" % - (str(rootdirs), parentdir_prefix)) + print("Tried directories %s but none started with prefix %s" % (str(rootdirs), parentdir_prefix)) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") @@ -1396,11 +1397,9 @@ def versions_from_file(filename): contents = f.read() except OSError: raise NotThisMethod("unable to read _version.py") - mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", - contents, re.M | re.S) + mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: - mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", - contents, re.M | re.S) + mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: raise NotThisMethod("no version_json in _version.py") return json.loads(mo.group(1)) @@ -1409,8 +1408,7 @@ def versions_from_file(filename): def write_to_version_file(filename, versions): """Write the given version number to the given _version.py file.""" os.unlink(filename) - contents = json.dumps(versions, sort_keys=True, - indent=1, separators=(",", ": ")) + contents = json.dumps(versions, sort_keys=True, indent=1, separators=(",", ": ")) with open(filename, "w") as f: f.write(SHORT_VERSION_PY % contents) @@ -1442,8 +1440,7 @@ def render_pep440(pieces): rendered += ".dirty" else: # exception #1 - rendered = "0+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) + rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered @@ -1472,8 +1469,7 @@ def render_pep440_branch(pieces): rendered = "0" if pieces["branch"] != "master": rendered += ".dev0" - rendered += "+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) + rendered += "+untagged.%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered @@ -1501,7 +1497,7 @@ def render_pep440_pre(pieces): tag_version, post_version = pep440_split_post(pieces["closest-tag"]) rendered = tag_version if post_version is not None: - rendered += ".post%d.dev%d" % (post_version+1, pieces["distance"]) + rendered += ".post%d.dev%d" % (post_version + 1, pieces["distance"]) else: rendered += ".post0.dev%d" % (pieces["distance"]) else: @@ -1634,11 +1630,13 @@ def render_git_describe_long(pieces): def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: - return {"version": "unknown", - "full-revisionid": pieces.get("long"), - "dirty": None, - "error": pieces["error"], - "date": None} + return { + "version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None + } if not style or style == "default": style = "pep440" # the default @@ -1662,9 +1660,13 @@ def render(pieces, style): else: raise ValueError("unknown style '%s'" % style) - return {"version": rendered, "full-revisionid": pieces["long"], - "dirty": pieces["dirty"], "error": None, - "date": pieces.get("date")} + return { + "version": rendered, + "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], + "error": None, + "date": pieces.get("date") + } class VersioneerBadRootError(Exception): @@ -1742,9 +1744,13 @@ def get_versions(verbose=False): if verbose: print("unable to compute version") - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, "error": "unable to compute version", - "date": None} + return { + "version": "0+unknown", + "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", + "date": None + } def get_version(): @@ -1800,6 +1806,7 @@ def run(self): print(" date: %s" % vers.get("date")) if vers["error"]: print(" error: %s" % vers["error"]) + cmds["version"] = cmd_version # we override "build_py" in both distutils and setuptools @@ -1826,6 +1833,7 @@ def run(self): from distutils.command.build_py import build_py as _build_py class cmd_build_py(_build_py): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1834,10 +1842,10 @@ def run(self): # now locate _version.py in the new build/ directory and replace # it with an updated value if cfg.versionfile_build: - target_versionfile = os.path.join(self.build_lib, - cfg.versionfile_build) + target_versionfile = os.path.join(self.build_lib, cfg.versionfile_build) print("UPDATING %s" % target_versionfile) write_to_version_file(target_versionfile, versions) + cmds["build_py"] = cmd_build_py if 'build_ext' in cmds: @@ -1848,6 +1856,7 @@ def run(self): from distutils.command.build_ext import build_ext as _build_ext class cmd_build_ext(_build_ext): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1861,14 +1870,15 @@ def run(self): return # now locate _version.py in the new build/ directory and replace # it with an updated value - target_versionfile = os.path.join(self.build_lib, - cfg.versionfile_build) + target_versionfile = os.path.join(self.build_lib, cfg.versionfile_build) print("UPDATING %s" % target_versionfile) write_to_version_file(target_versionfile, versions) + cmds["build_ext"] = cmd_build_ext if "cx_Freeze" in sys.modules: # cx_freeze enabled? from cx_Freeze.dist import build_exe as _build_exe + # nczeczulin reports that py2exe won't like the pep440-style string # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. # setup(console=[{ @@ -1877,6 +1887,7 @@ def run(self): # ... class cmd_build_exe(_build_exe): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1889,13 +1900,15 @@ def run(self): os.unlink(target_versionfile) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % - {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["build_exe"] = cmd_build_exe del cmds["build_py"] @@ -1903,6 +1916,7 @@ def run(self): from py2exe.distutils_buildexe import py2exe as _py2exe class cmd_py2exe(_py2exe): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1915,13 +1929,15 @@ def run(self): os.unlink(target_versionfile) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % - {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["py2exe"] = cmd_py2exe # we override different "sdist" commands for both environments @@ -1933,6 +1949,7 @@ def run(self): from distutils.command.sdist import sdist as _sdist class cmd_sdist(_sdist): + def run(self): versions = get_versions() self._versioneer_generated_versions = versions @@ -1950,8 +1967,8 @@ def make_release_tree(self, base_dir, files): # updated value target_versionfile = os.path.join(base_dir, cfg.versionfile_source) print("UPDATING %s" % target_versionfile) - write_to_version_file(target_versionfile, - self._versioneer_generated_versions) + write_to_version_file(target_versionfile, self._versioneer_generated_versions) + cmds["sdist"] = cmd_sdist return cmds @@ -2011,11 +2028,9 @@ def do_setup(): root = get_root() try: cfg = get_config_from_root(root) - except (OSError, configparser.NoSectionError, - configparser.NoOptionError) as e: + except (OSError, configparser.NoSectionError, configparser.NoOptionError) as e: if isinstance(e, (OSError, configparser.NoSectionError)): - print("Adding sample versioneer config to setup.cfg", - file=sys.stderr) + print("Adding sample versioneer config to setup.cfg", file=sys.stderr) with open(os.path.join(root, "setup.cfg"), "a") as f: f.write(SAMPLE_CONFIG) print(CONFIG_ERROR, file=sys.stderr) @@ -2024,15 +2039,16 @@ def do_setup(): print(" creating %s" % cfg.versionfile_source) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) - - ipy = os.path.join(os.path.dirname(cfg.versionfile_source), - "__init__.py") + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + + ipy = os.path.join(os.path.dirname(cfg.versionfile_source), "__init__.py") if os.path.exists(ipy): try: with open(ipy, "r") as f: @@ -2080,8 +2096,7 @@ def do_setup(): else: print(" 'versioneer.py' already in MANIFEST.in") if cfg.versionfile_source not in simple_includes: - print(" appending versionfile_source ('%s') to MANIFEST.in" % - cfg.versionfile_source) + print(" appending versionfile_source ('%s') to MANIFEST.in" % cfg.versionfile_source) with open(manifest_in, "a") as f: f.write("include %s\n" % cfg.versionfile_source) else: diff --git a/docs/quickstart/python/CMakeLists.txt b/docs/quickstart/python/CMakeLists.txt index b703cadb7..93751c001 100644 --- a/docs/quickstart/python/CMakeLists.txt +++ b/docs/quickstart/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,7 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "python") set(QUICKSTART_PYTHON_HOME "${CMAKE_CURRENT_SOURCE_DIR}") -create_python_package(mrc_qs_python) +morpheus_utils_create_python_package(mrc_qs_python) set(extra_args "IS_INPLACE") @@ -29,6 +29,6 @@ if(TARGET mrc-package-install) list(APPEND extra_args "PYTHON_DEPENDENCIES" "mrc-package-install") endif() -build_python_package(mrc_qs_python ${extra_args}) +morpheus_utils_build_python_package(mrc_qs_python ${extra_args}) list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/docs/quickstart/python/mrc_qs_python/_version.py b/docs/quickstart/python/mrc_qs_python/_version.py index 0698d467f..1ca6b055c 100644 --- a/docs/quickstart/python/mrc_qs_python/_version.py +++ b/docs/quickstart/python/mrc_qs_python/_version.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,12 +24,13 @@ """Git implementation of _version.py.""" import errno +import functools import os import re import subprocess import sys -from typing import Callable, Dict -import functools +from typing import Callable +from typing import Dict def get_keywords(): diff --git a/docs/quickstart/python/versioneer.py b/docs/quickstart/python/versioneer.py index a142bf53e..5e21cd07d 100644 --- a/docs/quickstart/python/versioneer.py +++ b/docs/quickstart/python/versioneer.py @@ -1,6 +1,4 @@ - # Version: 0.22 - """The Versioneer - like a rocketeer, but for versions. The Versioneer @@ -282,13 +280,14 @@ import configparser import errno +import functools import json import os import re import subprocess import sys -from typing import Callable, Dict -import functools +from typing import Callable +from typing import Dict class VersioneerConfig: @@ -327,8 +326,7 @@ def get_root(): me_dir = os.path.normcase(os.path.splitext(my_path)[0]) vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0]) if me_dir != vsr_dir: - print("Warning: build in %s is using versioneer.py from %s" - % (os.path.dirname(my_path), versioneer_py)) + print("Warning: build in %s is using versioneer.py from %s" % (os.path.dirname(my_path), versioneer_py)) except NameError: pass return root @@ -373,15 +371,16 @@ class NotThisMethod(Exception): def register_vcs_handler(vcs, method): # decorator """Create decorator to mark a method as the handler of a VCS.""" + def decorate(f): """Store f in HANDLERS[vcs][method].""" HANDLERS.setdefault(vcs, {})[method] = f return f + return decorate -def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, - env=None): +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None): """Call the given command(s).""" assert isinstance(commands, list) process = None @@ -397,10 +396,12 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, try: dispcmd = str([command] + args) # remember shell=False, so use git.cmd on windows, not just git - process = subprocess.Popen([command] + args, cwd=cwd, env=env, + process = subprocess.Popen([command] + args, + cwd=cwd, + env=env, stdout=subprocess.PIPE, - stderr=(subprocess.PIPE if hide_stderr - else None), **popen_kwargs) + stderr=(subprocess.PIPE if hide_stderr else None), + **popen_kwargs) break except OSError: e = sys.exc_info()[1] @@ -412,7 +413,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, return None, None else: if verbose: - print("unable to find command, tried %s" % (commands,)) + print("unable to find command, tried %s" % (commands, )) return None, None stdout = process.communicate()[0].strip().decode() if process.returncode != 0: @@ -1164,16 +1165,19 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): continue if verbose: print("picking %s" % r) - return {"version": r, - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": None, - "date": date} + return { + "version": r, "full-revisionid": keywords["full"].strip(), "dirty": False, "error": None, "date": date + } # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: print("no suitable tags, using unknown + full revision id") - return {"version": "0+unknown", - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": "no suitable tags", "date": None} + return { + "version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, + "error": "no suitable tags", + "date": None + } @register_vcs_handler("git", "pieces_from_vcs") @@ -1195,8 +1199,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): env.pop("GIT_DIR", None) runner = functools.partial(runner, env=env) - _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, - hide_stderr=True) + _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True) if rc != 0: if verbose: print("Directory %s not under git control" % root) @@ -1206,9 +1209,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty", - "--always", "--long", *MATCH_ARGS], - cwd=root) + describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty", "--always", "--long", *MATCH_ARGS], cwd=root) # --long was added in git-1.5.5 if describe_out is None: raise NotThisMethod("'git describe' failed") @@ -1223,8 +1224,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): pieces["short"] = full_out[:7] # maybe improved later pieces["error"] = None - branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], - cwd=root) + branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], cwd=root) # --abbrev-ref was added in git-1.6.3 if rc != 0 or branch_name is None: raise NotThisMethod("'git rev-parse --abbrev-ref' returned error") @@ -1273,8 +1273,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: # unparsable. Maybe git-describe is misbehaving? - pieces["error"] = ("unable to parse git-describe output: '%s'" - % describe_out) + pieces["error"] = ("unable to parse git-describe output: '%s'" % describe_out) return pieces # tag @@ -1283,8 +1282,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): if verbose: fmt = "tag '%s' doesn't start with prefix '%s'" print(fmt % (full_tag, tag_prefix)) - pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" - % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" % (full_tag, tag_prefix)) return pieces pieces["closest-tag"] = full_tag[len(tag_prefix):] @@ -1359,15 +1357,18 @@ def versions_from_parentdir(parentdir_prefix, root, verbose): for _ in range(3): dirname = os.path.basename(root) if dirname.startswith(parentdir_prefix): - return {"version": dirname[len(parentdir_prefix):], - "full-revisionid": None, - "dirty": False, "error": None, "date": None} + return { + "version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, + "error": None, + "date": None + } rootdirs.append(root) root = os.path.dirname(root) # up a level if verbose: - print("Tried directories %s but none started with prefix %s" % - (str(rootdirs), parentdir_prefix)) + print("Tried directories %s but none started with prefix %s" % (str(rootdirs), parentdir_prefix)) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") @@ -1396,11 +1397,9 @@ def versions_from_file(filename): contents = f.read() except OSError: raise NotThisMethod("unable to read _version.py") - mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", - contents, re.M | re.S) + mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: - mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", - contents, re.M | re.S) + mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: raise NotThisMethod("no version_json in _version.py") return json.loads(mo.group(1)) @@ -1409,8 +1408,7 @@ def versions_from_file(filename): def write_to_version_file(filename, versions): """Write the given version number to the given _version.py file.""" os.unlink(filename) - contents = json.dumps(versions, sort_keys=True, - indent=1, separators=(",", ": ")) + contents = json.dumps(versions, sort_keys=True, indent=1, separators=(",", ": ")) with open(filename, "w") as f: f.write(SHORT_VERSION_PY % contents) @@ -1442,8 +1440,7 @@ def render_pep440(pieces): rendered += ".dirty" else: # exception #1 - rendered = "0+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) + rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered @@ -1472,8 +1469,7 @@ def render_pep440_branch(pieces): rendered = "0" if pieces["branch"] != "master": rendered += ".dev0" - rendered += "+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) + rendered += "+untagged.%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered @@ -1501,7 +1497,7 @@ def render_pep440_pre(pieces): tag_version, post_version = pep440_split_post(pieces["closest-tag"]) rendered = tag_version if post_version is not None: - rendered += ".post%d.dev%d" % (post_version+1, pieces["distance"]) + rendered += ".post%d.dev%d" % (post_version + 1, pieces["distance"]) else: rendered += ".post0.dev%d" % (pieces["distance"]) else: @@ -1634,11 +1630,13 @@ def render_git_describe_long(pieces): def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: - return {"version": "unknown", - "full-revisionid": pieces.get("long"), - "dirty": None, - "error": pieces["error"], - "date": None} + return { + "version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None + } if not style or style == "default": style = "pep440" # the default @@ -1662,9 +1660,13 @@ def render(pieces, style): else: raise ValueError("unknown style '%s'" % style) - return {"version": rendered, "full-revisionid": pieces["long"], - "dirty": pieces["dirty"], "error": None, - "date": pieces.get("date")} + return { + "version": rendered, + "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], + "error": None, + "date": pieces.get("date") + } class VersioneerBadRootError(Exception): @@ -1742,9 +1744,13 @@ def get_versions(verbose=False): if verbose: print("unable to compute version") - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, "error": "unable to compute version", - "date": None} + return { + "version": "0+unknown", + "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", + "date": None + } def get_version(): @@ -1800,6 +1806,7 @@ def run(self): print(" date: %s" % vers.get("date")) if vers["error"]: print(" error: %s" % vers["error"]) + cmds["version"] = cmd_version # we override "build_py" in both distutils and setuptools @@ -1826,6 +1833,7 @@ def run(self): from distutils.command.build_py import build_py as _build_py class cmd_build_py(_build_py): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1834,10 +1842,10 @@ def run(self): # now locate _version.py in the new build/ directory and replace # it with an updated value if cfg.versionfile_build: - target_versionfile = os.path.join(self.build_lib, - cfg.versionfile_build) + target_versionfile = os.path.join(self.build_lib, cfg.versionfile_build) print("UPDATING %s" % target_versionfile) write_to_version_file(target_versionfile, versions) + cmds["build_py"] = cmd_build_py if 'build_ext' in cmds: @@ -1848,6 +1856,7 @@ def run(self): from distutils.command.build_ext import build_ext as _build_ext class cmd_build_ext(_build_ext): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1861,14 +1870,15 @@ def run(self): return # now locate _version.py in the new build/ directory and replace # it with an updated value - target_versionfile = os.path.join(self.build_lib, - cfg.versionfile_build) + target_versionfile = os.path.join(self.build_lib, cfg.versionfile_build) print("UPDATING %s" % target_versionfile) write_to_version_file(target_versionfile, versions) + cmds["build_ext"] = cmd_build_ext if "cx_Freeze" in sys.modules: # cx_freeze enabled? from cx_Freeze.dist import build_exe as _build_exe + # nczeczulin reports that py2exe won't like the pep440-style string # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. # setup(console=[{ @@ -1877,6 +1887,7 @@ def run(self): # ... class cmd_build_exe(_build_exe): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1889,13 +1900,15 @@ def run(self): os.unlink(target_versionfile) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % - {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["build_exe"] = cmd_build_exe del cmds["build_py"] @@ -1903,6 +1916,7 @@ def run(self): from py2exe.distutils_buildexe import py2exe as _py2exe class cmd_py2exe(_py2exe): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1915,13 +1929,15 @@ def run(self): os.unlink(target_versionfile) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % - {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["py2exe"] = cmd_py2exe # we override different "sdist" commands for both environments @@ -1933,6 +1949,7 @@ def run(self): from distutils.command.sdist import sdist as _sdist class cmd_sdist(_sdist): + def run(self): versions = get_versions() self._versioneer_generated_versions = versions @@ -1950,8 +1967,8 @@ def make_release_tree(self, base_dir, files): # updated value target_versionfile = os.path.join(base_dir, cfg.versionfile_source) print("UPDATING %s" % target_versionfile) - write_to_version_file(target_versionfile, - self._versioneer_generated_versions) + write_to_version_file(target_versionfile, self._versioneer_generated_versions) + cmds["sdist"] = cmd_sdist return cmds @@ -2011,11 +2028,9 @@ def do_setup(): root = get_root() try: cfg = get_config_from_root(root) - except (OSError, configparser.NoSectionError, - configparser.NoOptionError) as e: + except (OSError, configparser.NoSectionError, configparser.NoOptionError) as e: if isinstance(e, (OSError, configparser.NoSectionError)): - print("Adding sample versioneer config to setup.cfg", - file=sys.stderr) + print("Adding sample versioneer config to setup.cfg", file=sys.stderr) with open(os.path.join(root, "setup.cfg"), "a") as f: f.write(SAMPLE_CONFIG) print(CONFIG_ERROR, file=sys.stderr) @@ -2024,15 +2039,16 @@ def do_setup(): print(" creating %s" % cfg.versionfile_source) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) - - ipy = os.path.join(os.path.dirname(cfg.versionfile_source), - "__init__.py") + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + + ipy = os.path.join(os.path.dirname(cfg.versionfile_source), "__init__.py") if os.path.exists(ipy): try: with open(ipy, "r") as f: @@ -2080,8 +2096,7 @@ def do_setup(): else: print(" 'versioneer.py' already in MANIFEST.in") if cfg.versionfile_source not in simple_includes: - print(" appending versionfile_source ('%s') to MANIFEST.in" % - cfg.versionfile_source) + print(" appending versionfile_source ('%s') to MANIFEST.in" % cfg.versionfile_source) with open(manifest_in, "a") as f: f.write("include %s\n" % cfg.versionfile_source) else: diff --git a/external/utilities b/external/utilities new file mode 160000 index 000000000..ea948b427 --- /dev/null +++ b/external/utilities @@ -0,0 +1 @@ +Subproject commit ea948b427cda4aec0b583dec2e3ff5f696a6d941 diff --git a/protos/CMakeLists.txt b/protos/CMakeLists.txt index 139d168d2..93a538f88 100644 --- a/protos/CMakeLists.txt +++ b/protos/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -include(GRPCGenerateCPP) +set(MRC_PROTO_MODULE_PATH_EXTENSIONS + "${CMAKE_SOURCE_DIR}/utilities/cmake" + ) + +# Prepend path updates so they take priority in this scope. +list(PREPEND CMAKE_MODULE_PATH ${MRC_PROTO_MODULE_PATH_EXTENSIONS}) + +include(morpheus_utils/grpc/grpc_generate_cpp) add_library(mrc_protos) @@ -90,3 +97,5 @@ install( PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/protos" ) + +list(REMOVE_ITEM CMAKE_MODULE_PATH ${MRC_PROTO_MODULE_PATH_EXTENSIONS}) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index faac1b284..79676a206 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,13 +17,31 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "python") find_package(CUDAToolkit REQUIRED) -include(python_module_tools) +# Get the project name in uppercase if OPTION_PREFIX is not defined +if(NOT DEFINED OPTION_PREFIX) + string(TOUPPER "${PROJECT_NAME}" OPTION_PREFIX) +endif() + +option(${OPTION_PREFIX}_PYTHON_INPLACE_BUILD "Whether or not to copy built python modules back to the source tree for debug purposes." OFF) +option(${OPTION_PREFIX}_PYTHON_PERFORM_INSTALL "Whether or not to automatically `pip install` any built python library. WARNING: This may overwrite any existing installation of the same name." OFF) +option(${OPTION_PREFIX}_PYTHON_BUILD_STUBS "Whether or not to generated .pyi stub files for C++ Python modules. Disable to avoid requiring loading the NVIDIA GPU Driver during build" ON) + +set(Python3_FIND_VIRTUALENV "FIRST") +set(Python3_FIND_STRATEGY "LOCATION") + +morpheus_utils_print_python_info() # Create the mrc python package -create_python_package(mrc) +morpheus_utils_create_python_package(mrc) # Add a few additional files to be copied -add_python_sources("pytest.ini" "tests/string_reader_input.txt") +file(GLOB pymrc_test_files "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.py") +morpheus_utils_add_python_sources( + "pytest.ini" + "tests/string_reader_input.txt" + ${pymrc_test_files} +) + # Save the root of the python for relative paths set(MRC_PY_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) @@ -43,11 +61,14 @@ macro(mrc_add_pybind11_module) endif() # Forward all common arguments plus any arguments passed in - add_pybind11_module(${ARGN} ${_common_args}) + morpheus_utils_add_pybind11_module(${ARGN} ${_common_args}) endmacro() add_subdirectory(mrc/_pymrc) add_subdirectory(mrc/core) + +# ################################################################################################## +# - Benchmarks-------------------------------------------------------------------------------------- add_subdirectory(mrc/benchmarking) # ################################################################################################## @@ -67,6 +88,6 @@ if(MRC_PYTHON_PERFORM_INSTALL) list(APPEND extra_args "INSTALL_WHEEL") endif() -build_python_package(mrc ${extra_args}) +morpheus_utils_build_python_package(mrc ${extra_args}) list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/python/mrc/_pymrc/CMakeLists.txt b/python/mrc/_pymrc/CMakeLists.txt index 8213aefb3..a215f0113 100644 --- a/python/mrc/_pymrc/CMakeLists.txt +++ b/python/mrc/_pymrc/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2020-2022, NVIDIA CORPORATION. +# Copyright (c) 2020-2023, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -45,18 +45,18 @@ add_library(${PROJECT_NAME}::pymrc ALIAS pymrc) target_link_libraries(pymrc PUBLIC - ${PROJECT_NAME}::libmrc - ${Python_LIBRARIES} - prometheus-cpp::core - pybind11::pybind11 + ${PROJECT_NAME}::libmrc + ${Python_LIBRARIES} + prometheus-cpp::core + pybind11::pybind11 ) target_include_directories(pymrc PUBLIC - $ - $ + $ + $ PRIVATE - ${Python_INCLUDE_DIR} + ${Python_INCLUDE_DIR} ) set_target_properties(pymrc PROPERTIES OUTPUT_NAME ${PROJECT_NAME}_pymrc) diff --git a/python/mrc/_pymrc/include/pymrc/tracers.hpp b/python/mrc/_pymrc/include/pymrc/tracers.hpp new file mode 100644 index 000000000..e01c387d2 --- /dev/null +++ b/python/mrc/_pymrc/include/pymrc/tracers.hpp @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "mrc/benchmarking/tracer.hpp" + +#include // for object, dict + +namespace mrc::pymrc { +using latency_tracer_t = mrc::benchmarking::TracerEnsemble; +using throughput_tracer_t = mrc::benchmarking::TracerEnsemble; +} // namespace mrc::pymrc diff --git a/python/mrc/_pymrc/include/pymrc/watchers.hpp b/python/mrc/_pymrc/include/pymrc/watchers.hpp index 022676964..92b5a0b51 100644 --- a/python/mrc/_pymrc/include/pymrc/watchers.hpp +++ b/python/mrc/_pymrc/include/pymrc/watchers.hpp @@ -17,8 +17,9 @@ #pragma once +#include "pymrc/tracers.hpp" + #include "mrc/benchmarking/segment_watcher.hpp" -#include "mrc/benchmarking/tracer.hpp" #include // for object, dict @@ -28,6 +29,7 @@ namespace mrc::segment { class Builder; + struct ObjectProperties; } // namespace mrc::segment @@ -50,17 +52,21 @@ class LatencyWatcher : public latency_watcher_t { public: LatencyWatcher(std::shared_ptr executor); + LatencyWatcher(std::shared_ptr executor, std::function payload_init); void make_segment(const std::string& name, const std::function& init); + std::shared_ptr make_tracer_source(mrc::segment::Builder& seg, const std::string& name, bool force_sequential = false); + std::shared_ptr make_traced_node( mrc::segment::Builder& seg, const std::string& name, std::function map_f); + std::shared_ptr make_tracer_sink( mrc::segment::Builder& seg, const std::string& name, @@ -76,18 +82,22 @@ class ThroughputWatcher : public throughput_watcher_t { public: ThroughputWatcher(std::shared_ptr executor); + ThroughputWatcher(std::shared_ptr executor, std::function payload_init); void make_segment(const std::string& name, const std::function& init); + std::shared_ptr make_tracer_source(mrc::segment::Builder& seg, const std::string& name, bool force_sequential = false); + std::shared_ptr make_traced_node( mrc::segment::Builder& seg, const std::string& name, std::function map_f); + std::shared_ptr make_tracer_sink( mrc::segment::Builder& seg, const std::string& name, diff --git a/python/mrc/_pymrc/src/tracers.cpp b/python/mrc/_pymrc/src/tracers.cpp new file mode 100644 index 000000000..21aad6c87 --- /dev/null +++ b/python/mrc/_pymrc/src/tracers.cpp @@ -0,0 +1,18 @@ +/** + * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pymrc/tracers.hpp" \ No newline at end of file diff --git a/python/mrc/benchmarking/CMakeLists.txt b/python/mrc/benchmarking/CMakeLists.txt index 626c3720c..ebe1278c7 100644 --- a/python/mrc/benchmarking/CMakeLists.txt +++ b/python/mrc/benchmarking/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2020-2022, NVIDIA CORPORATION. +# Copyright (c) 2020-2023, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -14,7 +14,6 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "benchmarking") -mrc_add_pybind11_module(watchers SOURCE_FILES watchers.cpp) -mrc_add_pybind11_module(tracers SOURCE_FILES tracers.cpp trace_statistics.cpp) +mrc_add_pybind11_module(watchers SOURCE_FILES watchers.cpp trace_statistics.cpp) list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/python/mrc/benchmarking/__init__.py b/python/mrc/benchmarking/__init__.py index 7b5408997..5ba5f7b6f 100644 --- a/python/mrc/benchmarking/__init__.py +++ b/python/mrc/benchmarking/__init__.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2018-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2018-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .tracers import get_tracing_stats -from .tracers import reset_tracing_stats -from .tracers import sync_tracing_state -from .tracers import trace_channels -from .tracers import trace_operators from .watchers import LatencyWatcher from .watchers import ThroughputWatcher +from .watchers import get_tracing_stats +from .watchers import reset_tracing_stats +from .watchers import sync_tracing_state +from .watchers import trace_channels +from .watchers import trace_operators diff --git a/python/mrc/benchmarking/tracers.cpp b/python/mrc/benchmarking/tracers.cpp index 19736a584..4b8f88211 100644 --- a/python/mrc/benchmarking/tracers.cpp +++ b/python/mrc/benchmarking/tracers.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "mrc/benchmarking/tracer.hpp" +#include "pymrc/tracers.hpp" #include #include @@ -27,13 +27,11 @@ namespace mrc::pymrc { namespace py = pybind11; +using namespace mrc::benchmarking; void init_tracer_stats_api(py::module_& m); void init_tracer_api(py::module_& m); -using latency_tracer_t = mrc::benchmarking::TracerEnsemble; -using throughput_tracer_t = mrc::benchmarking::TracerEnsemble; - // TODO (Devin): Not supporting direct tracers yet, file still needs to be implemented. PYBIND11_MODULE(tracers, m) { diff --git a/python/mrc/benchmarking/watchers.cpp b/python/mrc/benchmarking/watchers.cpp index a22efdebf..26de6d60e 100644 --- a/python/mrc/benchmarking/watchers.cpp +++ b/python/mrc/benchmarking/watchers.cpp @@ -19,6 +19,7 @@ #include "pymrc/executor.hpp" // IWYU pragma: keep #include "pymrc/segment.hpp" +#include "pymrc/tracers.hpp" #include #include // IWYU pragma: keep @@ -28,16 +29,46 @@ #include #include #include -#include namespace mrc::pymrc { - namespace py = pybind11; +void init_tracer_stats_api(py::module_& m); + PYBIND11_MODULE(watchers, m) { m.doc() = R"pbdoc()pbdoc"; + pymrc::import(m, "mrc.core.executor"); + + init_tracer_stats_api(m); + + /** + * @brief define tracer implementations for use with segment watchers + */ + // pymrc::init_tracer_api(m); + + /** + * @brief Tracer objects are packaged into tracer ensembles; we'll just support tracer's with py::object payloads + * for now. + */ + auto LatencyTracer = py::class_>(m, "LatencyTracer"); + LatencyTracer.def(py::init()); + + // TODO(devin) + // LatencyTracer.def("add_counters", &mrc::LatencyTracer::add_counters); + LatencyTracer.def_static("aggregate", [](py::object& obj_type, py::list ensemble_tracers) { + // Something is broken with calling static members + }); + LatencyTracer.def("emit", &latency_tracer_t::emit); + + /** + * @brief ThroughputTracer + */ + auto ThroughputTracer = py::class_>(m, + "ThroughputTracer"); + ThroughputTracer.def(py::init()); + // Segment watcher allows for each tracer object to have a data payload. To simplify, for now, we'll assume // that the payload is a py::object. // auto SegmentWatcher = py::class_>(m, "SegmentWatcher"); diff --git a/python/mrc/tests/CMakeLists.txt b/python/mrc/tests/CMakeLists.txt index 071f4bae6..826628337 100644 --- a/python/mrc/tests/CMakeLists.txt +++ b/python/mrc/tests/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# SPDX-FileCopyrightText: Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except @@ -17,9 +17,6 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "tests") mrc_add_pybind11_module(test_edges_cpp SOURCE_FILES test_edges.cpp) mrc_add_pybind11_module(sample_modules SOURCE_FILES sample_modules.cpp) - -mrc_add_pybind11_module(utils - SOURCE_FILES utils.cpp -) +mrc_add_pybind11_module(utils SOURCE_FILES utils.cpp) list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/python/mrc/tests/test_edges.cpp b/python/mrc/tests/test_edges.cpp index 74009b9de..9088b4888 100644 --- a/python/mrc/tests/test_edges.cpp +++ b/python/mrc/tests/test_edges.cpp @@ -23,6 +23,7 @@ #include "mrc/channel/status.hpp" #include "mrc/node/edge_connector.hpp" #include "mrc/segment/builder.hpp" +#include "mrc/segment/object.hpp" #include "mrc/utils/string_utils.hpp" #include "mrc/version.hpp" @@ -189,6 +190,7 @@ PYBIND11_MODULE(test_edges_cpp, module) module.doc() = R"pbdoc()pbdoc"; pymrc::import(module, "mrc"); + pymrc::import(module, "mrc.core.segment"); py::class_>(module, "Base").def(py::init<>([]() { return std::make_shared(); diff --git a/python/versioneer.py b/python/versioneer.py index 0f6320e52..89d6cf34a 100644 --- a/python/versioneer.py +++ b/python/versioneer.py @@ -13,9 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - # Version: 0.18 - """The Versioneer - like a rocketeer, but for versions. The Versioneer @@ -292,10 +290,12 @@ """ from __future__ import print_function + try: import configparser except ImportError: import ConfigParser as configparser + import errno import json import os @@ -340,8 +340,7 @@ def get_root(): me_dir = os.path.normcase(os.path.splitext(me)[0]) vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0]) if me_dir != vsr_dir: - print("Warning: build in %s is using versioneer.py from %s" - % (os.path.dirname(me), versioneer_py)) + print("Warning: build in %s is using versioneer.py from %s" % (os.path.dirname(me), versioneer_py)) except NameError: pass return root @@ -363,6 +362,7 @@ def get(parser, name): if parser.has_option("versioneer", name): return parser.get("versioneer", name) return None + cfg = VersioneerConfig() cfg.VCS = VCS cfg.style = get(parser, "style") or "" @@ -387,17 +387,18 @@ class NotThisMethod(Exception): def register_vcs_handler(vcs, method): # decorator """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): """Store f in HANDLERS[vcs][method].""" if vcs not in HANDLERS: HANDLERS[vcs] = {} HANDLERS[vcs][method] = f return f + return decorate -def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, - env=None): +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None): """Call the given command(s).""" assert isinstance(commands, list) p = None @@ -405,10 +406,11 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, try: dispcmd = str([c] + args) # remember shell=False, so use git.cmd on windows, not just git - p = subprocess.Popen([c] + args, cwd=cwd, env=env, + p = subprocess.Popen([c] + args, + cwd=cwd, + env=env, stdout=subprocess.PIPE, - stderr=(subprocess.PIPE if hide_stderr - else None)) + stderr=(subprocess.PIPE if hide_stderr else None)) break except EnvironmentError: e = sys.exc_info()[1] @@ -420,7 +422,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, return None, None else: if verbose: - print("unable to find command, tried %s" % (commands,)) + print("unable to find command, tried %s" % (commands, )) return None, None stdout = p.communicate()[0].strip() if sys.version_info[0] >= 3: @@ -1028,16 +1030,19 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): r = ref[len(tag_prefix):] if verbose: print("picking %s" % r) - return {"version": r, - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": None, - "date": date} + return { + "version": r, "full-revisionid": keywords["full"].strip(), "dirty": False, "error": None, "date": date + } # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: print("no suitable tags, using unknown + full revision id") - return {"version": "0+unknown", - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": "no suitable tags", "date": None} + return { + "version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, + "error": "no suitable tags", + "date": None + } @register_vcs_handler("git", "pieces_from_vcs") @@ -1052,8 +1057,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): if sys.platform == "win32": GITS = ["git.cmd", "git.exe"] - out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, - hide_stderr=True) + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True) if rc != 0: if verbose: print("Directory %s not under git control" % root) @@ -1096,8 +1100,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: # unparseable. Maybe git-describe is misbehaving? - pieces["error"] = ("unable to parse git-describe output: '%s'" - % describe_out) + pieces["error"] = ("unable to parse git-describe output: '%s'" % describe_out) return pieces # tag @@ -1106,8 +1109,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): if verbose: fmt = "tag '%s' doesn't start with prefix '%s'" print(fmt % (full_tag, tag_prefix)) - pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" - % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" % (full_tag, tag_prefix)) return pieces pieces["closest-tag"] = full_tag[len(tag_prefix):] @@ -1120,13 +1122,11 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): else: # HEX: no tags pieces["closest-tag"] = None - count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], - cwd=root) + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], cwd=root) pieces["distance"] = int(count_out) # total number of commits # commit date: see ISO-8601 comment in git_versions_from_keywords() - date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], - cwd=root)[0].strip() + date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip() pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) return pieces @@ -1182,16 +1182,19 @@ def versions_from_parentdir(parentdir_prefix, root, verbose): for i in range(3): dirname = os.path.basename(root) if dirname.startswith(parentdir_prefix): - return {"version": dirname[len(parentdir_prefix):], - "full-revisionid": None, - "dirty": False, "error": None, "date": None} + return { + "version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, + "error": None, + "date": None + } else: rootdirs.append(root) root = os.path.dirname(root) # up a level if verbose: - print("Tried directories %s but none started with prefix %s" % - (str(rootdirs), parentdir_prefix)) + print("Tried directories %s but none started with prefix %s" % (str(rootdirs), parentdir_prefix)) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") @@ -1220,11 +1223,9 @@ def versions_from_file(filename): contents = f.read() except EnvironmentError: raise NotThisMethod("unable to read _version.py") - mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", - contents, re.M | re.S) + mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: - mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", - contents, re.M | re.S) + mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: raise NotThisMethod("no version_json in _version.py") return json.loads(mo.group(1)) @@ -1233,8 +1234,7 @@ def versions_from_file(filename): def write_to_version_file(filename, versions): """Write the given version number to the given _version.py file.""" os.unlink(filename) - contents = json.dumps(versions, sort_keys=True, - indent=1, separators=(",", ": ")) + contents = json.dumps(versions, sort_keys=True, indent=1, separators=(",", ": ")) with open(filename, "w") as f: f.write(SHORT_VERSION_PY % contents) @@ -1266,8 +1266,7 @@ def render_pep440(pieces): rendered += ".dirty" else: # exception #1 - rendered = "0+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) + rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered @@ -1381,11 +1380,13 @@ def render_git_describe_long(pieces): def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: - return {"version": "unknown", - "full-revisionid": pieces.get("long"), - "dirty": None, - "error": pieces["error"], - "date": None} + return { + "version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None + } if not style or style == "default": style = "pep440" # the default @@ -1405,9 +1406,13 @@ def render(pieces, style): else: raise ValueError("unknown style '%s'" % style) - return {"version": rendered, "full-revisionid": pieces["long"], - "dirty": pieces["dirty"], "error": None, - "date": pieces.get("date")} + return { + "version": rendered, + "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], + "error": None, + "date": pieces.get("date") + } class VersioneerBadRootError(Exception): @@ -1485,9 +1490,13 @@ def get_versions(verbose=False): if verbose: print("unable to compute version") - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, "error": "unable to compute version", - "date": None} + return { + "version": "0+unknown", + "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", + "date": None + } def get_version(): @@ -1536,6 +1545,7 @@ def run(self): print(" date: %s" % vers.get("date")) if vers["error"]: print(" error: %s" % vers["error"]) + cmds["version"] = cmd_version # we override "build_py" in both distutils and setuptools @@ -1560,6 +1570,7 @@ def run(self): from distutils.command.build_py import build_py as _build_py class cmd_build_py(_build_py): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1568,14 +1579,15 @@ def run(self): # now locate _version.py in the new build/ directory and replace # it with an updated value if cfg.versionfile_build: - target_versionfile = os.path.join(self.build_lib, - cfg.versionfile_build) + target_versionfile = os.path.join(self.build_lib, cfg.versionfile_build) print("UPDATING %s" % target_versionfile) write_to_version_file(target_versionfile, versions) + cmds["build_py"] = cmd_build_py if "cx_Freeze" in sys.modules: # cx_freeze enabled? from cx_Freeze.dist import build_exe as _build_exe + # nczeczulin reports that py2exe won't like the pep440-style string # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. # setup(console=[{ @@ -1584,6 +1596,7 @@ def run(self): # ... class cmd_build_exe(_build_exe): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1596,23 +1609,26 @@ def run(self): os.unlink(target_versionfile) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % - {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["build_exe"] = cmd_build_exe del cmds["build_py"] if 'py2exe' in sys.modules: # py2exe enabled? try: - from py2exe.distutils_buildexe import py2exe as _py2exe # py3 + from py2exe.distutils_buildexe import py2exe as _py2exe except ImportError: - from py2exe.build_exe import py2exe as _py2exe # py2 + from py2exe.build_exe import py2exe as _py2exe class cmd_py2exe(_py2exe): + def run(self): root = get_root() cfg = get_config_from_root(root) @@ -1625,13 +1641,15 @@ def run(self): os.unlink(target_versionfile) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % - {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["py2exe"] = cmd_py2exe # we override different "sdist" commands for both environments @@ -1641,6 +1659,7 @@ def run(self): from distutils.command.sdist import sdist as _sdist class cmd_sdist(_sdist): + def run(self): versions = get_versions() self._versioneer_generated_versions = versions @@ -1658,8 +1677,8 @@ def make_release_tree(self, base_dir, files): # updated value target_versionfile = os.path.join(base_dir, cfg.versionfile_source) print("UPDATING %s" % target_versionfile) - write_to_version_file(target_versionfile, - self._versioneer_generated_versions) + write_to_version_file(target_versionfile, self._versioneer_generated_versions) + cmds["sdist"] = cmd_sdist return cmds @@ -1714,11 +1733,9 @@ def do_setup(): root = get_root() try: cfg = get_config_from_root(root) - except (EnvironmentError, configparser.NoSectionError, - configparser.NoOptionError) as e: + except (EnvironmentError, configparser.NoSectionError, configparser.NoOptionError) as e: if isinstance(e, (EnvironmentError, configparser.NoSectionError)): - print("Adding sample versioneer config to setup.cfg", - file=sys.stderr) + print("Adding sample versioneer config to setup.cfg", file=sys.stderr) with open(os.path.join(root, "setup.cfg"), "a") as f: f.write(SAMPLE_CONFIG) print(CONFIG_ERROR, file=sys.stderr) @@ -1727,15 +1744,16 @@ def do_setup(): print(" creating %s" % cfg.versionfile_source) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, - }) - - ipy = os.path.join(os.path.dirname(cfg.versionfile_source), - "__init__.py") + f.write( + LONG % { + "DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + + ipy = os.path.join(os.path.dirname(cfg.versionfile_source), "__init__.py") if os.path.exists(ipy): try: with open(ipy, "r") as f: @@ -1777,8 +1795,7 @@ def do_setup(): else: print(" 'versioneer.py' already in MANIFEST.in") if cfg.versionfile_source not in simple_includes: - print(" appending versionfile_source ('%s') to MANIFEST.in" % - cfg.versionfile_source) + print(" appending versionfile_source ('%s') to MANIFEST.in" % cfg.versionfile_source) with open(manifest_in, "a") as f: f.write("include %s\n" % cfg.versionfile_source) else: diff --git a/scripts/gen_coverage.sh b/scripts/gen_coverage.sh deleted file mode 100755 index 7834aa570..000000000 --- a/scripts/gen_coverage.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2021-2022, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -set -x -set -e - -cmake -DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_BUILD_TYPE=Debug -DMRC_ENABLE_CODECOV=ON -DMRC_BUILD_PYTHON=ON -DMRC_BUILD_TESTS=ON -B ./build -cmake --build ./build -pip install -e ./build/python -cd ./build && ctest && pytest ./build/python/tests -cmake --build ./build --target gcovr-html-report diff --git a/scripts/print_env.sh b/scripts/print_env.sh deleted file mode 100755 index a5b63aed9..000000000 --- a/scripts/print_env.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2021-2022, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Reports relevant environment information useful for diagnosing and -# debugging cuDF issues. -# Usage: -# "./print_env.sh" - prints to stdout -# "./print_env.sh > env.txt" - prints to file "env.txt" - -print_env() { -echo "**git***" -if [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]; then -git log --decorate -n 1 -echo "**git submodules***" -git submodule status --recursive -else -echo "Not inside a git repository" -fi -echo - -echo "***OS Information***" -cat /etc/*-release -uname -a -echo - -echo "***GPU Information***" -nvidia-smi -echo - -echo "***CPU***" -lscpu -echo - -echo "***CMake***" -which cmake && cmake --version -echo - -echo "***g++***" -which g++ && g++ --version -echo - -echo "***nvcc***" -which nvcc && nvcc --version -echo - -echo "***Python***" -which python && python -c "import sys; print('Python {0}.{1}.{2}'.format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))" -echo - -echo "***Environment Variables***" - -printf '%-32s: %s\n' PATH $PATH - -printf '%-32s: %s\n' LD_LIBRARY_PATH $LD_LIBRARY_PATH - -printf '%-32s: %s\n' NUMBAPRO_NVVM $NUMBAPRO_NVVM - -printf '%-32s: %s\n' NUMBAPRO_LIBDEVICE $NUMBAPRO_LIBDEVICE - -printf '%-32s: %s\n' CONDA_PREFIX $CONDA_PREFIX - -printf '%-32s: %s\n' PYTHON_PATH $PYTHON_PATH - -echo - - -# Print conda packages if conda exists -if type "conda" &> /dev/null; then -echo '***conda packages***' -which conda && conda list -echo -# Print pip packages if pip exists -elif type "pip" &> /dev/null; then -echo "conda not found" -echo "***pip packages***" -which pip && pip list -echo -else -echo "conda not found" -echo "pip not found" -fi -} - -echo "
Click here to see environment details
"
-echo "     "
-print_env | while read -r line; do
-    echo "     $line"
-done
-echo "
" diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index 921f0ab5a..000000000 --- a/vcpkg.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", - "name": "mrc", - "version": "0.1.0", - "description": "NVIDIA Morpheus Runtime Core", - "dependencies": [ - "benchmark", - "boost-fiber", - "boost-filesystem", - "boost-hana", - "boost-histogram", - "gflags", - "glog", - "grpc", - "gtest", - "nlohmann-json" - ], - "builtin-baseline": "bedae7b82046b49c33b49ba57b5b9dc1df811247" -}