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
|
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <cmath>
#include <complex>
#include <Kokkos_Core.hpp>
#include <lfortran_intrinsics.h>
template <typename T>
Kokkos::View<T*> from_std_vector(const std::vector<T> &v)
{
Kokkos::View<T*> r("r", v.size());
for (size_t i=0; i < v.size(); i++) {
r(i) = v[i];
}
return r;
}
struct dimension_descriptor
{
int32_t lower_bound, length, stride;
};
struct f32_5_1
{
Kokkos::View<float*>* data;
dimension_descriptor dims[1];
bool is_allocated;
f32_5_1(Kokkos::View<float*>* data_): data{data_} {};
};
struct i32_3_1
{
Kokkos::View<int32_t*>* data;
dimension_descriptor dims[1];
bool is_allocated;
i32_3_1(Kokkos::View<int32_t*>* data_): data{data_} {};
};
struct f32_2_3_2
{
Kokkos::View<float*>* data;
dimension_descriptor dims[2];
bool is_allocated;
f32_2_3_2(Kokkos::View<float*>* data_): data{data_} {};
};
struct i32_3_4_2
{
Kokkos::View<int32_t*>* data;
dimension_descriptor dims[2];
bool is_allocated;
i32_3_4_2(Kokkos::View<int32_t*>* data_): data{data_} {};
};
struct f32_2_3_4_3
{
Kokkos::View<float*>* data;
dimension_descriptor dims[3];
bool is_allocated;
f32_2_3_4_3(Kokkos::View<float*>* data_): data{data_} {};
};
struct i32_3_4_3_3
{
Kokkos::View<int32_t*>* data;
dimension_descriptor dims[3];
bool is_allocated;
i32_3_4_3_3(Kokkos::View<int32_t*>* data_): data{data_} {};
};
// Forward declarations
namespace {
}
// Implementations
namespace {
void main2() {
Kokkos::View<float*> a_data("a_data", 5);
f32_5_1 a_value(&a_data);
f32_5_1* a = &a_value;
a->dims[0].lower_bound = 1;
a->dims[0].length = 5;
Kokkos::View<float*> b_data("b_data", 5);
f32_5_1 b_value(&b_data);
f32_5_1* b = &b_value;
b->dims[0].lower_bound = 1;
b->dims[0].length = 5;
Kokkos::View<int32_t*> c_data("c_data", 3);
i32_3_1 c_value(&c_data);
i32_3_1* c = &c_value;
c->dims[0].lower_bound = 1;
c->dims[0].length = 3;
Kokkos::View<bool[2]>& d;
Kokkos::View<float*> e_data("e_data", 6);
f32_2_3_2 e_value(&e_data);
f32_2_3_2* e = &e_value;
e->dims[0].lower_bound = 1;
e->dims[0].length = 2;
e->dims[1].lower_bound = 1;
e->dims[1].length = 3;
Kokkos::View<int32_t*> f_data("f_data", 12);
i32_3_4_2 f_value(&f_data);
i32_3_4_2* f = &f_value;
f->dims[0].lower_bound = 1;
f->dims[0].length = 3;
f->dims[1].lower_bound = 1;
f->dims[1].length = 4;
Kokkos::View<bool[5][2]>& g;
Kokkos::View<float*> h_data("h_data", 24);
f32_2_3_4_3 h_value(&h_data);
f32_2_3_4_3* h = &h_value;
h->dims[0].lower_bound = 1;
h->dims[0].length = 2;
h->dims[1].lower_bound = 1;
h->dims[1].length = 3;
h->dims[2].lower_bound = 1;
h->dims[2].length = 4;
Kokkos::View<int32_t*> i_data("i_data", 36);
i32_3_4_3_3 i_value(&i_data);
i32_3_4_3_3* i = &i_value;
i->dims[0].lower_bound = 1;
i->dims[0].length = 3;
i->dims[1].lower_bound = 1;
i->dims[1].length = 4;
i->dims[2].lower_bound = 1;
i->dims[2].length = 3;
Kokkos::View<bool[5][2][2]>& j;
}
}
int main(int argc, char* argv[])
{
Kokkos::initialize(argc, argv);
main2();
Kokkos::finalize();
return 0;
}
|