YAKL
YAKL_intrinsics_size.h
Go to the documentation of this file.
1 
2 #pragma once
3 // Included by YAKL_intrinsics.h
4 
6 namespace yakl {
7  namespace intrinsics {
8 
9  template <class T> YAKL_INLINE int size(T const &arr, int dim) {
10  #ifdef YAKL_DEBUG
11  if (!allocated(arr)) yakl_throw("ERROR: Calling size on an unallocated array");
12  #endif
13  return arr.get_dimensions()(dim);
14  }
15 
16  template <class T> YAKL_INLINE int size(T const &arr) {
17  #ifdef YAKL_DEBUG
18  if (!allocated(arr)) yakl_throw("ERROR: Calling size on an unallocated array");
19  #endif
20  return arr.totElems();
21  }
22 
23  }
24 }
26 
yakl::intrinsics::size
YAKL_INLINE int size(T const &arr, int dim)
Definition: YAKL_intrinsics_size.h:9
yakl::intrinsics::allocated
YAKL_INLINE bool allocated(T const &arr)
Definition: YAKL_intrinsics_allocated.h:9
__YAKL_NAMESPACE_WRAPPER_END__
#define __YAKL_NAMESPACE_WRAPPER_END__
Definition: YAKL.h:20
__YAKL_NAMESPACE_WRAPPER_BEGIN__
#define __YAKL_NAMESPACE_WRAPPER_BEGIN__
Definition: YAKL.h:19
YAKL_INLINE
#define YAKL_INLINE
Used to decorate functions called from kernels (parallel_for and parallel_outer) or from CPU function...
Definition: YAKL_defines.h:140
yakl::yakl_throw
YAKL_INLINE void yakl_throw(const char *msg)
Throw an error message. Works from the host or device.
Definition: YAKL_error.h:17
yakl