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
|
#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 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 f32_1_2_3_3
{
Kokkos::View<float*>* data;
dimension_descriptor dims[3];
bool is_allocated;
f32_1_2_3_3(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 i32_6_3_2
{
Kokkos::View<int32_t*>* data;
dimension_descriptor dims[2];
bool is_allocated;
i32_6_3_2(Kokkos::View<int32_t*>* data_): data{data_} {};
};
struct i32_4_3_2_3
{
Kokkos::View<int32_t*>* data;
dimension_descriptor dims[3];
bool is_allocated;
i32_4_3_2_3(Kokkos::View<int32_t*>* data_): data{data_} {};
};
// Forward declarations
namespace {
}
// Implementations
namespace {
void main2() {
bool a;
Kokkos::View<bool[2]>& b;
Kokkos::View<bool[3][2]>& b2;
Kokkos::View<bool[2][1][2]>& b3;
float d;
Kokkos::View<float*> e_data("e_data", 5);
f32_5_1 e_value(&e_data);
f32_5_1* e = &e_value;
e->dims[0].lower_bound = 1;
e->dims[0].length = 5;
Kokkos::View<float*> e2_data("e2_data", 6);
f32_2_3_2 e2_value(&e2_data);
f32_2_3_2* e2 = &e2_value;
e2->dims[0].lower_bound = 1;
e2->dims[0].length = 2;
e2->dims[1].lower_bound = 1;
e2->dims[1].length = 3;
Kokkos::View<float*> e3_data("e3_data", 6);
f32_1_2_3_3 e3_value(&e3_data);
f32_1_2_3_3* e3 = &e3_value;
e3->dims[0].lower_bound = 1;
e3->dims[0].length = 1;
e3->dims[1].lower_bound = 1;
e3->dims[1].length = 2;
e3->dims[2].lower_bound = 1;
e3->dims[2].length = 3;
int32_t f;
Kokkos::View<int32_t*> g_data("g_data", 3);
i32_3_1 g_value(&g_data);
i32_3_1* g = &g_value;
g->dims[0].lower_bound = 1;
g->dims[0].length = 3;
Kokkos::View<int32_t*> g2_data("g2_data", 18);
i32_6_3_2 g2_value(&g2_data);
i32_6_3_2* g2 = &g2_value;
g2->dims[0].lower_bound = 1;
g2->dims[0].length = 6;
g2->dims[1].lower_bound = 1;
g2->dims[1].length = 3;
Kokkos::View<int32_t*> g3_data("g3_data", 24);
i32_4_3_2_3 g3_value(&g3_data);
i32_4_3_2_3* g3 = &g3_value;
g3->dims[0].lower_bound = 1;
g3->dims[0].length = 4;
g3->dims[1].lower_bound = 1;
g3->dims[1].length = 3;
g3->dims[2].lower_bound = 1;
g3->dims[2].length = 2;
}
}
int main(int argc, char* argv[])
{
Kokkos::initialize(argc, argv);
main2();
Kokkos::finalize();
return 0;
}
|