GEOS
coreComponents
common
GeosxMacros.hpp
Go to the documentation of this file.
1
/*
2
* ------------------------------------------------------------------------------------------------------------
3
* SPDX-License-Identifier: LGPL-2.1-only
4
*
5
* Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6
* Copyright (c) 2018-2024 Total, S.A
7
* Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8
* Copyright (c) 2023-2024 Chevron
9
* Copyright (c) 2019- GEOS/GEOSX Contributors
10
* All rights reserved
11
*
12
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13
* ------------------------------------------------------------------------------------------------------------
14
*/
15
22
#include "
common/GeosxConfig.hpp
"
23
#include "LvArray/src/Macros.hpp"
24
25
#ifndef GEOS_COMMON_GEOSXMACROS_HPP_
26
#define GEOS_COMMON_GEOSXMACROS_HPP_
27
36
37
#if defined(GEOS_USE_DEVICE)
38
#define GEOS_HOST __host__
39
#define GEOS_DEVICE __device__
40
#define GEOS_HOST_DEVICE __host__ __device__
41
#define GEOS_FORCE_INLINE __forceinline__
42
#define PRAGMA_UNROLL _Pragma("unroll"
)
43
#else
45
#define GEOS_HOST
47
#define GEOS_DEVICE
49
#define GEOS_HOST_DEVICE
51
#define GEOS_FORCE_INLINE inline
53
#define PRAGMA_UNROLL
54
#endif
55
56
#if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__)
58
#define GEOS_DEVICE_COMPILE
59
#endif
60
62
70
72
#define GEOS_UNUSED_PARAM( X )
73
79
template
<
typename
... ARGS >
80
GEOS_HOST_DEVICE
inline
constexpr
81
void
i_g_n_o_r_e
( ARGS
const
& ... ) {}
82
84
#define GEOS_UNUSED_VAR( ... ) i_g_n_o_r_e( __VA_ARGS__ )
85
87
#define GEOS_DEBUG_VAR( ... ) GEOS_UNUSED_VAR( __VA_ARGS__ )
88
90
91
#if defined(GEOS_USE_OPENMP)
93
#define PRAGMA_OMP( clause ) _Pragma( clause )
94
// #define PRAGMA_OMP( clause ) _Pragma( STRINGIZE( omp clause ) )
95
#else
97
#define PRAGMA_OMP( clause )
98
#endif
99
101
#define GEOS_RESTRICT LVARRAY_RESTRICT
102
104
#define GEOS_RESTRICT_THIS LVARRAY_RESTRICT_THIS
105
107
#define GEOS_DECLTYPE_AUTO_RETURN decltype( auto )
108
110
#define GEOS_CONCAT_IMPL( A, B ) A ## B
111
113
#define GEOS_CONCAT( A, B ) GEOS_CONCAT_IMPL( A, B )
114
119
#if __cplusplus >= 201703L
120
#define GEOS_MAYBE_UNUSED [[maybe_unused]]
121
#else
122
// If not C++17 or later, check the compiler.
123
#ifdef _MSC_VER
124
// Microsoft Visual Studio
125
#define GEOS_MAYBE_UNUSED __pragma(warning(suppress: 4100))
126
#elif defined(__GNUC__) || defined(__clang__)
127
// GCC or Clang
128
#define GEOS_MAYBE_UNUSED __attribute__((unused))
129
#else
130
// If the compiler is unknown, we can't suppress the warning,
131
// so we define GEOS_MAYBE_UNUSED as an empty macro.
132
#define GEOS_MAYBE_UNUSED
133
#endif
134
#endif
135
136
#endif
// GEOS_COMMON_GEOSXMACROS_HPP_
GeosxConfig.hpp
GEOS_HOST_DEVICE
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition:
GeosxMacros.hpp:49
i_g_n_o_r_e
constexpr void i_g_n_o_r_e(ARGS const &...)
Used to silence unused variable warnings, cuda doesn't respect casting to void.
Definition:
GeosxMacros.hpp:81
Generated by
1.9.1