This file is indexed.

/usr/include/trilinos/Kokkos_Concepts.hpp is in libtrilinos-kokkos-dev 12.10.1-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
/*
//@HEADER
// ************************************************************************
//
//                        Kokkos v. 2.0
//              Copyright (2014) Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact  H. Carter Edwards (hcedwar@sandia.gov)
//
// ************************************************************************
//@HEADER
*/

#ifndef KOKKOS_CORE_CONCEPTS_HPP
#define KOKKOS_CORE_CONCEPTS_HPP

#include <type_traits>

// Needed for 'is_space<S>::host_mirror_space
#include <Kokkos_Core_fwd.hpp>

//----------------------------------------------------------------------------
//----------------------------------------------------------------------------

namespace Kokkos {

//Schedules for Execution Policies
struct Static {};
struct Dynamic {};

//Schedule Wrapper Type
template<class T>
struct Schedule
{
  static_assert(  std::is_same<T,Static>::value
               || std::is_same<T,Dynamic>::value
               , "Kokkos: Invalid Schedule<> type."
               );
  using schedule_type = Schedule ;
  using type = T;
};

//Specify Iteration Index Type
template<typename T>
struct IndexType
{
  static_assert(std::is_integral<T>::value,"Kokkos: Invalid IndexType<>.");
  using index_type = IndexType ;
  using type = T;
};

} // namespace Kokkos

//----------------------------------------------------------------------------
//----------------------------------------------------------------------------

namespace Kokkos {

#define KOKKOS_IMPL_IS_CONCEPT( CONCEPT ) \
  template< typename T > struct is_ ## CONCEPT { \
  private: \
    template< typename , typename = std::true_type > struct have : std::false_type {}; \
    template< typename U > struct have<U,typename std::is_same<U,typename U:: CONCEPT >::type> : std::true_type {}; \
  public: \
    enum { value = is_ ## CONCEPT::template have<T>::value }; \
  };

// Public concept:

KOKKOS_IMPL_IS_CONCEPT( memory_space )
KOKKOS_IMPL_IS_CONCEPT( memory_traits )
KOKKOS_IMPL_IS_CONCEPT( execution_space )
KOKKOS_IMPL_IS_CONCEPT( execution_policy )
KOKKOS_IMPL_IS_CONCEPT( array_layout )

namespace Impl {

// For backward compatibility:

using Kokkos::is_memory_space ;
using Kokkos::is_memory_traits ;
using Kokkos::is_execution_space ;
using Kokkos::is_execution_policy ;
using Kokkos::is_array_layout ;

// Implementation concept:

KOKKOS_IMPL_IS_CONCEPT( iteration_pattern )
KOKKOS_IMPL_IS_CONCEPT( schedule_type )
KOKKOS_IMPL_IS_CONCEPT( index_type )

}

#undef KOKKOS_IMPL_IS_CONCEPT

} // namespace Kokkos

//----------------------------------------------------------------------------

namespace Kokkos {

template< class ExecutionSpace , class MemorySpace >
struct Device {
  static_assert( Kokkos::is_execution_space<ExecutionSpace>::value
               , "Execution space is not valid" );
  static_assert( Kokkos::is_memory_space<MemorySpace>::value
               , "Memory space is not valid" );
  typedef ExecutionSpace                        execution_space;
  typedef MemorySpace                           memory_space;
  typedef Device<execution_space,memory_space>  device_type;
};


template< typename T >
struct is_space {
private:

  template< typename , typename = void >
  struct exe : std::false_type { typedef void space ; };

  template< typename , typename = void >
  struct mem : std::false_type { typedef void space ; };

  template< typename , typename = void >
  struct dev : std::false_type { typedef void space ; };

  template< typename U >
  struct exe<U,typename std::conditional<true,void,typename U::execution_space>::type>
    : std::is_same<U,typename U::execution_space>::type
    { typedef typename U::execution_space space ; };

  template< typename U >
  struct mem<U,typename std::conditional<true,void,typename U::memory_space>::type>
    : std::is_same<U,typename U::memory_space>::type
    { typedef typename U::memory_space space ; };

  template< typename U >
  struct dev<U,typename std::conditional<true,void,typename U::device_type>::type>
    : std::is_same<U,typename U::device_type>::type
    { typedef typename U::device_type space ; };

  typedef typename is_space::template exe<T> is_exe ;
  typedef typename is_space::template mem<T> is_mem ;
  typedef typename is_space::template dev<T> is_dev ;

public:

  enum { value = is_exe::value || is_mem::value || is_dev::value };

  typedef typename is_exe::space execution_space ;
  typedef typename is_mem::space memory_space ;

  // For backward compatibility, deprecated in favor of
  // Kokkos::Impl::HostMirror<S>::host_mirror_space

  typedef typename std::conditional
    < std::is_same< memory_space , Kokkos::HostSpace >::value
#if defined( KOKKOS_HAVE_CUDA )
      || std::is_same< memory_space , Kokkos::CudaUVMSpace >::value
      || std::is_same< memory_space , Kokkos::CudaHostPinnedSpace >::value
#endif /* #if defined( KOKKOS_HAVE_CUDA ) */
    , memory_space
    , Kokkos::HostSpace
    >::type  host_memory_space ;

#if defined( KOKKOS_HAVE_CUDA )
  typedef typename std::conditional
    < std::is_same< execution_space , Kokkos::Cuda >::value
    , Kokkos::DefaultHostExecutionSpace , execution_space
    >::type  host_execution_space ;
#else
  typedef execution_space  host_execution_space ;
#endif

  typedef typename std::conditional
    < std::is_same< execution_space , host_execution_space >::value &&
      std::is_same< memory_space ,    host_memory_space    >::value
    , T , Kokkos::Device< host_execution_space , host_memory_space >
    >::type  host_mirror_space ;
};

// For backward compatiblity

namespace Impl {

using Kokkos::is_space ;

}

} // namespace Kokkos

//----------------------------------------------------------------------------

namespace Kokkos {
namespace Impl {

/**\brief  Access relationship between DstMemorySpace and SrcMemorySpace
 *
 *  The default case can assume accessibility for the same space.
 *  Specializations must be defined for different memory spaces.
 */
template< typename DstMemorySpace , typename SrcMemorySpace >
struct MemorySpaceAccess {

  static_assert( Kokkos::is_memory_space< DstMemorySpace >::value &&
                 Kokkos::is_memory_space< SrcMemorySpace >::value
               , "template arguments must be memory spaces" );

  /**\brief  Can a View (or pointer) to memory in SrcMemorySpace
   *         be assigned to a View (or pointer) to memory marked DstMemorySpace.
   *
   *  1. DstMemorySpace::execution_space == SrcMemorySpace::execution_space
   *  2. All execution spaces that can access DstMemorySpace can also access
   *     SrcMemorySpace.
   */
  enum { assignable = std::is_same<DstMemorySpace,SrcMemorySpace>::value };

  /**\brief  For all DstExecSpace::memory_space == DstMemorySpace
   *         DstExecSpace can access SrcMemorySpace.
   */
  enum { accessible = assignable };

  /**\brief  Does a DeepCopy capability exist
   *         to DstMemorySpace from SrcMemorySpace
   */
  enum { deepcopy = assignable };
};


/**\brief  Can AccessSpace access MemorySpace ?
 *
 *   Requires:
 *     Kokkos::is_space< AccessSpace >::value
 *     Kokkos::is_memory_space< MemorySpace >::value
 *
 *   Can AccessSpace::execution_space access MemorySpace ?
 *     enum : bool { accessible };
 *
 *   Is View<AccessSpace::memory_space> assignable from View<MemorySpace> ?
 *     enum : bool { assignable };
 *
 *   If ! accessible then through which intercessory memory space
 *   should a be used to deep copy memory for
 *     AccessSpace::execution_space
 *   to get access.
 *   When AccessSpace::memory_space == Kokkos::HostSpace
 *   then space is the View host mirror space.
 */
template< typename AccessSpace , typename MemorySpace >
struct SpaceAccessibility {
private:

  static_assert( Kokkos::is_space< AccessSpace >::value
               , "template argument #1 must be a Kokkos space" );

  static_assert( Kokkos::Impl::MemorySpaceAccess
                   < typename AccessSpace::execution_space::memory_space
                   , typename AccessSpace::memory_space >::value
               , "template argument #1 is an invalid space" );

  static_assert( Kokkos::is_memory_space< MemorySpace >::value
               , "template argument #2 must be a Kokkos memory space" );

  typedef Kokkos::Impl::MemorySpaceAccess
    < typename AccessSpace::execution_space::memory_space , MemorySpace >
      exe_access ;

  typedef Kokkos::Impl::MemorySpaceAccess
    < typename AccessSpace::memory_space , MemorySpace >
      mem_access ;

public:

  /**\brief  Can AccessSpace::execution_space access MemorySpace ?
   *
   *  Default based upon memory space accessibility.
   *  Specialization required for other relationships.
   */
  enum { accessible = exe_access::accessible };

  /**\brief  Can assign to AccessSpace from MemorySpace ?
   *
   *  Default based upon memory space accessibility.
   *  Specialization required for other relationships.
   */
  enum { assignable =
    is_memory_space< AccessSpace >::value && mem_access::assignable };

  /**\brief  Can deep copy to AccessSpace::memory_Space from MemorySpace ?  */
  enum { deepcopy = mem_access::deepcopy };

  // What intercessory space for AccessSpace::execution_space
  // to be able to access MemorySpace?
  // If same memory space or not accessible use the AccessSpace
  // else construct a device with execution space and memory space.
  typedef typename std::conditional
    < std::is_same<typename AccessSpace::memory_space,MemorySpace>::value ||
      ! exe_access::accessible
    , AccessSpace
    , Kokkos::Device< typename AccessSpace::execution_space , MemorySpace >
    >::type  space ;
};

}} // namespace Kokkos::Impl

//----------------------------------------------------------------------------

#endif // KOKKOS_CORE_CONCEPTS_HPP