Go to the documentation of this file.
54 template <
class T,
int rank,
int myMem>
59 typedef typename std::remove_cv<T>::type
type;
76 this->myData =
nullptr;
77 this->refCount =
nullptr;
78 for (
int i=0; i < rank; i++) { this->lbounds[i] = 1; this->dimension[i] = 0; }
80 this->myname=
"Uninitialized";
125 static_assert( rank == 1 ,
"ERROR: Calling constructor with 1 bound on non-rank-1 array" );
131 static_assert( rank == 2 ,
"ERROR: Calling constructor with 2 bound on non-rank-2 array" );
138 static_assert( rank == 3 ,
"ERROR: Calling constructor with 3 bound on non-rank-3 array" );
146 static_assert( rank == 4 ,
"ERROR: Calling constructor with 4 bound on non-rank-4 array" );
155 static_assert( rank == 5 ,
"ERROR: Calling constructor with 5 bound on non-rank-5 array" );
165 static_assert( rank == 6 ,
"ERROR: Calling constructor with 6 bound on non-rank-6 array" );
176 static_assert( rank == 7 ,
"ERROR: Calling constructor with 7 bound on non-rank-7 array" );
188 static_assert( rank == 8 ,
"ERROR: Calling constructor with 8 bound on non-rank-8 array" );
193 static_assert( rank >= 1 && rank <= 8 ,
"ERROR: Creating Array with a rank < 1 or > 8" );
196 if ( bnds.
size() < rank ) {
yakl_throw(
"ERROR: Number of array bounds specified is < rank"); }
200 this->myname = label;
202 for (
int i=0; i < rank; i++) { this->lbounds[i] = bnds[i].l; this->dimension[i] = bnds[i].u - bnds[i].l + 1; }
235 static_assert( rank == 1 ,
"ERROR: Calling constructor with 1 bound on non-rank-1 array" );
241 static_assert( rank == 2 ,
"ERROR: Calling constructor with 2 bound on non-rank-2 array" );
248 static_assert( rank == 3 ,
"ERROR: Calling constructor with 3 bound on non-rank-3 array" );
256 static_assert( rank == 4 ,
"ERROR: Calling constructor with 4 bound on non-rank-4 array" );
265 static_assert( rank == 5 ,
"ERROR: Calling constructor with 5 bound on non-rank-5 array" );
275 static_assert( rank == 6 ,
"ERROR: Calling constructor with 6 bound on non-rank-6 array" );
285 Bnd b7 ) :
Array(label,data,
Bnds(b1,b2,b3,b4,b5,b6,b7)) {
286 static_assert( rank == 7 ,
"ERROR: Calling constructor with 7 bound on non-rank-7 array" );
297 Bnd b8 ) :
Array(label,data,
Bnds(b1,b2,b3,b4,b5,b6,b7,b8)) {
298 static_assert( rank == 8 ,
"ERROR: Calling constructor with 8 bound on non-rank-8 array" );
303 static_assert( rank >= 1 && rank <= 8 ,
"ERROR: Creating Array with a rank < 1 or > 8" );
306 if ( bnds.
size() < rank ) {
yakl_throw(
"ERROR: Number of array bounds specified is < rank"); }
307 if (data ==
nullptr)
yakl_throw(
"ERROR: wrapping nullptr with a YAKL Array object");
308 this->myname = label;
310 for (
int i=0; i < rank; i++) { this->lbounds[i] = bnds[i].l; this->dimension[i] = bnds[i].u - bnds[i].l + 1; }
312 this->refCount =
nullptr;
324 copy_constructor_common(rhs);
328 static_assert( std::is_const<T>::value ,
329 "ERROR: Cannot create non-const Array using const Array" );
332 copy_constructor_common(rhs);
338 if constexpr (! std::is_const<T>::value) {
339 if (
this == &rhs) {
return *
this; }
342 copy_constructor_common(rhs);
347 static_assert( std::is_const<T>::value ,
348 "ERROR: Cannot create non-const Array using const Array" );
349 if constexpr (std::is_const<T>::value) {
350 if (
this == &rhs) {
return *
this; }
353 copy_constructor_common(rhs);
358 template <
class TLOC>
360 for (
int i=0; i<rank; i++) {
361 this->lbounds[i] = rhs.lbounds[i]; this->dimension[i] = rhs.dimension[i];
364 this->myname = rhs.myname;
366 this->myData = rhs.myData;
368 this->refCount = rhs.refCount;
369 if (this->refCount !=
nullptr) {
386 for (
int i=0; i<rank; i++) {
387 this->lbounds[i] = rhs.lbounds[i]; this->dimension[i] = rhs.dimension[i];
390 this->myname = rhs.myname;
392 this->myData = rhs.myData;
393 rhs.myData =
nullptr;
395 this->refCount = rhs.refCount;
396 rhs.refCount =
nullptr;
402 if (
this == &rhs) {
return *
this; }
404 for (
int i=0; i<rank; i++) {
405 this->lbounds [i] = rhs.lbounds [i]; this->dimension[i] = rhs.dimension[i];
408 this->myname = rhs.myname;
410 this->myData = rhs.myData;
411 rhs.myData =
nullptr;
413 this->refCount = rhs.refCount;
414 rhs.refCount =
nullptr;
438 this->myData = ir.
data();
440 this->myname = ir.
label();
442 for (
int i=0; i < rank; i++) { this->dimension[i] = ir.
extent(rank-1-i); }
443 if ( (! lower_bounds.empty()) && ( lower_bounds.size() != rank ) )
yakl_throw(
"ERROR: Passed lower bounds of the wrong rank");
444 for (
int i=0; i < rank; i++) { this->lbounds[i] = lower_bounds[i]; }
450 template <
class TLOC = T>
452 std::array<size_t,rank> dimensions;
453 for (
int i=0; i < rank; i++) { dimensions[i] = this->dimension[rank-1-i]; }
457 #ifdef YAKL_MANAGED_MEMORY
481 static_assert( rank == 1 ,
"ERROR: Indexing non-rank-1 array with 1 index" );
485 index_t ind = (i0-this->lbounds[0]);
486 return this->myData[ind];
491 static_assert( rank == 2 ,
"ERROR: Indexing non-rank-2 array with 2 indices" );
495 index_t ind = (i1-this->lbounds[1]) *
496 this->dimension[0] + (i0-this->lbounds[0]) ;
497 return this->myData[ind];
502 static_assert( rank == 3 ,
"ERROR: Indexing non-rank-3 array with 3 indices" );
506 index_t ind = ( (i2-this->lbounds[2]) *
507 this->dimension[1] + (i1-this->lbounds[1]) )*
508 this->dimension[0] + (i0-this->lbounds[0]) ;
509 return this->myData[ind];
514 static_assert( rank == 4 ,
"ERROR: Indexing non-rank-4 array with 4 indices" );
518 index_t ind = (( (i3-this->lbounds[3]) *
519 this->dimension[2] + (i2-this->lbounds[2]) )*
520 this->dimension[1] + (i1-this->lbounds[1]) )*
521 this->dimension[0] + (i0-this->lbounds[0]) ;
522 return this->myData[ind];
527 static_assert( rank == 5 ,
"ERROR: Indexing non-rank-5 array with 5 indices" );
529 check(i0,i1,i2,i3,i4);
531 index_t ind = ((( (i4-this->lbounds[4]) *
532 this->dimension[3] + (i3-this->lbounds[3]) )*
533 this->dimension[2] + (i2-this->lbounds[2]) )*
534 this->dimension[1] + (i1-this->lbounds[1]) )*
535 this->dimension[0] + (i0-this->lbounds[0]) ;
536 return this->myData[ind];
541 static_assert( rank == 6 ,
"ERROR: Indexing non-rank-6 array with 6 indices" );
543 check(i0,i1,i2,i3,i4,i5);
545 index_t ind = (((( (i5-this->lbounds[5]) *
546 this->dimension[4] + (i4-this->lbounds[4]) )*
547 this->dimension[3] + (i3-this->lbounds[3]) )*
548 this->dimension[2] + (i2-this->lbounds[2]) )*
549 this->dimension[1] + (i1-this->lbounds[1]) )*
550 this->dimension[0] + (i0-this->lbounds[0]) ;
551 return this->myData[ind];
556 static_assert( rank == 7 ,
"ERROR: Indexing non-rank-7 array with 7 indices" );
558 check(i0,i1,i2,i3,i4,i5,i6);
560 index_t ind = ((((( (i6-this->lbounds[6]) *
561 this->dimension[5] + (i5-this->lbounds[5]) )*
562 this->dimension[4] + (i4-this->lbounds[4]) )*
563 this->dimension[3] + (i3-this->lbounds[3]) )*
564 this->dimension[2] + (i2-this->lbounds[2]) )*
565 this->dimension[1] + (i1-this->lbounds[1]) )*
566 this->dimension[0] + (i0-this->lbounds[0]) ;
567 return this->myData[ind];
572 static_assert( rank == 8 ,
"ERROR: Indexing non-rank-8 array with 8 indices" );
574 check(i0,i1,i2,i3,i4,i5,i6,i7);
576 index_t ind = (((((( (i7-this->lbounds[7]) *
577 this->dimension[6] + (i6-this->lbounds[6]) )*
578 this->dimension[5] + (i5-this->lbounds[5]) )*
579 this->dimension[4] + (i4-this->lbounds[4]) )*
580 this->dimension[3] + (i3-this->lbounds[3]) )*
581 this->dimension[2] + (i2-this->lbounds[2]) )*
582 this->dimension[1] + (i1-this->lbounds[1]) )*
583 this->dimension[0] + (i0-this->lbounds[0]) ;
584 return this->myData[ind];
589 YAKL_INLINE void check(
int i0,
int i1=1,
int i2=1,
int i3=1,
int i4=1,
int i5=1,
590 int i6=1,
int i7=1)
const {
592 if (! this->initialized()) {
yakl_throw(
"Error: Using operator() on an Array that isn't allocated"); }
593 if constexpr (rank >= 1) {
if (i0 < this->lbounds[0] || i0 >= this->lbounds[0]+this->dimension[0]) ind_out_bounds<0>(i0); }
594 if constexpr (rank >= 2) {
if (i1 < this->lbounds[1] || i1 >= this->lbounds[1]+this->dimension[1]) ind_out_bounds<1>(i1); }
595 if constexpr (rank >= 3) {
if (i2 < this->lbounds[2] || i2 >= this->lbounds[2]+this->dimension[2]) ind_out_bounds<2>(i2); }
596 if constexpr (rank >= 4) {
if (i3 < this->lbounds[3] || i3 >= this->lbounds[3]+this->dimension[3]) ind_out_bounds<3>(i3); }
597 if constexpr (rank >= 5) {
if (i4 < this->lbounds[4] || i4 >= this->lbounds[4]+this->dimension[4]) ind_out_bounds<4>(i4); }
598 if constexpr (rank >= 6) {
if (i5 < this->lbounds[5] || i5 >= this->lbounds[5]+this->dimension[5]) ind_out_bounds<5>(i5); }
599 if constexpr (rank >= 7) {
if (i6 < this->lbounds[6] || i6 >= this->lbounds[6]+this->dimension[6]) ind_out_bounds<6>(i6); }
600 if constexpr (rank >= 8) {
if (i7 < this->lbounds[7] || i7 >= this->lbounds[7]+this->dimension[7]) ind_out_bounds<7>(i7); }
601 #if defined(YAKL_SEPARATE_MEMORY_SPACE)
603 #
if !defined(YAKL_MANAGED_MEMORY)
606 std::cerr <<
"ERROR: For Array labeled: " << this->myname <<
":" << std::endl;
607 yakl_throw(
"Device array being accessed on the host without managed memory turned on");
622 std::cerr <<
"ERROR: For Array labeled: " << this->myname <<
":" << std::endl;
623 std::cerr <<
"Index " << I+1 <<
" of " << rank <<
" is out of bounds. Provided index: " << ind
624 <<
". Lower Bound: " << this->lbounds[I] <<
". Upper Bound: " << this->dimension[I]-1 << std::endl;
632 template <class TLOC, typename std::enable_if<std::is_arithmetic<TLOC>::value,
bool>::type =
false>
640 template <
class TLOC>
641 void memset_loc(TLOC rhs)
const {
643 #ifdef YAKL_ENABLE_STREAMS
647 #ifdef YAKL_ENABLE_STREAMS
651 for (
int i=0; i < this->totElems(); i++) { this->myData[i] = rhs; }
664 if (! this->initialized()) {
yakl_throw(
"ERROR: Trying to subset_slowest_dimension an Array that hasn't been initialized"); }
665 if (l < lbounds[rank-1]) {
yakl_throw(
"ERROR: subset_slowest_dimension lower bound too low"); }
666 if (u < lbounds[rank-1]) {
yakl_throw(
"ERROR: subset_slowest_dimension upper bound too low"); }
667 if (l > u) {
yakl_throw(
"ERROR: subset_slowest_dimension lower bound > upper bounds"); }
668 if (u >= this->lbounds[rank-1]+this->dimension[rank-1]) {
yakl_throw(
"ERROR: subset_slowest_dimension upper bound too high"); }
671 auto &lb = this->lbounds;
672 auto &d = this->dimension;
673 if constexpr (rank == 1) ret.myData += (l-lb[rank-1]);
674 if constexpr (rank == 2) ret.myData += (l-lb[rank-1])*d[0];
675 if constexpr (rank == 3) ret.myData += (l-lb[rank-1])*d[0]*d[1];
676 if constexpr (rank == 4) ret.myData += (l-lb[rank-1])*d[0]*d[1]*d[2];
677 if constexpr (rank == 5) ret.myData += (l-lb[rank-1])*d[0]*d[1]*d[2]*d[3];
678 if constexpr (rank == 6) ret.myData += (l-lb[rank-1])*d[0]*d[1]*d[2]*d[3]*d[4];
679 if constexpr (rank == 7) ret.myData += (l-lb[rank-1])*d[0]*d[1]*d[2]*d[3]*d[4]*d[5];
680 if constexpr (rank == 8) ret.myData += (l-lb[rank-1])*d[0]*d[1]*d[2]*d[3]*d[4]*d[5]*d[6];
681 ret.dimension[rank-1] = u-l+1;
712 if (rank != dims.
size()) {
714 yakl_throw(
"ERROR: rank must be equal to dims.size()");
716 for (
int i=N; i<rank; i++) {
717 if (dims.data[i] < this->lbounds[i] || dims.data[i] >= this->lbounds[i]+this->dimension[i] ) {
719 yakl_throw(
"ERROR: One of the slicing dimension dimensions is out of bounds");
722 if (! this->initialized()) {
724 yakl_throw(
"ERROR: calling slice() on an Array that hasn't been allocated");
729 for (
int i=0; i<N; i++) {
730 ret.dimension[i] = this->dimension[i];
731 ret.lbounds [i] = this->lbounds [i];
732 offset *= this->dimension[i];
735 for (
int i=N; i<rank; i++) {
736 retOff += (dims.data[i]-this->lbounds[i])*offset;
737 offset *= this->dimension[i];
739 ret.myData = &(this->myData[retOff]);
742 ret.refCount = this->refCount;
743 if (this->refCount !=
nullptr) {
744 (*(this->refCount))++;
753 static_assert( rank == 1 ,
"ERROR: Calling slice() with 1 index on a non-rank-1 array" );
754 static_assert( N <= rank ,
"ERROR: Calling slice() with more dimenions than this array's rank" );
755 return slice<N>(
Dims(i0) );
760 static_assert( rank == 2 ,
"ERROR: Calling slice() with 2 index on a non-rank-2 array" );
761 static_assert( N <= rank ,
"ERROR: Calling slice() with more dimenions than this array's rank" );
762 return slice<N>(
Dims(i0,i1) );
767 static_assert( rank == 3 ,
"ERROR: Calling slice() with 3 index on a non-rank-3 array" );
768 static_assert( N <= rank ,
"ERROR: Calling slice() with more dimenions than this array's rank" );
769 return slice<N>(
Dims(i0,i1,i2) );
774 static_assert( rank == 4 ,
"ERROR: Calling slice() with 4 index on a non-rank-4 array" );
775 static_assert( N <= rank ,
"ERROR: Calling slice() with more dimenions than this array's rank" );
776 return slice<N>(
Dims(i0,i1,i2,i3) );
782 static_assert( rank == 5 ,
"ERROR: Calling slice() with 5 index on a non-rank-5 array" );
783 static_assert( N <= rank ,
"ERROR: Calling slice() with more dimenions than this array's rank" );
784 return slice<N>(
Dims(i0,i1,i2,i3,i4) );
789 int i4,
int i5 )
const {
790 static_assert( rank == 6 ,
"ERROR: Calling slice() with 6 index on a non-rank-6 array" );
791 static_assert( N <= rank ,
"ERROR: Calling slice() with more dimenions than this array's rank" );
792 return slice<N>(
Dims(i0,i1,i2,i3,i4,i5) );
797 int i4,
int i5,
int i6 )
const {
798 static_assert( rank == 7 ,
"ERROR: Calling slice() with 7 index on a non-rank-7 array" );
799 static_assert( N <= rank ,
"ERROR: Calling slice() with more dimenions than this array's rank" );
800 return slice<N>(
Dims(i0,i1,i2,i3,i4,i5,i6) );
805 int i4,
int i5,
int i6,
int i7 )
const {
806 static_assert( rank == 8 ,
"ERROR: Calling slice() with 8 index on a non-rank-8 array" );
807 static_assert( N <= rank ,
"ERROR: Calling slice() with more dimenions than this array's rank" );
808 return slice<N>(
Dims(i0,i1,i2,i3,i4,i5,i6,i7) );
840 if (! this->initialized()) {
yakl_throw(
"ERROR: Trying to reshape an Array that hasn't been initialized"); }
841 if (bnds.
size() != N) {
yakl_throw(
"ERROR: new number of reshaped array dimensions does not match the templated rank"); }
843 for (
int i=0; i < N; i++) { totelems *= (bnds.u[i]-bnds.l[i]+1); }
844 if (totelems != this->totElems()) {
yakl_throw(
"ERROR: Total number of reshaped array elements is not consistent with this array"); }
847 for (
int i=0; i < N; i++) {
848 ret.dimension[i] = bnds.u[i] - bnds.l[i] + 1; ret.lbounds [i] = bnds.l[i];
851 ret.myname = this->myname;
853 ret.myData = this->myData;
856 ret.refCount = this->refCount;
857 if (this->refCount !=
nullptr) {
858 (*(this->refCount))++;
878 YAKL_INLINE Array<T,5,myMem,styleFortran> reshape(
Bnd b0,
Bnd b1,
Bnd b2,
Bnd b3,
Bnd b4 )
const {
return reshape<5>(
Bnds(b0,b1,b2,b3,b4) ); }
881 YAKL_INLINE Array<T,6,myMem,styleFortran> reshape(
Bnd b0,
Bnd b1,
Bnd b2,
Bnd b3,
Bnd b4,
Bnd b5 )
const {
return reshape<6>(
Bnds(b0,b1,b2,b3,b4,b5) ); }
884 YAKL_INLINE Array<T,7,myMem,styleFortran> reshape(
Bnd b0,
Bnd b1,
Bnd b2,
Bnd b3,
Bnd b4,
Bnd b5,
Bnd b6 )
const {
return reshape<7>(
Bnds(b0,b1,b2,b3,b4,b5,b6) ); }
887 YAKL_INLINE Array<T,8,myMem,styleFortran> reshape(
Bnd b0,
Bnd b1,
Bnd b2,
Bnd b3,
Bnd b4,
Bnd b5,
Bnd b6,
Bnd b7)
const {
return reshape<8>(
Bnds(b0,b1,b2,b3,b4,b5,b6,b7) ); }
904 if (! this->initialized()) {
yakl_throw(
"ERROR: Trying to collapse an Array that hasn't been initialized"); }
907 ret.dimension[0] = this->totElems(); ret.lbounds [0] = lbnd;
909 ret.myname = this->myname;
911 ret.myData = this->myData;
914 ret.refCount = this->refCount;
915 if (this->refCount !=
nullptr) {
916 (*(this->refCount))++;
937 template <
class TLOC=T>
939 auto ret = createHostObject();
940 this->copy_inform(ret);
943 if (stream.is_default_stream()) {
fence(); }
944 else { stream.fence(); }
956 template <class TLOC=typename std::remove_cv<T>::type>
959 if (! this->initialized()) {
961 yakl_throw(
"Error: createHostCopy() called on an Array that hasn't been allocated.");
966 for (
int i=0; i<rank; i++) { ret.lbounds[i] = this->lbounds[i]; ret.dimension[i] = this->dimension[i]; }
968 ret.myname = this->myname;
988 template <
class TLOC=T>
990 auto ret = createDeviceObject();
991 this->copy_inform(ret);
994 if (stream.is_default_stream()) {
fence(); }
995 else { stream.fence(); }
1007 template <class TLOC=typename std::remove_cv<T>::type>
1010 if (! this->initialized()) {
1012 yakl_throw(
"Error: createHostCopy() called on an Array that hasn't been allocated.");
1017 for (
int i=0; i<rank; i++) { ret.lbounds[i] = this->lbounds[i]; ret.dimension[i] = this->dimension[i]; }
1019 ret.myname = this->myname;
1032 for (
int i=0; i<rank; i++) { ret(i+1) = this->dimension[i]; }
1040 for (
int i=0; i<rank; i++) { ret(i+1) = this->lbounds[i]; }
1048 for (
int i=0; i<rank; i++) { ret(i+1) = this->lbounds[i]+this->dimension[i]-1; }
1056 if (dim < 0 || dim > rank-1)
yakl_throw(
"ERROR: calling extent() with an out of bounds index");
1058 return this->dimension[dim];
YAKL_INLINE Array(char const *label, T *data, Bnd b1)
1-D non-owned constructor
Definition: YAKL_FArray.h:234
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(int i0) const
Array slice of 1-D array.
Definition: YAKL_FArray.h:752
YAKL_INLINE Array(Array< non_const_value_type, rank, myMem, styleFortran > const &rhs)
Copy metadata, share data pointer; if owned, increment reference counter. No deep copy.
Definition: YAKL_FArray.h:321
YAKL_INLINE FSArray< index_t, 1, SB< rank > > get_dimensions() const
Returns the dimensions of this array as a yakl::FSArray object.
Definition: YAKL_FArray.h:1030
#define YAKL_EXECUTE_ON_DEVICE_ONLY(...)
[NOT COMMONLY USED] Macro function used to determine if the current code is compiling for the device.
Definition: YAKL_defines.h:158
YAKL_INLINE int size() const
Get the number of dimensions.
Definition: YAKL_Array.h:340
YAKL_INLINE FSArray< int, 1, SB< rank > > get_lbounds() const
Returns the lower bound of each dimension of this array as a yakl::FSArray object.
Definition: YAKL_FArray.h:1038
constexpr int memDevice
Specifies a device memory address space for a yakl::Array object.
Definition: YAKL_memory_spaces.h:13
YAKL_INLINE Array(char const *label, T *data, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5, Bnd b6, Bnd b7, Bnd b8)
8-D non-owned constructor
Definition: YAKL_FArray.h:290
constexpr int MEMORY_SHARED
Declares that the data pointer is defined in both host and device memory.
Definition: ArrayIR.h:18
YAKL_INLINE Array & operator=(Array &&rhs)
Move metadata and data pointer. No deep copy.
Definition: YAKL_FArray.h:401
array_ir::ArrayIR< TLOC, rank > create_ArrayIR() const
Create an ArrayIR object from this FArray object for easy interoperability with other C++ portability...
Definition: YAKL_FArray.h:451
YAKL_INLINE Array< T, 7, myMem, styleFortran > reshape(Bnd b0, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5, Bnd b6) const
Reshape array into a 7-D array.
Definition: YAKL_FArray.h:884
YAKL_INLINE Array(char const *label, T *data, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5)
5-D non-owned constructor
Definition: YAKL_FArray.h:260
Array< TLOC, rank, memDevice, styleFortran > createDeviceCopy(Stream stream=Stream()) const
[DEEP_COPY] Create a copy of this array in yakl::memDevice space
Definition: YAKL_FArray.h:989
YAKL_INLINE Array(char const *label, Bnd b1)
1-D owned constructor
Definition: YAKL_FArray.h:124
YAKL_INLINE Array(Array &&rhs)
Move metadata and data pointer. No deep copy.
Definition: YAKL_FArray.h:383
YAKL_INLINE Array(char const *label, Bnds bnds)
Generic initializer-list or std::vector based owned constructor.
Definition: YAKL_FArray.h:192
Implements the functionality of a stream for parallel kernel execution. If the Stream::create() metho...
Definition: YAKL_streams_events.h:394
YAKL_INLINE Array(char const *label, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5, Bnd b6, Bnd b7, Bnd b8)
8-D owned constructor
Definition: YAKL_FArray.h:180
YAKL_INLINE T & operator()(int i0, int i1, int i2, int i3) const
Return reference to element at the requested index (4-D)
Definition: YAKL_FArray.h:513
Array< typename std::remove_cv< TLOC >::type, rank, memDevice, styleFortran > createDeviceObject() const
Create and allocate a yakl::memDevice array object of the same type, rank, dimensions,...
Definition: YAKL_FArray.h:1008
YAKL_INLINE Array< T, N, myMem, styleFortran > reshape(Bnds const &bnds) const
Reshape array using initializer list or std::vector indices.
Definition: YAKL_FArray.h:838
YAKL_INLINE T & operator()(int i0, int i1) const
Return reference to element at the requested index (2-D)
Definition: YAKL_FArray.h:490
Array< TLOC, rank, memHost, styleFortran > createHostCopy(Stream stream=Stream()) const
[DEEP_COPY] Create a copy of this array in yakl::memHost space
Definition: YAKL_FArray.h:938
YAKL_INLINE Array(char const *label, Bnd b1, Bnd b2, Bnd b3, Bnd b4)
4-D owned constructor
Definition: YAKL_FArray.h:142
Array< typename std::remove_cv< TLOC >::type, rank, memHost, styleFortran > createHostObject() const
Create and allocate a yakl::memHost array object of the same type, rank, dimensions,...
Definition: YAKL_FArray.h:957
T value_type
This is the type T exactly as it was defined upon array object creation.
Definition: YAKL_FArray.h:61
YAKL_INLINE index_t extent(int dim) const
Returns the extent of the requested dimension of this array.
Definition: YAKL_FArray.h:1054
#define __YAKL_NAMESPACE_WRAPPER_END__
Definition: YAKL.h:20
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7) const
Array slice of 8-D array.
Definition: YAKL_FArray.h:804
YAKL_INLINE Array(char const *label)
Create an empty, unallocated object with a label.
Definition: YAKL_FArray.h:92
YAKL_INLINE Array(char const *label, Bnd b1, Bnd b2, Bnd b3)
3-D owned constructor
Definition: YAKL_FArray.h:135
constexpr int MEMORY_HOST
Declares that the data pointer is defined only in host memory.
Definition: ArrayIR.h:14
void memcpy_host_to_device(T1 *dst, T2 *src, index_t elems, Stream stream=Stream())
[USE AT YOUR OWN RISK]: memcpy the specified number of elements from host to device
Definition: YAKL_mem_transfers.h:85
YAKL_INLINE Array(char const *label, T *data, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5, Bnd b6, Bnd b7)
7-D non-owned constructor
Definition: YAKL_FArray.h:279
YAKL_INLINE Array()
Create an empty, unallocated object.
Definition: YAKL_FArray.h:88
Array operator=(TLOC const &rhs) const
[ASYNCHRONOUS] Assign a scalar arithmetic value to all entries in this array object
Definition: YAKL_FArray.h:633
YAKL_INLINE Array(char const *label, T *data, Bnd b1, Bnd b2, Bnd b3, Bnd b4)
4-D non-owned constructor
Definition: YAKL_FArray.h:252
constexpr int MEMORY_DEVICE
Declares that the data pointer is defined only in device memory.
Definition: ArrayIR.h:16
YAKL_INLINE Array< T, 6, myMem, styleFortran > reshape(Bnd b0, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5) const
Reshape array into a 6-D array.
Definition: YAKL_FArray.h:881
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(int i0, int i1, int i2, int i3, int i4, int i5) const
Array slice of 6-D array.
Definition: YAKL_FArray.h:788
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(int i0, int i1) const
Array slice of 2-D array.
Definition: YAKL_FArray.h:759
YAKL_INLINE Array< T, rank, myMem, styleFortran > subset_slowest_dimension(int l, int u) const
Return an array aliasing a contiguous subset of the slowest dimension.
Definition: YAKL_FArray.h:662
#define __YAKL_NAMESPACE_WRAPPER_BEGIN__
Definition: YAKL.h:19
YAKL_INLINE Array< T, 3, myMem, styleFortran > reshape(Bnd b0, Bnd b1, Bnd b2) const
Reshape array into a 3-D array.
Definition: YAKL_FArray.h:872
YAKL_INLINE ~Array()
If owned, decrement reference counter, and deallocate data when it reaches zero. If non-owned,...
Definition: YAKL_FArray.h:425
YAKL_INLINE Array(char const *label, T *data, Bnd b1, Bnd b2)
2-D non-owned constructor
Definition: YAKL_FArray.h:239
Describes a single bound for creating Fortran-style yakl::Array objects.
Definition: YAKL_Array.h:177
#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_INLINE Array< T, 8, myMem, styleFortran > reshape(Bnd b0, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5, Bnd b6, Bnd b7) const
Reshape array into a 8-D array.
Definition: YAKL_FArray.h:887
The ArrayIR class holds library-agnostic Array metadata to make it easy to transfer array objects bet...
Definition: ArrayIR.h:39
YAKL_INLINE Array(char const *label, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5)
5-D owned constructor
Definition: YAKL_FArray.h:150
YAKL_INLINE Array(char const *label, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5, Bnd b6)
6-D owned constructor
Definition: YAKL_FArray.h:159
YAKL_INLINE int size() const
Get the number of dimensions.
Definition: YAKL_Array.h:166
void fence()
Block the host code until all device code has completed.
Definition: YAKL_fence.h:16
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(int i0, int i1, int i2) const
Array slice of 3-D array.
Definition: YAKL_FArray.h:766
YAKL_INLINE T & operator()(int i0) const
Return reference to element at the requested index (1-D)
Definition: YAKL_FArray.h:480
YAKL_INLINE FSArray< int, 1, SB< rank > > get_ubounds() const
Returns the upper bound of each dimension of this array as a yakl::FSArray object.
Definition: YAKL_FArray.h:1046
YAKL_INLINE Array< T, 1, myMem, styleFortran > collapse(int lbnd=1) const
Collapse this array into a 1-D array.
Definition: YAKL_FArray.h:902
#define YAKL_EXECUTE_ON_HOST_ONLY(...)
[NOT COMMONLY USED] Macro function used to determine if the current code is compiling for the host.
Definition: YAKL_defines.h:153
unsigned int index_t
Definition: YAKL.h:41
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(int i0, int i1, int i2, int i3, int i4) const
Array slice of 5-D array.
Definition: YAKL_FArray.h:780
YAKL_INLINE Array(Array< const_value_type, rank, myMem, styleFortran > const &rhs)
Copy metadata, share data pointer; if owned, increment reference counter. No deep copy.
Definition: YAKL_FArray.h:327
YAKL_INLINE void yakl_throw(const char *msg)
Throw an error message. Works from the host or device.
Definition: YAKL_error.h:17
void memcpy_host_to_host(T1 *dst, T2 *src, index_t elems)
[USE AT YOUR OWN RISK]: memcpy the specified number of elements on the host
Definition: YAKL_mem_transfers.h:20
This implements the yakl:Array class with yakl::styleFortran behavior.
Definition: YAKL_FArray.h:55
const char * label() const
Get the label for this array.
Definition: ArrayIR.h:117
std::add_const< type >::type const_value_type
This is the type T with const added to it.
Definition: YAKL_FArray.h:64
This class holds C-style dimensions for using in yakl::Array objects.
Definition: YAKL_Array.h:50
bool data_valid_on_device() const
Determine if the data pointer is valid on the device.
Definition: ArrayIR.h:127
This declares the yakl::Array class. Please see the yakl::styleC and yakl::styleFortran template spec...
Definition: YAKL_Array.h:40
void memcpy_device_to_device(T1 *dst, T2 *src, index_t elems, Stream stream=Stream())
[USE AT YOUR OWN RISK]: memcpy the specified number of elements on the device
Definition: YAKL_mem_transfers.h:119
Array(array_ir::ArrayIR< T, rank > const &ir, std::vector< int > lower_bounds=std::vector< int >())
Construct this FArray object from an ArrayIR object for easy interoperability with other C++ portabil...
Definition: YAKL_FArray.h:434
YAKL_INLINE T & operator()(int i0, int i1, int i2) const
Return reference to element at the requested index (3-D)
Definition: YAKL_FArray.h:501
YAKL_INLINE Array(char const *label, T *data, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5, Bnd b6)
6-D non-owned constructor
Definition: YAKL_FArray.h:269
YAKL_INLINE Array(char const *label, Bnd b1, Bnd b2, Bnd b3, Bnd b4, Bnd b5, Bnd b6, Bnd b7)
7-D owned constructor
Definition: YAKL_FArray.h:169
YAKL_INLINE T & operator()(int i0, int i1, int i2, int i3, int i4, int i5, int i6) const
Return reference to element at the requested index (7-D)
Definition: YAKL_FArray.h:555
size_t extent(int i) const
Get the extent of the dimension of the provided index.
Definition: ArrayIR.h:108
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(int i0, int i1, int i2, int i3) const
Array slice of 4-D array.
Definition: YAKL_FArray.h:773
constexpr int styleFortran
Template parameter for yakl::Array that specifies it should follow Fortran-style behavior.
Definition: YAKL_Array.h:22
T * data() const
Get the data pointer.
Definition: ArrayIR.h:102
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(int i0, int i1, int i2, int i3, int i4, int i5, int i6) const
Array slice of 7-D array.
Definition: YAKL_FArray.h:796
void memcpy_device_to_host(T1 *dst, T2 *src, index_t elems, Stream stream=Stream())
[USE AT YOUR OWN RISK]: memcpy the specified number of elements from device to host
Definition: YAKL_mem_transfers.h:51
std::remove_const< type >::type non_const_value_type
This is the type T with const removed from it.
Definition: YAKL_FArray.h:67
YAKL_INLINE Array(char const *label, T *data, Bnd b1, Bnd b2, Bnd b3)
3-D non-owned constructor
Definition: YAKL_FArray.h:245
This class holds Fortran-style dimensions for using in creating yakl::Array objects.
Definition: YAKL_Array.h:200
bool data_valid_on_host() const
Determine if the data pointer is valid on the host.
Definition: ArrayIR.h:125
YAKL_INLINE Array(char const *label, T *data, Bnds bnds)
Generic initializer-list or std::vector based owned constructor.
Definition: YAKL_FArray.h:302
YAKL_INLINE T & operator()(int i0, int i1, int i2, int i3, int i4) const
Return reference to element at the requested index (5-D)
Definition: YAKL_FArray.h:526
YAKL_INLINE T & operator()(int i0, int i1, int i2, int i3, int i4, int i5) const
Return reference to element at the requested index (6-D)
Definition: YAKL_FArray.h:540
YAKL_INLINE Array< T, rank, myMem, styleFortran > subset_slowest_dimension(int u) const
Return an array aliasing a contiguous subset of the slowest dimension. Retuns the same array with the...
Definition: YAKL_FArray.h:658
YAKL_INLINE Array< T, N, myMem, styleFortran > slice(Dims const &dims) const
Array slice using initializer list or std::vector indices.
Definition: YAKL_FArray.h:710
YAKL_INLINE T & operator()(int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7) const
Return reference to element at the requested index (8-D)
Definition: YAKL_FArray.h:571
YAKL_INLINE Array< T, 5, myMem, styleFortran > reshape(Bnd b0, Bnd b1, Bnd b2, Bnd b3, Bnd b4) const
Reshape array into a 5-D array.
Definition: YAKL_FArray.h:878
YAKL_INLINE Array & operator=(Array< const_value_type, rank, myMem, styleFortran > const &rhs)
Copy metadata, share data pointer; if owned, increment reference counter. No deep copy.
Definition: YAKL_FArray.h:346
YAKL_INLINE Array(char const *label, Bnd b1, Bnd b2)
2-D owned constructor
Definition: YAKL_FArray.h:129
YAKL_INLINE Array< T, 4, myMem, styleFortran > reshape(Bnd b0, Bnd b1, Bnd b2, Bnd b3) const
Reshape array into a 4-D array.
Definition: YAKL_FArray.h:875
This class implements functionality common to both yakl::styleC and yakl::styleFortran Array objects.
Definition: YAKL_ArrayBase.h:24
YAKL_INLINE Array & operator=(Array< non_const_value_type, rank, myMem, styleFortran > const &rhs)
Copy metadata, share data pointer; if owned, increment reference counter. No deep copy.
Definition: YAKL_FArray.h:337
YAKL_INLINE Array< T, 1, myMem, styleFortran > reshape(Bnd b0) const
Reshape array into a 1-D array.
Definition: YAKL_FArray.h:866
YAKL_INLINE Array< T, 2, myMem, styleFortran > reshape(Bnd b0, Bnd b1) const
Reshape array into a 2-D array.
Definition: YAKL_FArray.h:869
Fortran-style array on the stack similar in nature to, e.g., float arr[ny][nx];
Definition: YAKL_FSArray.h:53
constexpr int memHost
Specifies a device memory address space for a yakl::Array object.
Definition: YAKL_memory_spaces.h:15
std::remove_cv< T >::type type
This is the type T without const and volatile modifiers.
Definition: YAKL_FArray.h:59