Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_DisableKokkosCuda.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Sacado Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25 // (etphipp@sandia.gov).
26 //
27 // ***********************************************************************
28 // @HEADER
29 
30 #ifndef SACADO_DISABLE_KOKKOS_CUDA_HPP
31 #define SACADO_DISABLE_KOKKOS_CUDA_HPP
32 
33 //
34 // Include this file in any translation unit to disable the use of Sacado
35 // classes on Cuda. Several Sacado classes (e.g., Sacado::Fad::GeneralFad)
36 // are setup to work with Kokkos, but don't work with Cuda with some choices
37 // of their template parameters. However
38 // if Cuda is enabled then __device__ is added to the KOKKOS_*_FUNCTION macros
39 // which prevents these classes from compiling. By including this file, the
40 // __device__ annotation will be removed allowing these classes to be compiled
41 // by NVCC for host code.
42 //
43 
44 // Include definitions of KOKKOS_*_FUNCTION macros
45 #include "Sacado_ConfigDefs.h"
46 
47 // Redefine KOKKOS_*_FUNCTION macros to not include __device__
48 #if defined(HAVE_SACADO_KOKKOSCORE) && defined(KOKKOS_ENABLE_CUDA)
49 
50 #undef KOKKOS_FUNCTION
51 #undef KOKKOS_INLINE_FUNCTION
52 #undef KOKKOS_FORCEINLINE_FUNCTION
53 
54 #define KOKKOS_FUNCTION /* */
55 #define KOKKOS_INLINE_FUNCTION inline
56 #define KOKKOS_FORCEINLINE_FUNCTION inline
57 
58 #define SACADO_DISABLE_CUDA_IN_KOKKOS 1
59 
60 #endif
61 
62 
63 #endif // SACADO_DISABLE_KOKKOS_CUDA_HPP