GEOSX
GeosxMacros.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 Total, S.A
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
21 #include "common/GeosxConfig.hpp"
22 #include "LvArray/src/Macros.hpp"
23 
24 #ifndef GEOSX_COMMON_GEOSXMACROS_HPP_
25 #define GEOSX_COMMON_GEOSXMACROS_HPP_
26 
34 
36 #if defined(__CUDACC__)
37 #define GEOSX_HOST __host__
38 #define GEOSX_DEVICE __device__
39 #define GEOSX_HOST_DEVICE __host__ __device__
40 #define GEOSX_FORCE_INLINE __forceinline__
41 #define PRAGMA_UNROLL _Pragma("unroll")
42 #else
43 #define GEOSX_HOST
45 #define GEOSX_DEVICE
47 #define GEOSX_HOST_DEVICE
49 #define GEOSX_FORCE_INLINE inline
51 #define PRAGMA_UNROLL
53 #endif
54 
56 
63 
66 #define GEOSX_UNUSED_PARAM( X )
67 
73 template< typename ... ARGS >
74 GEOSX_HOST_DEVICE inline constexpr
75 void i_g_n_o_r_e( ARGS const & ... ) {}
76 
78 #define GEOSX_UNUSED_VAR( ... ) i_g_n_o_r_e( __VA_ARGS__ );
79 
81 #define GEOSX_DEBUG_VAR( ... ) GEOSX_UNUSED_VAR( __VA_ARGS__ )
82 
84 
85 #if defined(GEOSX_USE_OPENMP)
86 #define PRAGMA_OMP( clause ) _Pragma( clause )
88 // #define PRAGMA_OMP( clause ) _Pragma( STRINGIZE( omp clause ) )
89 #else
90 #define PRAGMA_OMP( clause )
92 #endif
93 
95 #define GEOSX_RESTRICT LVARRAY_RESTRICT
96 
98 #define GEOSX_RESTRICT_THIS LVARRAY_RESTRICT_THIS
99 
101 #define GEOSX_DECLTYPE_AUTO_RETURN decltype( auto )
102 
103 #endif // GEOSX_COMMON_GEOSXMACROS_HPP_
#define GEOSX_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:48
constexpr void i_g_n_o_r_e(ARGS const &...)
Used to silence unused variable warnings, cuda doesn&#39;t respect casting to void.
Definition: GeosxMacros.hpp:75
Contains a bunch of macro definitions.