Skip to content

Commit

Permalink
Avoid compiler warnings (#518)
Browse files Browse the repository at this point in the history
* Set `-lto=auto` to avoid a warning about [falling back to serialized compilation (`cpp/mrc/CMakeLists.txt`)
* Ensure we never pass a capacity value larger than `PTRDIFF_MAX` to `boost::fibers::buffered_channel` avoids a -Walloc-size-larger-than compiler warning (`cpp/mrc/include/mrc/channel/buffered_channel.hpp`).
* Ensure tags are fetched for local CI builds (fixes version number for local conda builds).

Everything else is an IWYU fix

Part of nv-morpheus/Morpheus#1988

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: #518
  • Loading branch information
dagardner-nv authored Nov 20, 2024
1 parent 0b9cede commit 10439b3
Show file tree
Hide file tree
Showing 29 changed files with 56 additions and 31 deletions.
3 changes: 2 additions & 1 deletion ci/scripts/bootstrap_local_ci.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -21,6 +21,7 @@ cd mrc/
git checkout ${GIT_BRANCH}
git pull
git checkout ${GIT_COMMIT}
git fetch --tags

export MRC_ROOT=$(pwd)
export WORKSPACE=${MRC_ROOT}
Expand Down
4 changes: 3 additions & 1 deletion ci/scripts/github/conda.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,6 +19,8 @@ set -e
CI_SCRIPT_ARGS="$@"
source ${WORKSPACE}/ci/scripts/github/common.sh

fetch_base_branch

# Its important that we are in the base environment for the build
rapids-logger "Activating Base Conda Environment"

Expand Down
2 changes: 1 addition & 1 deletion ci/scripts/run_ci_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ GIT_COMMIT=$(git log -n 1 --pretty=format:%H)

BASE_LOCAL_CI_TMP=${BASE_LOCAL_CI_TMP:-${MRC_ROOT}/.tmp/local_ci_tmp}
CONTAINER_VER=${CONTAINER_VER:-241002}
CUDA_VER=${CUDA_VER:-12.1}
CUDA_VER=${CUDA_VER:-12.5}
DOCKER_EXTRA_ARGS=${DOCKER_EXTRA_ARGS:-""}

BUILD_CONTAINER="nvcr.io/ea-nvidia-morpheus/morpheus:mrc-ci-build-${CONTAINER_VER}"
Expand Down
5 changes: 5 additions & 0 deletions cpp/mrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ endif()

target_compile_features(libmrc PUBLIC cxx_std_20)

# Avoid GCC warning from the lto-wrapper about serial compilation
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_link_options(libmrc PUBLIC "-flto=auto")
endif()

set_target_properties(libmrc PROPERTIES OUTPUT_NAME ${PROJECT_NAME})

# Generates an include file for specifying external linkage since everything is hidden by default
Expand Down
1 change: 1 addition & 0 deletions cpp/mrc/benchmarks/bench_baselines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <benchmark/benchmark.h>
#include <rxcpp/rx.hpp>

#include <algorithm>
#include <chrono>
#include <cstddef>
#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions cpp/mrc/benchmarks/bench_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <nlohmann/json.hpp>
#include <rxcpp/rx.hpp>

#include <algorithm>
#include <chrono>
#include <cstddef>
#include <iostream>
Expand Down
4 changes: 2 additions & 2 deletions cpp/mrc/include/mrc/benchmarking/tracer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -22,7 +22,6 @@
#include <glog/logging.h>
#include <nlohmann/json.hpp>

#include <array>
#include <chrono>
#include <cstddef>
#include <map>
Expand All @@ -31,6 +30,7 @@
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

// IWYU pragma: no_include <compare> (Issues with this header)
Expand Down
12 changes: 10 additions & 2 deletions cpp/mrc/include/mrc/channel/buffered_channel.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -22,6 +22,10 @@
#include <boost/fiber/buffered_channel.hpp>
#include <boost/fiber/channel_op_status.hpp>

#include <algorithm> // for std::min
#include <cstddef> // for std::ptrdiff_t, std::size_t
#include <limits> // for std::numeric_limits

namespace mrc::channel {

template <typename T>
Expand All @@ -30,7 +34,11 @@ class BufferedChannel final : public Channel<T>
using status_t = boost::fibers::channel_op_status;

public:
BufferedChannel(std::size_t buffer_size = default_channel_size()) : m_channel(buffer_size) {}
BufferedChannel(std::size_t buffer_size = default_channel_size()) :
// This avoids a Walloc-size-larger-than warning about potentially allocating a size larger than PTRDIFF_MAX
m_channel(std::min(static_cast<std::size_t>(std::numeric_limits<ptrdiff_t>::max()), buffer_size))
{}

~BufferedChannel() final = default;

private:
Expand Down
3 changes: 2 additions & 1 deletion cpp/mrc/include/mrc/modules/module_registry.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,6 +19,7 @@

#include <nlohmann/json.hpp>

#include <algorithm>
#include <functional>
#include <map>
#include <memory>
Expand Down
3 changes: 2 additions & 1 deletion cpp/mrc/include/mrc/utils/type_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@

#include <boost/type_index.hpp>

#include <array>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <string>
#include <type_traits>
#include <typeindex>
#include <utility>
#include <variant>

namespace mrc {
Expand Down
3 changes: 2 additions & 1 deletion cpp/mrc/src/internal/codable/codable_storage.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -36,6 +36,7 @@
#include <glog/logging.h>
#include <google/protobuf/any.pb.h>

#include <algorithm>
#include <cstdint>
#include <optional>
#include <ostream>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -27,6 +27,7 @@
#include <glog/logging.h>
#include <google/protobuf/any.pb.h>

#include <algorithm>
#include <sstream>
#include <utility>

Expand Down
3 changes: 1 addition & 2 deletions cpp/mrc/src/internal/memory/device_resources.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -39,7 +39,6 @@

#include <sstream>
#include <string>
#include <thread>
#include <utility>

namespace mrc::memory {
Expand Down
3 changes: 1 addition & 2 deletions cpp/mrc/src/internal/memory/host_resources.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -40,7 +40,6 @@
#include <memory>
#include <ostream>
#include <string>
#include <thread>
#include <utility>
#include <vector>

Expand Down
3 changes: 2 additions & 1 deletion cpp/mrc/src/public/benchmarking/tracer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -21,6 +21,7 @@

#include <nlohmann/json.hpp>

#include <algorithm>
#include <mutex>

namespace mrc::benchmarking {
Expand Down
4 changes: 3 additions & 1 deletion cpp/mrc/src/public/core/logging.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,6 +17,8 @@

#include "mrc/core/logging.hpp"

#include <glog/flags.h>

#include <atomic>

namespace {
Expand Down
3 changes: 2 additions & 1 deletion cpp/mrc/src/tests/test_control_plane_components.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -23,6 +23,7 @@

#include <gtest/gtest.h>

#include <algorithm>
#include <atomic>
#include <cstddef>
#include <cstdint>
Expand Down
3 changes: 1 addition & 2 deletions cpp/mrc/src/tests/test_memory.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -42,7 +42,6 @@
#include <optional>
#include <ostream>
#include <string>
#include <thread>
#include <utility>
#include <vector>

Expand Down
4 changes: 2 additions & 2 deletions cpp/mrc/src/tests/test_next.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -25,11 +25,11 @@
#include "mrc/channel/ingress.hpp"
#include "mrc/data/reusable_pool.hpp"
#include "mrc/edge/edge_builder.hpp"
#include "mrc/edge/edge_writable.hpp"
#include "mrc/node/generic_node.hpp"
#include "mrc/node/generic_sink.hpp"
#include "mrc/node/generic_source.hpp"
#include "mrc/node/operators/conditional.hpp"
#include "mrc/node/operators/router.hpp"
#include "mrc/node/readable_endpoint.hpp"
#include "mrc/node/rx_execute.hpp"
#include "mrc/node/rx_node.hpp"
Expand Down
3 changes: 2 additions & 1 deletion cpp/mrc/src/tests/test_ranges.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,6 +19,7 @@

#include <gtest/gtest.h>

#include <algorithm>
#include <utility>
#include <vector>

Expand Down
3 changes: 2 additions & 1 deletion cpp/mrc/tests/logging/test_logging.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,6 +19,7 @@

#include "mrc/core/logging.hpp"

#include <glog/flags.h>
#include <glog/logging.h>

namespace mrc {
Expand Down
1 change: 1 addition & 0 deletions python/mrc/_pymrc/include/pymrc/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "mrc/segment/object.hpp"

#include <nlohmann/json_fwd.hpp>
#include <pybind11/pytypes.h>
#include <rxcpp/rx.hpp>

#include <functional> // for function
Expand Down
1 change: 0 additions & 1 deletion python/mrc/_pymrc/include/pymrc/utilities/object_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include <cstddef>
#include <functional>
#include <map>
#include <memory>
#include <mutex>
#include <string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,7 +18,6 @@
#pragma once

#include <pybind11/cast.h>
#include <pybind11/detail/descr.h>
#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>

Expand Down
1 change: 1 addition & 0 deletions python/mrc/_pymrc/src/utilities/object_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <pybind11/pytypes.h>
#include <pylifecycle.h>

#include <map>
#include <mutex>
#include <ostream>
#include <stdexcept>
Expand Down
1 change: 0 additions & 1 deletion python/mrc/_pymrc/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <glog/logging.h>
#include <nlohmann/json.hpp>
#include <pybind11/cast.h>
#include <pybind11/detail/internals.h>
#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>
#include <pyerrors.h>
Expand Down
1 change: 1 addition & 0 deletions python/mrc/_pymrc/tests/test_object_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "test_pymrc.hpp"

#include "pymrc/utilities/object_cache.hpp"
#include "pymrc/utilities/object_wrappers.hpp"

#include <gtest/gtest.h>
#include <pybind11/cast.h>
Expand Down
3 changes: 1 addition & 2 deletions python/mrc/benchmarking/trace_statistics.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,7 +19,6 @@

#include "pymrc/utils.hpp"

#include <nlohmann/json.hpp>
#include <pybind11/cast.h>
#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>
Expand Down
Loading

0 comments on commit 10439b3

Please sign in to comment.