Skip to content

Commit

Permalink
Explicitly mark RMM headers with RMM_EXPORT (#1654)
Browse files Browse the repository at this point in the history
Fixes #1652

Authors:
  - Robert Maynard (https://github.com/robertmaynard)
  - James Lamb (https://github.com/jameslamb)
  - Lawrence Mitchell (https://github.com/wence-)

Approvers:
  - James Lamb (https://github.com/jameslamb)
  - Mark Harris (https://github.com/harrism)

URL: #1654
  • Loading branch information
robertmaynard authored Aug 22, 2024
1 parent a7b9d37 commit 1555d6c
Show file tree
Hide file tree
Showing 53 changed files with 253 additions and 122 deletions.
8 changes: 4 additions & 4 deletions doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2136,15 +2136,15 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES

# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
Expand Down Expand Up @@ -2176,7 +2176,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = RMM_NAMESPACE=rmm RMM_EXPORT

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand All @@ -2185,7 +2185,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED = RMM_NAMESPACE

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
Expand Down
6 changes: 4 additions & 2 deletions include/rmm/aligned.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

#pragma once

#include <rmm/detail/export.hpp>

#include <cassert>
#include <cstddef>
#include <cstdint>

namespace rmm {
namespace RMM_NAMESPACE {

/**
* @addtogroup utilities
Expand Down Expand Up @@ -123,4 +125,4 @@ static constexpr std::size_t CUDA_ALLOCATION_ALIGNMENT{256};

/** @} */ // end of group

} // namespace rmm
} // namespace RMM_NAMESPACE
5 changes: 3 additions & 2 deletions include/rmm/cuda_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

#include <rmm/aligned.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/detail/export.hpp>

#include <cuda_runtime_api.h>

namespace rmm {
namespace RMM_NAMESPACE {

struct cuda_device_id;
inline cuda_device_id get_current_cuda_device();
Expand Down Expand Up @@ -175,4 +176,4 @@ struct cuda_set_device_raii {
};

/** @} */ // end of group
} // namespace rmm
} // namespace RMM_NAMESPACE
7 changes: 4 additions & 3 deletions include/rmm/cuda_stream.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,14 +18,15 @@

#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/detail/logging_assert.hpp>

#include <cuda_runtime_api.h>

#include <functional>
#include <memory>

namespace rmm {
namespace RMM_NAMESPACE {
/**
* @addtogroup cuda_streams
* @{
Expand Down Expand Up @@ -139,4 +140,4 @@ class cuda_stream {
};

/** @} */ // end of group
} // namespace rmm
} // namespace RMM_NAMESPACE
7 changes: 4 additions & 3 deletions include/rmm/cuda_stream_pool.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,12 +19,13 @@
#include <rmm/cuda_stream.hpp>
#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/detail/export.hpp>

#include <atomic>
#include <cstddef>
#include <vector>

namespace rmm {
namespace RMM_NAMESPACE {
/**
* @addtogroup cuda_streams
* @{
Expand Down Expand Up @@ -102,4 +103,4 @@ class cuda_stream_pool {
};

/** @} */ // end of group
} // namespace rmm
} // namespace RMM_NAMESPACE
7 changes: 4 additions & 3 deletions include/rmm/cuda_stream_view.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
#pragma once

#include <rmm/detail/error.hpp>
#include <rmm/detail/export.hpp>

#include <cuda/stream_ref>
#include <cuda_runtime_api.h>
Expand All @@ -25,7 +26,7 @@
#include <cstddef>
#include <cstdint>

namespace rmm {
namespace RMM_NAMESPACE {
/**
* @addtogroup cuda_streams
* @{
Expand Down Expand Up @@ -201,4 +202,4 @@ inline std::ostream& operator<<(std::ostream& os, cuda_stream_view stream)
}

/** @} */ // end of group
} // namespace rmm
} // namespace RMM_NAMESPACE
7 changes: 5 additions & 2 deletions include/rmm/detail/aligned.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
#pragma once

#include <rmm/aligned.hpp>
#include <rmm/detail/export.hpp>

#include <cassert>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <new>

namespace rmm::detail {
namespace RMM_NAMESPACE {
namespace detail {

/**
* @brief Allocates sufficient host-accessible memory to satisfy the requested size `bytes` with
Expand Down Expand Up @@ -112,4 +114,5 @@ void aligned_host_deallocate(void* ptr,

dealloc(original);
}
} // namespace rmm::detail
} // namespace detail
} // namespace RMM_NAMESPACE
9 changes: 6 additions & 3 deletions include/rmm/detail/dynamic_load_runtime.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@
#pragma once

#include <rmm/cuda_device.hpp>
#include <rmm/detail/export.hpp>

#include <cuda_runtime_api.h>

Expand All @@ -24,7 +25,8 @@
#include <memory>
#include <optional>

namespace rmm::detail {
namespace RMM_NAMESPACE {
namespace detail {

/**
* @brief `dynamic_load_runtime` loads the cuda runtime library at runtime
Expand Down Expand Up @@ -185,4 +187,5 @@ struct async_alloc {
#endif

#undef RMM_CUDART_API_WRAPPER
} // namespace rmm::detail
} // namespace detail
} // namespace RMM_NAMESPACE
7 changes: 4 additions & 3 deletions include/rmm/detail/export.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,8 +18,9 @@

// Macros used for defining symbol visibility, only GLIBC is supported
#if (defined(__GNUC__) && !defined(__MINGW32__) && !defined(__MINGW64__))
#define RMM_EXPORT __attribute__((visibility("default")))
#define RMM_HIDDEN __attribute__((visibility("hidden")))
#define RMM_EXPORT __attribute__((visibility("default")))
#define RMM_HIDDEN __attribute__((visibility("hidden")))
#define RMM_NAMESPACE RMM_EXPORT rmm
#else
#define RMM_EXPORT
#define RMM_HIDDEN
Expand Down
9 changes: 6 additions & 3 deletions include/rmm/detail/stack_trace.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
#pragma once

#include <rmm/detail/error.hpp>
#include <rmm/detail/export.hpp>

// execinfo is a linux-only library, so stack traces will only be available on
// linux systems.
Expand All @@ -36,7 +37,8 @@
#include <vector>
#endif

namespace rmm::detail {
namespace RMM_NAMESPACE {
namespace detail {

/**
* @brief stack_trace is a class that will capture a stack on instantiation for output later.
Expand Down Expand Up @@ -102,4 +104,5 @@ class stack_trace {
#endif // RMM_ENABLE_STACK_TRACES
};

} // namespace rmm::detail
} // namespace detail
} // namespace RMM_NAMESPACE
7 changes: 4 additions & 3 deletions include/rmm/device_buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,7 @@
#include <rmm/cuda_device.hpp>
#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/resource_ref.hpp>

Expand All @@ -29,7 +30,7 @@
#include <stdexcept>
#include <utility>

namespace rmm {
namespace RMM_NAMESPACE {
/**
* @addtogroup data_containers
* @{
Expand Down Expand Up @@ -479,4 +480,4 @@ class device_buffer {
};

/** @} */ // end of group
} // namespace rmm
} // namespace RMM_NAMESPACE
5 changes: 3 additions & 2 deletions include/rmm/device_scalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
#pragma once

#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/device_uvector.hpp>
#include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/resource_ref.hpp>

#include <type_traits>

namespace rmm {
namespace RMM_NAMESPACE {
/**
* @addtogroup data_containers
* @{
Expand Down Expand Up @@ -277,4 +278,4 @@ class device_scalar {
};

/** @} */ // end of group
} // namespace rmm
} // namespace RMM_NAMESPACE
7 changes: 4 additions & 3 deletions include/rmm/device_uvector.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@
#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/detail/exec_check_disable.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/device_buffer.hpp>
#include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/resource_ref.hpp>
Expand All @@ -28,7 +29,7 @@
#include <cstddef>
#include <vector>

namespace rmm {
namespace RMM_NAMESPACE {
/**
* @addtogroup data_containers
* @{
Expand Down Expand Up @@ -565,4 +566,4 @@ class device_uvector {
};

/** @} */ // end of group
} // namespace rmm
} // namespace RMM_NAMESPACE
7 changes: 4 additions & 3 deletions include/rmm/device_vector.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,12 +16,13 @@

#pragma once

#include <rmm/detail/export.hpp>
#include <rmm/detail/thrust_namespace.h>
#include <rmm/mr/device/thrust_allocator_adaptor.hpp>

#include <thrust/device_vector.h>

namespace rmm {
namespace RMM_NAMESPACE {
/**
* @addtogroup thrust_integrations
* @{
Expand All @@ -35,4 +36,4 @@ template <typename T>
using device_vector = thrust::device_vector<T, rmm::mr::thrust_allocator<T>>;

/** @} */ // end of group
} // namespace rmm
} // namespace RMM_NAMESPACE
Loading

0 comments on commit 1555d6c

Please sign in to comment.