FasTensor  1.0.0
Transform Supercomputing for AI
ft_stencil.h
Go to the documentation of this file.
1 
2 
3 /*
4 ****************************
5 
6 FasTensor (FT) Copyright (c) 2021, The Regents of the University of
7 California, through Lawrence Berkeley National Laboratory (subject to
8 receipt of any required approvals from the U.S. Dept. of Energy).
9 All rights reserved.
10 
11 If you have questions about your rights to use or distribute this software,
12 please contact Berkeley Lab's Intellectual Property Office at
14 
15 NOTICE. This Software was developed under funding from the U.S. Department
16 of Energy and the U.S. Government consequently retains certain rights. As
17 such, the U.S. Government has been granted for itself and others acting on
18 its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the
19 Software to reproduce, distribute copies to the public, prepare derivative
20 works, and perform publicly and display publicly, and to permit others to do so.
21 
22 
23 ****************************
24 
25 
26 *** License Agreement ***
27 
28 FasTensor (FT) Copyright (c) 2021, The Regents of the University of
29 California, through Lawrence Berkeley National Laboratory (subject to
30 receipt of any required approvals from the U.S. Dept. of Energy).
31 All rights reserved.
32 
33 Redistribution and use in source and binary forms, with or without
34 modification, are permitted provided that the following conditions are met:
35 
36 (1) Redistributions of source code must retain the above copyright notice,
37 this list of conditions and the following disclaimer.
38 
39 (2) Redistributions in binary form must reproduce the above copyright
40 notice, this list of conditions and the following disclaimer in the
41 documentation and/or other materials provided with the distribution.
42 
43 (3) Neither the name of the University of California, Lawrence Berkeley
44 National Laboratory, U.S. Dept. of Energy nor the names of its contributors
45 may be used to endorse or promote products derived from this software
46 without specific prior written permission.
47 
48 
49 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
50 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
53 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
54 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
55 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
56 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
57 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
58 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
59 POSSIBILITY OF SUCH DAMAGE.
60 
61 You are under no obligation whatsoever to provide any bug fixes, patches,
62 or upgrades to the features, functionality or performance of the source
63 code ("Enhancements") to anyone; however, if you choose to make your
64 Enhancements available either publicly, or directly to Lawrence Berkeley
65 National Laboratory, without imposing a separate written license agreement
66 for such Enhancements, then you hereby grant the following license: a
67 non-exclusive, royalty-free perpetual license to install, use, modify,
68 prepare derivative works, incorporate into other computer software,
69 distribute, and sublicense such enhancements or derivative works thereof,
70 in binary and source code form.
71 */
72 
82 #ifndef SDS_UDF_STENCIL
83 #define SDS_UDF_STENCIL
84 
85 #include "mpi.h"
86 #include <string>
87 #include <iostream>
88 #include <vector>
89 #include <cmath>
90 #include <stdlib.h>
91 #include "ft_utility.h"
92 #include "ft_array_view_access.h"
93 #include "ft_utility.h"
94 
95 using namespace std;
97 
98 template <class T>
99 class Stencil
100 {
101 private:
102  T value;
103  int has_set_output_value_flag = false;
104  std::vector<unsigned long long> my_location; //This is the coodinate with overlapping
105  std::vector<unsigned long long> my_location_no_ol;
106  std::vector<unsigned long long> global_coordinate;
107  unsigned long long global_coordinate_lineared;
108 
109  unsigned long long my_g_location_rm; //lineared form of my coordinates in original big array.
110  unsigned long long chunk_id;
111  T *chunk_data_pointer = NULL;
112  unsigned long long chunk_data_size = 1;
113  unsigned long long chunk_data_size_no_ol = 1;
114  unsigned long long my_offset_no_ol; //for hist
115  std::vector<unsigned long long> chunk_dim_size; //This is the size with over-lapping
116  int dims;
117  //std::vector<int> coordinate_shift;
118  //std::vector<unsigned long long> coordinate;
119 
120  bool trail_run_flag = false; //When rail_run_flag = 1, it records the maximum overlap size
121  mutable std::vector<int> trail_run_overlap_size;
122  //int padding_value_set_flag = 0;
123  //T padding_value;
124  int mpi_rank, mpi_size;
125 
126  std::vector<unsigned long long> global_data_size;
131  bool is_output_vector_flag;
132  std::vector<size_t> output_vector_shape;
133  OutputVectorFlatDirection output_vector_flat_direction;
134 
135  //padding value
136  bool has_padding_value_flag = false;
137  T padding_value;
138 
139  bool is_stencil_tag = false;
140  std::map<std::string, std::string> stencil_tag_map;
141 
142 public:
143  //For test only
144  Stencil(){};
145 
146  // For trail run
147  Stencil(int dims_input, T *chunk)
148  {
149  dims = dims_input;
150  //coordinate_shift.resize(dims_input);
151  //coordinate.resize(dims_input);
152  chunk_data_pointer = chunk;
153  //et_trail_run_flag();
154  trail_run_flag = true;
155  trail_run_overlap_size.resize(dims_input);
156  std::fill(trail_run_overlap_size.begin(), trail_run_overlap_size.end(), 0);
157  }
158 
165  Stencil(T value_p)
166  {
167  value = value_p;
168  }
169 
178  Stencil(T value_p, std::vector<size_t> shape_p)
179  {
180  value = value_p;
181  is_output_vector_flag = true;
182  output_vector_shape = shape_p;
183  }
184 
185  //For production
186  Stencil(unsigned long long my_offset, T *chunk, std::vector<unsigned long long> &my_coordinate, std::vector<unsigned long long> &chunk_size, std::vector<unsigned long long> &global_data_size_p)
187  {
188 #ifdef DEBUG
189  MpiRankSize(&mpi_rank, &mpi_size);
190  std::cout << "my value =" << value << ", coordinate = (" << my_coordinate[0] << ", " << my_coordinate[1] << " )" << std::endl;
191 #endif
192  chunk_data_pointer = chunk;
193  dims = chunk_size.size();
194  chunk_dim_size.resize(dims);
195  my_location.resize(dims);
196  global_data_size.resize(dims);
197  //coordinate_shift.resize(dims);
198  //coordinate.resize(dims);
199  chunk_data_size = 1;
200  for (int i = 0; i < dims; i++)
201  {
202  chunk_data_size = chunk_data_size * chunk_size[i];
203  chunk_dim_size[i] = chunk_size[i];
204  my_location[i] = my_coordinate[i];
205  global_data_size[i] = global_data_size_p[i];
206  }
207 
208  chunk_data_size = chunk_data_size - 1;
209  if (my_offset > chunk_data_size)
210  {
211  std::cout << "Error in intializing Stencil(). my_offset = " << my_offset << ", chunk_data_size = " << chunk_data_size << std::endl;
212  exit(-1);
213  }
214  else
215  {
216  value = chunk[my_offset];
217  }
218  };
219 
221  {
222  /*if (coordinate_shift != NULL)
223  free(coordinate_shift);
224  if (coordinate != NULL)
225  free(coordinate);*/
226  }
227 
228  //The followings are inline functions to overload () operator on Stencils
229  //It accepts offsets (i1, i2, i3, ...) and return the values at these offsets.
230  //So fat, we define the function for 1D, 2D, 3D seperately.
231  //TO DO: more flexiable arguments to support any dimensions.
232 
233  /*
234  //1D
235  inline T &operator()(const int i1) const
236  {
237 
238  std::vector<int> coordinate_shift(1);
239  std::vector<unsigned long long> coordinate(1);
240 
241  coordinate_shift[0] = i1;
242  for (int i = 0; i < 1; i++)
243  {
244  if (coordinate_shift[i] == 0)
245  {
246  coordinate[i] = my_location[i];
247  }
248  else if (coordinate_shift[i] > 0)
249  {
250  coordinate[i] = my_location[i] + coordinate_shift[i];
251  if (coordinate[i] >= chunk_dim_size[i]) //Check boundary :: Be careful with size overflow
252  coordinate[i] = chunk_dim_size[i] - 1;
253  }
254  else
255  {
256  coordinate[i] = -coordinate_shift[i]; //Convert to unsigned long long
257  if (my_location[i] <= coordinate[i])
258  {
259  coordinate[i] = 0;
260  }
261  else
262  {
263  coordinate[i] = my_location[i] - coordinate[i]; //Check boundary :: Be careful with size overflow
264  }
265  }
266  }
267  if (coordinate[0] <= chunk_data_size)
268  {
269  return chunk_data_pointer[coordinate[0]];
270  }
271  else
272  {
273  std::cout << "Error in operator(). shift_offset=" << coordinate[0] << ",chunk_data_size=" << chunk_data_size << ",chunk_dim_size[]=" << chunk_dim_size[0] << "," << chunk_dim_size[1] << "," << chunk_dim_size[2] << ",my_location[]=" << my_location[0] << "," << my_location[1] << "," << my_location[2] << ", coordinate_shift[]=" << coordinate_shift[0] << "," << coordinate_shift[1] << "," << coordinate_shift[2] << std::endl;
274  exit(-1);
275  }
276  }
277 
278  //2D
279  inline T operator()(const int i1, const int i2) const
280  {
281  std::vector<int> coordinate_shift(2);
282  std::vector<unsigned long long> coordinate(2);
283 
284  if (trail_run_flag == 1)
285  {
286  if (std::abs(i1) > coordinate_shift[0])
287  coordinate_shift[0] = std::abs(i1);
288  if (std::abs(i2) > coordinate_shift[1])
289  coordinate_shift[1] = std::abs(i2);
290  return chunk_data_pointer[0];
291  }
292 
293  if (i1 == 0 && i2 == 0)
294  return value;
295 
296  //if(mpi_rank == 0) PrintVector("At rank 0, in (), chunk_dim_size=", chunk_dim_size);
297  coordinate_shift[0] = i1;
298  coordinate_shift[1] = i2;
299  for (int i = 0; i < 2; i++)
300  {
301  //if(chunk_dim_size[i] > 768 ) {printf("At mpi_rank %d , Warning in runing () operator's chunk size = %lld \n ", mpi_rank, chunk_dim_size[i]); fflush(stdout); exit(-1);}
302  if (coordinate_shift[i] == 0)
303  {
304  coordinate[i] = my_location[i];
305  }
306  else if (coordinate_shift[i] > 0)
307  {
308  coordinate[i] = my_location[i] + coordinate_shift[i];
309  if (coordinate[i] >= chunk_dim_size[i]) //Check boundary :: Be careful with size overflow
310  coordinate[i] = chunk_dim_size[i] - 1;
311  }
312  else
313  {
314  coordinate[i] = -coordinate_shift[i]; //Convert to unsigned long long
315  if (my_location[i] <= coordinate[i])
316  {
317  coordinate[i] = 0;
318  }
319  else
320  {
321  coordinate[i] = my_location[i] - coordinate[i]; //Check boundary :: Be careful with size overflow
322  }
323  }
324  }
325  unsigned long long shift_offset = coordinate[0];
326  for (int i = 1; i < 2; i++)
327  {
328  shift_offset = shift_offset * chunk_dim_size[i] + coordinate[i];
329  }
330  if (shift_offset <= chunk_data_size)
331  {
332  return chunk_data_pointer[shift_offset];
333  }
334  else
335  {
336  std::cout << "MPI Rank = " << mpi_rank << ", Error in 2D operator(). shift_offset=" << shift_offset << ",chunk_data_size=" << chunk_data_size << ",chunk_dim_size[]=" << chunk_dim_size[0] << "," << chunk_dim_size[1] << ", my_location[]=" << my_location[0] << "," << my_location[1] << ", coordinate_shift[]=" << coordinate_shift[0] << "," << coordinate_shift[1] << std::endl;
337  exit(-1);
338  }
339  }
340 
341  //3D
342  inline T &operator()(const int i1, const int i2, const int i3) const
343  {
344  std::vector<int> coordinate_shift(3);
345  std::vector<unsigned long long> coordinate(3);
346 
347  if (trail_run_flag == 1)
348  {
349  if (std::abs(i1) > coordinate_shift[0])
350  coordinate_shift[0] = std::abs(i1);
351  if (std::abs(i2) > coordinate_shift[1])
352  coordinate_shift[1] = std::abs(i2);
353  if (std::abs(i3) > coordinate_shift[2])
354  coordinate_shift[2] = std::abs(i3);
355 
356  return chunk_data_pointer[0];
357  }
358 
359  coordinate_shift[0] = i1;
360  coordinate_shift[1] = i2;
361  coordinate_shift[2] = i3;
362  for (int i = 0; i < 3; i++)
363  {
364  if (coordinate_shift[i] == 0)
365  {
366  coordinate[i] = my_location[i];
367  }
368  else if (coordinate_shift[i] > 0)
369  {
370  coordinate[i] = my_location[i] + coordinate_shift[i];
371  if (coordinate[i] >= chunk_dim_size[i]) //Check boundary :: Be careful with size overflow
372  coordinate[i] = chunk_dim_size[i] - 1;
373  }
374  else
375  {
376  coordinate[i] = -coordinate_shift[i]; //Convert to unsigned long long
377  if (my_location[i] <= coordinate[i])
378  {
379  coordinate[i] = 0;
380  }
381  else
382  {
383  coordinate[i] = my_location[i] - coordinate[i]; //Check boundary :: Be careful with size overflow
384  }
385  }
386  }
387  unsigned long long shift_offset = coordinate[0];
388  for (int i = 1; i < 3; i++)
389  {
390  shift_offset = shift_offset * chunk_dim_size[i] + coordinate[i];
391  }
392  if (shift_offset <= chunk_data_size)
393  {
394  return chunk_data_pointer[shift_offset];
395  }
396  else
397  {
398  std::cout << "Error in operator(). shift_offset=" << shift_offset << ",chunk_data_size=" << chunk_data_size << ",chunk_dim_size[]=" << chunk_dim_size[0] << "," << chunk_dim_size[1] << "," << chunk_dim_size[2] << ",my_location[]=" << my_location[0] << "," << my_location[1] << "," << my_location[2] << ", coordinate_shift[]=" << coordinate_shift[0] << "," << coordinate_shift[1] << "," << coordinate_shift[2] << std::endl;
399  exit(-1);
400  }
401  }
402 
403  inline T operator()(int i1, int i2, int i3, int i4)
404  {
405  std::vector<int> coordinate_shift(4);
406  std::vector<unsigned long long> coordinate(4);
407 
408  size_t shift_offset = 1;
409  std::cout << "At ArrayUDF_Stencil.h: we does not have the code for 4D offsets yet. You can DIY it by coping above 3D codes." << std::endl;
410  exit(0);
411  }
412  */
413 
414  //Generic version of the ()
415  template <typename... Is>
416  inline T operator()(Is... offsets) const
417  {
418  std::vector<int> ov{{offsets...}};
419  int ov_rank = ov.size();
420  if (dims != ov_rank)
421  {
422  AU_EXIT("The # of offsets " + std::to_string(ov_rank) + " is not equal to the data's: " + std::to_string(dims));
423  }
424 
425  //std::cout << "Call new index ! \n";
426  std::vector<int> coordinate_shift(dims);
427  std::vector<unsigned long long> coordinate(dims);
428 
429  if (trail_run_flag)
430  {
431  for (int i = 0; i < ov_rank; i++)
432  {
433  if (std::abs(ov[i]) > trail_run_overlap_size[i])
434  trail_run_overlap_size[i] = std::abs(ov[i]);
435  }
436  return chunk_data_pointer[0];
437  }
438 
439  for (int i = 0; i < ov_rank; i++)
440  {
441  coordinate_shift[i] = ov[i];
442  if (coordinate_shift[i] == 0)
443  {
444  coordinate[i] = my_location[i];
445  }
446  else if (coordinate_shift[i] > 0)
447  {
448 
449  coordinate[i] = my_location[i] + coordinate_shift[i];
450  if (coordinate[i] >= chunk_dim_size[i])
451  { //Check boundary :: Be careful with size overflow
452  coordinate[i] = chunk_dim_size[i] - 1;
453  //return the padding_value if go beyond boundary and has padding seting
454  if (has_padding_value_flag)
455  {
456  return padding_value;
457  }
458  }
459  }
460  else
461  {
462  coordinate[i] = -coordinate_shift[i]; //Convert to unsigned long long
463  if (my_location[i] < coordinate[i])
464  {
465  //return the padding_value if go beyond boundary and has padding seting
466  if (has_padding_value_flag)
467  {
468  return padding_value;
469  }
470  coordinate[i] = 0;
471  }
472  else
473  {
474  coordinate[i] = my_location[i] - coordinate[i]; //Check boundary :: Be careful with size overflow
475  }
476  }
477  }
478  unsigned long long shift_offset = coordinate[0];
479  for (int i = 1; i < ov_rank; i++)
480  {
481  shift_offset = shift_offset * chunk_dim_size[i] + coordinate[i];
482  }
483 
484  if (shift_offset <= chunk_data_size)
485  {
486  return chunk_data_pointer[shift_offset];
487  }
488  else
489  {
490  PrintVector("ov = ", ov);
491  PrintVector("coordinate = ", coordinate);
492  PrintVector("chunk_dim_size = ", chunk_dim_size);
493  AU_EXIT("Error in operator() of Stencil");
494  }
495  }
496 
497  //Generic version of the ()
498  inline T ReadPoint(std::vector<int> &ov) const
499  {
500  //std::vector<int> ov{{offsets...}};
501  int ov_rank = ov.size();
502  if (dims != ov_rank)
503  {
504  AU_EXIT("The # of offsets " + std::to_string(ov_rank) + " is not equal to the data's: " + std::to_string(dims));
505  }
506 
507  //std::cout << "Call new index ! \n";
508  std::vector<int> coordinate_shift(dims);
509  std::vector<unsigned long long> coordinate(dims);
510 
511  for (int i = 0; i < ov_rank; i++)
512  {
513  coordinate_shift[i] = ov[i];
514  if (coordinate_shift[i] == 0)
515  {
516  coordinate[i] = my_location[i];
517  }
518  else if (coordinate_shift[i] > 0)
519  {
520 
521  coordinate[i] = my_location[i] + coordinate_shift[i];
522  if (coordinate[i] >= chunk_dim_size[i])
523  { //Check boundary :: Be careful with size overflow
524  coordinate[i] = chunk_dim_size[i] - 1;
525  //return the padding_value if go beyond boundary and has padding seting
526  if (has_padding_value_flag)
527  {
528  return padding_value;
529  }
530  }
531  }
532  else
533  {
534  coordinate[i] = -coordinate_shift[i]; //Convert to unsigned long long
535  if (my_location[i] < coordinate[i])
536  {
537  //return the padding_value if go beyond boundary and has padding seting
538  if (has_padding_value_flag)
539  {
540  return padding_value;
541  }
542  coordinate[i] = 0;
543  }
544  else
545  {
546  coordinate[i] = my_location[i] - coordinate[i]; //Check boundary :: Be careful with size overflow
547  }
548  }
549  }
550  unsigned long long shift_offset = coordinate[0];
551  for (int i = 1; i < ov_rank; i++)
552  {
553  shift_offset = shift_offset * chunk_dim_size[i] + coordinate[i];
554  }
555 
556  if (shift_offset <= chunk_data_size)
557  {
558  return chunk_data_pointer[shift_offset];
559  }
560  else
561  {
562  PrintVector("ov = ", ov);
563  PrintVector("coordinate = ", coordinate);
564  PrintVector("chunk_dim_size = ", chunk_dim_size);
565  AU_EXIT("Error in operator() of Stencil");
566  }
567  }
568 
569  template <class TO>
570  inline void operator=(TO &others)
571  {
572  value = others;
573  has_set_output_value_flag = true;
574  }
575 
577  {
578  return has_set_output_value_flag;
579  }
580 
581  void ReadHoodBorder(std::vector<T> &rv, std::vector<int> &start_offset, std::vector<int> &end_offset) const
582  {
583  int rank_temp = start_offset.size();
584  size_t element_count = rv.size();
585 
586  std::vector<unsigned long long> count_size_t(rank_temp);
587  for (int i = 0; i < rank_temp; i++)
588  {
589  count_size_t[i] = (end_offset[i] - start_offset[i] + 1);
590  }
591 
592  if (rank_temp == 1)
593  {
594  for (int iii = start_offset[0]; iii <= end_offset[0]; iii++)
595  {
596  rv[iii] = this->operator()(iii);
597  }
598  }
599 
600  if (rank_temp == 2)
601  {
602  //std::cout << "call out of border\n";
603  for (int iii = start_offset[0]; iii <= end_offset[0]; iii++)
604  {
605  for (int jjj = start_offset[1]; jjj <= end_offset[1]; jjj++)
606  {
607  rv[iii * count_size_t[1] + jjj] = this->operator()(iii, jjj);
608  }
609  }
610  }
611 
612  unsigned long long array_buffer_offset = 0;
613  std::vector<int> ord(start_offset.begin(), start_offset.end());
614  for (unsigned long long i = 0; i < element_count; i++)
615  {
616  //ROW_MAJOR_ORDER_MACRO(chunk_dim_size, chunk_dim_size.size(), ord, array_buffer_offset);
617  // VIEW_ACCESS_HELP_P(view_v, view_buffer_offset, array_v, array_buffer_offset, 1, read_write_code, sizeof(T));
618  rv[i] = ReadPoint(ord);
619  //view_buffer_offset++;
620  ITERATOR_MACRO(ord, start_offset, end_offset); //update ord by increasing "1", row-major order
621  }
622  }
623 
631  inline int ReadNeighbors(std::vector<int> &start_offset, std::vector<int> &end_offset, std::vector<T> &rv) const
632  {
633  //std::vector<T> rv;
634  int rank_temp = start_offset.size();
635  std::vector<size_t> start_offset_size_t, end_offset_size_t;
636  std::vector<unsigned long long> count_size_t;
637  start_offset_size_t.resize(rank_temp);
638  end_offset_size_t.resize(rank_temp);
639  count_size_t.resize(rank_temp);
640 
641  size_t n = 1;
642  for (int i = 0; i < rank_temp; i++)
643  {
644  count_size_t[i] = (end_offset[i] - start_offset[i] + 1);
645  n = n * count_size_t[i];
646  //assert(start_offset[i] >= 0); //ArrayIterator any only process positive offset
647  //assert(end_offset[i] >= 0);
648  start_offset_size_t[i] = start_offset[i];
649  end_offset_size_t[i] = end_offset[i] + 1;
650  }
651 
652  //PrintVector("count_size_t = ", count_size_t);
653  //PrintVector("chunk_dim_size = ", chunk_dim_size);
654 
655  if (count_size_t == chunk_dim_size)
656  {
657  //copy(&dataArray[0], &dataArray[dataArraySize], back_inserter(dataVec));
658  //std::vector<T> rv2(chunk_data_pointer, chunk_data_pointer + n);
659  //std::cout << "read all ! n = " << n << std::endl;
660  //return rv2;
661  std::copy(&chunk_data_pointer[0], &chunk_data_pointer[n], back_inserter(rv));
662  return 0;
663  }
664 
665  rv.resize(n);
666 
667  std::vector<unsigned long long> view_start(rank_temp), view_end(rank_temp);
668  bool out_of_border = false;
669  for (int ii = 0; ii < rank_temp; ii++)
670  {
671  view_start[ii] = my_location[ii] + start_offset[ii];
672  view_end[ii] = my_location[ii] + end_offset[ii];
673  if (view_end[ii] > (chunk_dim_size[ii] - 1))
674  {
675  out_of_border = true;
676  }
677  }
678  //ArrayViewAccess(rv.data(), chunk_data_pointer, chunk_dim_size, view_start, view_end, ARRAY_VIEW_READ, sizeof(T));
679 
680  //PrintVector("view_start = ", view_start);
681  //PrintVector("view_end = ", view_end);
682  //PrintVector("chunk_dim_size = ", chunk_dim_size);
683 
684  //we may go to use the () operator
685  if (out_of_border)
686  {
687  ReadHoodBorder(rv, start_offset, end_offset);
688  return 0;
689  }
690 
691  ArrayViewAccessP<T>(rv.data(), chunk_data_pointer, chunk_dim_size, view_start, view_end, ARRAY_VIEW_READ);
692  return 0;
693  }
701  inline std::vector<T> ReadNeighbors(std::vector<int> &start_offset, std::vector<int> &end_offset) const
702  {
703  std::vector<T> rv;
704  int rank_temp = start_offset.size();
705  std::vector<size_t> start_offset_size_t, end_offset_size_t;
706  std::vector<unsigned long long> count_size_t;
707  start_offset_size_t.resize(rank_temp);
708  end_offset_size_t.resize(rank_temp);
709  count_size_t.resize(rank_temp);
710 
711  size_t n = 1;
712  for (int i = 0; i < rank_temp; i++)
713  {
714  count_size_t[i] = (end_offset[i] - start_offset[i] + 1);
715  n = n * count_size_t[i];
716  assert(start_offset[i] >= 0); //ArrayIterator any only process positive offset
717  assert(end_offset[i] >= 0);
718  start_offset_size_t[i] = start_offset[i];
719  end_offset_size_t[i] = end_offset[i] + 1;
720  }
721 
722  if (count_size_t == chunk_dim_size)
723  {
724  std::vector<T> rv2(chunk_data_pointer, chunk_data_pointer + n);
725  //std::cout << "read all !" << std::endl;
726  return rv2;
727  }
728 
729  rv.resize(n);
730 
731  std::vector<unsigned long long> view_start(rank_temp), view_end(rank_temp);
732  bool out_of_border = false;
733  for (int ii = 0; ii < rank_temp; ii++)
734  {
735  view_start[ii] = my_location[ii] + start_offset[ii];
736  view_end[ii] = my_location[ii] + end_offset[ii];
737  if (view_end[ii] > (chunk_dim_size[ii] - 1))
738  {
739  out_of_border = true;
740  }
741  }
742  //ArrayViewAccess(rv.data(), chunk_data_pointer, chunk_dim_size, view_start, view_end, ARRAY_VIEW_READ, sizeof(T));
743 
744  //PrintVector("view_start = ", view_start);
745  //PrintVector("view_end = ", view_end);
746  //PrintVector("chunk_dim_size = ", chunk_dim_size);
747 
748  //we may go to use the () operator
749  if (out_of_border)
750  {
751  ReadHoodBorder(rv, start_offset, end_offset);
752  return rv;
753  }
754 
755  ArrayViewAccessP<T>(rv.data(), chunk_data_pointer, chunk_dim_size, view_start, view_end, ARRAY_VIEW_READ);
756  return rv;
757 
758  //ArrayViewAccess();
759 
760  //inline int ArrayViewAccess(void *view_buffer, void *array_buffer, std::vector<unsigned long long> &array_size, std::vector<unsigned long long> &start, std::vector<unsigned long long> &end, int read_write_code, int element_size);
761  //size_t offset, rv_offset = 0;
762  //std::vector<size_t> coordinate;
763  //coordinate.resize(rank_temp);
764 
765  /*
766  for (ArrayIterator<size_t> c(start_offset_size_t, end_offset_size_t); c; ++c)
767  {
768  //PrintVector("ArrayIterator_c: ", c);
769  for (int j = 0; j < rank_temp; j++)
770  {
771  coordinate[j] = my_location[j] + c[j];
772  if (coordinate[j] >= chunk_dim_size[j]) //Check boundary :: Be careful with size overflow
773  coordinate[j] = chunk_dim_size[j] - 1;
774  }
775 
776  ROW_MAJOR_ORDER_MACRO(chunk_dim_size, rank_temp, coordinate, offset);
777  assert(offset <= chunk_data_size);
778  rv[rv_offset] = chunk_data_pointer[offset];
779  rv_offset = rv_offset + 1;
780  }*/
781 
782  /*
783  std::vector<int> coordinate_iterate(start_offset.begin(), start_offset.end());
784 
785  for (size_t ii = 0; ii < n; ii++)
786  {
787  //PrintVector("ArrayIterator_c: ", c);
788  for (int j = 0; j < rank_temp; j++)
789  {
790  coordinate[j] = my_location[j] + coordinate_iterate[j];
791  if (coordinate[j] >= chunk_dim_size[j]) //Check boundary :: Be careful with size overflow
792  coordinate[j] = chunk_dim_size[j] - 1;
793  }
794 
795  ROW_MAJOR_ORDER_MACRO(chunk_dim_size, rank_temp, coordinate, offset);
796  assert(offset <= chunk_data_size);
797  rv[rv_offset] = chunk_data_pointer[offset];
798  rv_offset = rv_offset + 1;
799 
800  ITERATOR_MACRO(coordinate_iterate, start_offset, end_offset);
801  }*/
802 
803  return rv;
804  }
805 
814  int WriteNeighbors(std::vector<int> &start_offset, std::vector<int> &end_offset, std::vector<T> &data) const
815  {
816  int rank_temp = start_offset.size();
817  /*std::vector<size_t> start_offset_size_t, end_offset_size_t;
818  start_offset_size_t.resize(rank_temp);
819  end_offset_size_t.resize(rank_temp);
820  size_t n = 1;
821  for (int i = 0; i < rank_temp; i++)
822  {
823  n = n * (end_offset[i] - start_offset[i] + 1);
824  assert(start_offset[i] >= 0); //ArrayIterator any only process positive offset
825  assert(end_offset[i] >= 0);
826  start_offset_size_t[i] = start_offset[i];
827  end_offset_size_t[i] = end_offset[i] + 1;
828  }*/
829 
830  std::vector<unsigned long long> view_start(rank_temp), view_end(rank_temp);
831  for (int ii = 0; ii < rank_temp; ii++)
832  {
833  view_start[ii] = my_location[ii] + start_offset[ii];
834  view_end[ii] = my_location[ii] + end_offset[ii];
835  }
836  //ArrayViewAccess(data.data(), chunk_data_pointer, chunk_dim_size, view_start, view_end, ARRAY_VIEW_WRITE, sizeof(T));
837  ArrayViewAccessP<T>(data.data(), chunk_data_pointer, chunk_dim_size, view_start, view_end, ARRAY_VIEW_WRITE);
838  /*
839  size_t offset, rv_offset = 0;
840  std::vector<size_t> coordinate;
841  coordinate.resize(rank_temp);
842  for (ArrayIterator<size_t> c(start_offset_size_t, end_offset_size_t); c; ++c)
843  {
844  for (int j = 0; j < rank_temp; j++)
845  {
846  coordinate[j] = my_location[j] + c[j];
847  if (coordinate[j] >= chunk_dim_size[j]) //Check boundary :: Be careful with size overflow
848  coordinate[j] = chunk_dim_size[j] - 1;
849  }
850  ROW_MAJOR_ORDER_MACRO(chunk_dim_size, rank_temp, coordinate, offset);
851  assert(offset <= chunk_data_size);
852  chunk_data_pointer[offset] = data[rv_offset];
853  rv_offset = rv_offset + 1;
854  }*/
855 
856  return 0;
857  }
858 
865  {
866  return value;
867  }
868 
874  void set_value(const T value_p)
875  {
876  value = value_p;
877  }
878 
885  {
886  return value;
887  }
888 
889  int GetValue(T &value_p)
890  {
891  value_p = value;
892  return 0;
893  }
894 
900  int SetValue(const T value_p)
901  {
902  value = value_p;
903  }
904 
905  unsigned long long get_local_neighbors_count_at_left() const
906  {
907  return chunk_data_size_no_ol - my_offset_no_ol;
908  }
909 
910  //Rightnow, for the 1D data
911  /* T get_next_neighbor(){ */
912  /* //calculate next point along row-major order */
913  /* //find the value */
914 
915  /* std::vector<unsigned long long> next_coodinate; */
916  /* unsigned long long next_pos; */
917  /* next_coodinate = RowMajorOrderReverse(n_location, chunk_dim_size_no_ol); */
918 
919  /* //Get the coodinate with overlapping */
920  /* for (int ii=0; ii < dims; ii++){ */
921  /* if (next_coodinate[ii] + ol_origin_offset[ii] < chunk_dim_size[ii]){ */
922  /* next_coodinate[ii] = next_coodinate[ii] + ol_origin_offset[ii]; */
923  /* }else{ */
924  /* next_coodinate[ii] = chunk_dim_size[ii]-1; */
925  /* } */
926  /* } */
927  /* next_pos = RowMajorOrder(chunk_dim_size, next_coodinate); */
928  /* n_location = n_location + 1; */
929  /* if(n_location > chunk_data_size_no_ol){ */
930  /* n_at_end_flag = 1; */
931  /* } */
932  /* return chunk_data_pointer[next_pos]; */
933  /* } */
934 
935  //int get_next_at_end_flag(){
936  // return n_at_end_flag;
937  //}
938 
940  {
941  //calculate next point
942  //find the value
943  return value;
944  }
945 
946  void SetLocation(unsigned long long my_offset, std::vector<unsigned long long> &my_coordinate, std::vector<unsigned long long> &my_location_no_ol_p, std::vector<unsigned long long> &chunk_dim_size_no_ol_p, std::vector<long long> ol_origin_offset_p, std::vector<unsigned long long> current_chunk_ol_size)
947  {
948  //value = chunk_data_pointer[my_offset];
949  if (my_offset > chunk_data_size)
950  {
951  std::cout << "Error in intializing Stencil(). my_offset = " << my_offset << ", chunk_data_size = " << chunk_data_size << std::endl;
952  exit(-1);
953  }
954  else
955  {
956  value = chunk_data_pointer[my_offset];
957  }
958 
959  chunk_data_size_no_ol = 1;
960  int rank = my_coordinate.size();
961  for (int i = 0; i < rank; i++)
962  {
963  my_location[i] = my_coordinate[i];
964  my_location_no_ol[i] = my_location_no_ol_p[i];
965  //chunk_dim_size_no_ol[i] = chunk_dim_size_no_ol_p[i];
966  //ol_origin_offset[i] = ol_origin_offset_p[i];
967  chunk_data_size_no_ol = chunk_data_size_no_ol * chunk_dim_size_no_ol_p[i];
968  chunk_dim_size[i] = current_chunk_ol_size[i];
969  }
970  chunk_data_size_no_ol = chunk_data_size_no_ol - 1; //start from 0
971  //my_offset_no_ol = RowMajorOrder(chunk_dim_size_no_ol_p, my_location_no_ol_p) - 1;
972  ROW_MAJOR_ORDER_MACRO(chunk_dim_size_no_ol_p, chunk_dim_size_no_ol_p.size(), my_location_no_ol_p, my_offset_no_ol);
973  my_offset_no_ol = my_offset_no_ol - 1;
974  //p_location = n_location;
975  }
976 
989  void SetLocation(unsigned long long &my_offset, std::vector<unsigned long long> &my_coordinate, std::vector<unsigned long long> &my_location_no_ol_p, std::vector<unsigned long long> &chunk_dim_size_no_ol_p, std::vector<long long> &ol_origin_offset_p, std::vector<unsigned long long> &current_chunk_ol_size, std::vector<unsigned long long> &global_coordinate_p, unsigned long long &global_coordinate_lineared_p)
990  {
991  if (my_offset > chunk_data_size)
992  {
993  std::cout << "Error in intializing Stencil(). my_offset = " << my_offset << ", chunk_data_size = " << chunk_data_size << std::endl;
994  exit(-1);
995  }
996  else
997  {
998  value = chunk_data_pointer[my_offset];
999  }
1000 
1001  chunk_data_size_no_ol = 1;
1002  int rank = my_coordinate.size();
1003  for (int i = 0; i < rank; i++)
1004  {
1005  my_location[i] = my_coordinate[i];
1006  //my_location_no_ol[i] = my_location_no_ol_p[i];
1007  //chunk_dim_size_no_ol[i] = chunk_dim_size_no_ol_p[i];
1008  //ol_origin_offset[i] = ol_origin_offset_p[i];
1009  chunk_data_size_no_ol = chunk_data_size_no_ol * chunk_dim_size_no_ol_p[i];
1010  chunk_dim_size[i] = current_chunk_ol_size[i];
1011  }
1012  chunk_data_size_no_ol = chunk_data_size_no_ol - 1; //start from 0
1013  //my_offset_no_ol = RowMajorOrder(chunk_dim_size_no_ol_p, my_location_no_ol_p) - 1;
1014  ROW_MAJOR_ORDER_MACRO(chunk_dim_size_no_ol_p, chunk_dim_size_no_ol_p.size(), my_location_no_ol_p, my_offset_no_ol);
1015  my_offset_no_ol = my_offset_no_ol - 1;
1016 
1017  my_g_location_rm = global_coordinate_lineared_p;
1018 
1019  global_coordinate = global_coordinate_p;
1020  global_coordinate_lineared = global_coordinate_lineared_p;
1021  }
1022 
1028  std::vector<unsigned long long> GetCoordinate() const
1029  {
1030  return global_coordinate;
1031  }
1032 
1033  std::vector<unsigned long long> GetGlobalCoordinate() const
1034  {
1035  return global_coordinate;
1036  }
1037 
1038  int GetGlobalIndex(std::vector<unsigned long long> &index_p) const
1039  {
1040  index_p = global_coordinate;
1041  return 0;
1042  }
1043 
1044  int GetLocalIndex(std::vector<unsigned long long> &index_p) const
1045  {
1046  //PrintVector("my_location_no_ol = ", my_location);
1047  index_p = my_location;
1048  return 0;
1049  }
1050 
1051  int GetTrailRunResult(std::vector<int> &overlap_size_p)
1052  {
1053  overlap_size_p.resize(trail_run_overlap_size.size());
1054  if (trail_run_flag == 1)
1055  {
1056  for (int i = 0; i < trail_run_overlap_size.size(); i++)
1057  overlap_size_p[i] = trail_run_overlap_size[i];
1058  }
1059  return 0;
1060  }
1061 
1062  /*
1063  void set_trail_run_flag()
1064  {
1065  trail_run_flag = 1;
1066  for (int i = 0; i < dims; i++)
1067  coordinate_shift[i] = 0;
1068  }
1069 
1070  void get_trail_run_result(int *overlap_size)
1071  {
1072  if (trail_run_flag == 1)
1073  {
1074  for (int i = 0; i < dims; i++)
1075  overlap_size[i] = coordinate_shift[i];
1076  trail_run_flag = 0;
1077  }
1078  }*/
1079 
1080  void set_my_g_location_rm(unsigned long long lrm)
1081  {
1082  my_g_location_rm = lrm;
1083  }
1084 
1085  unsigned long long get_my_g_location_rm() const
1086  {
1087  return my_g_location_rm;
1088  }
1089 
1090  //Use the global coordinate of the cell as the id
1091  //It is usefull for parallel processing
1092  unsigned long long get_id() const
1093  {
1094  return my_g_location_rm;
1095  }
1096 
1097  //void SetApplyPadding(T padding_value_p)
1098  //{
1099  // padding_value_set_flag = 1;
1100  // padding_value = padding_value_p;
1101  //}
1102 
1108  void SetOutputVectorFlag(const bool is_output_vector_flag_p)
1109  {
1110  is_output_vector_flag = is_output_vector_flag_p;
1111  }
1112 
1120  {
1121  return is_output_vector_flag;
1122  }
1123 
1124  void SetOutputVectorFlatDirection(OutputVectorFlatDirection output_vector_flat_direction_p)
1125  {
1126  output_vector_flat_direction = output_vector_flat_direction_p;
1127  }
1128 
1130  {
1131  return output_vector_flat_direction;
1132  }
1133 
1139  void SetPadding(T padding_value_p)
1140  {
1141  has_padding_value_flag = true;
1142  padding_value = padding_value_p;
1143  }
1144 
1151  {
1152  return padding_value;
1153  }
1154 
1160  int SetShape(const std::vector<size_t> &shape_p)
1161  {
1162  is_output_vector_flag = true;
1163  output_vector_shape = shape_p;
1164  return 0;
1165  }
1166 
1172  int GetShape(std::vector<size_t> &shape_p)
1173  {
1174  if (!is_output_vector_flag)
1175  {
1176  AU_EXIT("The shape of output vector is not set in UDF !");
1177  }
1178  shape_p = output_vector_shape;
1179  return 0;
1180  }
1181 
1187  int GetOffsetUpper(std::vector<int> &max_offset) const
1188  {
1189  //PrintVector("GetOffsetUpper.chunk_dim_size = ", chunk_dim_size);
1190  //PrintVector("GetOffsetUpper.my_location = ", my_location);
1191  int rank = chunk_dim_size.size();
1192  for (int i = 0; i < rank; i++)
1193  {
1194  max_offset.push_back(chunk_dim_size[i] - my_location[i] - 1);
1195  }
1196  return 0;
1197  }
1198 
1204  int GetOffsetLower(std::vector<int> &max_offset) const
1205  {
1206  int rank = chunk_dim_size.size();
1207 
1208  for (int i = 0; i < rank; i++)
1209  {
1210  max_offset.push_back(my_location[i]);
1211  }
1212  return 0;
1213  }
1214 
1215  unsigned long long GetChunkID() const
1216  {
1217  return chunk_id;
1218  }
1219 
1220  int GetChunkID(unsigned long long &chunk_id_p) const
1221  {
1222  chunk_id_p = chunk_id;
1223  return 0;
1224  }
1225 
1226  void SetChunkID(unsigned long long chunk_id_p)
1227  {
1228  chunk_id = chunk_id_p;
1229  }
1230 
1231  inline int SetTagMap(std::map<std::string, std::string> &stencil_tag_map_p)
1232  {
1233  is_stencil_tag = true;
1234  stencil_tag_map = stencil_tag_map_p;
1235 
1236  return 0;
1237  }
1238 
1239  inline int GetTagMap(std::map<std::string, std::string> &stencil_tag_map_p) const
1240  {
1241  stencil_tag_map_p = stencil_tag_map;
1242  return 0;
1243  }
1244 
1245  inline bool HasTagMap() const
1246  {
1247  return is_stencil_tag;
1248  }
1249 
1257  int GetCurrentChunkSize(std::vector<unsigned long long> &chunk_size) const
1258  {
1259  //int rank = chunk_dim_size.size();
1260  chunk_size = chunk_dim_size;
1261  return 0;
1262  }
1263 
1264  int GetArraySize(std::vector<unsigned long long> &array_size) const
1265  {
1266  array_size = global_data_size;
1267  return 0;
1268  }
1269 
1270  int SetArraySize(std::vector<unsigned long long> &array_size) const
1271  {
1272  global_data_size = array_size;
1273  return 0;
1274  }
1275 };
1276 
1277 #endif
Definition: ft_stencil.h:100
void SetLocation(unsigned long long my_offset, std::vector< unsigned long long > &my_coordinate, std::vector< unsigned long long > &my_location_no_ol_p, std::vector< unsigned long long > &chunk_dim_size_no_ol_p, std::vector< long long > ol_origin_offset_p, std::vector< unsigned long long > current_chunk_ol_size)
Definition: ft_stencil.h:946
unsigned long long get_local_neighbors_count_at_left() const
Definition: ft_stencil.h:905
int SetShape(const std::vector< size_t > &shape_p)
Set the Shape of the Stencil object.
Definition: ft_stencil.h:1160
int GetGlobalIndex(std::vector< unsigned long long > &index_p) const
Definition: ft_stencil.h:1038
int SetValue(const T value_p)
Set the value object.
Definition: ft_stencil.h:900
int GetLocalIndex(std::vector< unsigned long long > &index_p) const
Definition: ft_stencil.h:1044
int SetTagMap(std::map< std::string, std::string > &stencil_tag_map_p)
Definition: ft_stencil.h:1231
T get_prev_value()
Definition: ft_stencil.h:939
T GetPadding()
Get the Padding object.
Definition: ft_stencil.h:1150
void SetLocation(unsigned long long &my_offset, std::vector< unsigned long long > &my_coordinate, std::vector< unsigned long long > &my_location_no_ol_p, std::vector< unsigned long long > &chunk_dim_size_no_ol_p, std::vector< long long > &ol_origin_offset_p, std::vector< unsigned long long > &current_chunk_ol_size, std::vector< unsigned long long > &global_coordinate_p, unsigned long long &global_coordinate_lineared_p)
Set the Location object.
Definition: ft_stencil.h:989
int SetArraySize(std::vector< unsigned long long > &array_size) const
Definition: ft_stencil.h:1270
bool GetOutputVectorFlag()
Get the Output Vector Flag object.
Definition: ft_stencil.h:1119
T operator()(Is... offsets) const
Definition: ft_stencil.h:416
Stencil(T value_p)
Construct a new Stencil object contains the value Mostly, it is used as output.
Definition: ft_stencil.h:165
int GetOffsetUpper(std::vector< int > &max_offset) const
Get the Max Offset Upper.
Definition: ft_stencil.h:1187
void operator=(TO &others)
Definition: ft_stencil.h:570
void SetChunkID(unsigned long long chunk_id_p)
Definition: ft_stencil.h:1226
unsigned long long GetChunkID() const
Definition: ft_stencil.h:1215
T GetValue()
Get the Value object.
Definition: ft_stencil.h:884
void SetPadding(T padding_value_p)
Set the Padding object.
Definition: ft_stencil.h:1139
int GetShape(std::vector< size_t > &shape_p)
Get the Output Vector Shape object.
Definition: ft_stencil.h:1172
bool HasTagMap() const
Definition: ft_stencil.h:1245
int GetCurrentChunkSize(std::vector< unsigned long long > &chunk_size) const
Get the size of the current chunk which base cell is located This may be different from one run to an...
Definition: ft_stencil.h:1257
unsigned long long get_my_g_location_rm() const
Definition: ft_stencil.h:1085
int GetValue(T &value_p)
Definition: ft_stencil.h:889
std::vector< unsigned long long > GetGlobalCoordinate() const
Definition: ft_stencil.h:1033
int GetArraySize(std::vector< unsigned long long > &array_size) const
Definition: ft_stencil.h:1264
bool has_output_value()
Definition: ft_stencil.h:576
T get_value()
Get the value object.
Definition: ft_stencil.h:864
int GetOffsetLower(std::vector< int > &max_offset) const
Get the Max Offset lower.
Definition: ft_stencil.h:1204
T ReadPoint(std::vector< int > &ov) const
Definition: ft_stencil.h:498
int GetTagMap(std::map< std::string, std::string > &stencil_tag_map_p) const
Definition: ft_stencil.h:1239
void ReadHoodBorder(std::vector< T > &rv, std::vector< int > &start_offset, std::vector< int > &end_offset) const
Definition: ft_stencil.h:581
Stencil(T value_p, std::vector< size_t > shape_p)
Construct a new Stencil object contains the value and the value has the shape for n-dimensional array...
Definition: ft_stencil.h:178
int GetTrailRunResult(std::vector< int > &overlap_size_p)
Definition: ft_stencil.h:1051
void SetOutputVectorFlatDirection(OutputVectorFlatDirection output_vector_flat_direction_p)
Definition: ft_stencil.h:1124
Stencil(int dims_input, T *chunk)
Definition: ft_stencil.h:147
std::vector< unsigned long long > GetCoordinate() const
return the global coodinate of the current Stencil
Definition: ft_stencil.h:1028
OutputVectorFlatDirection GetOutputVectorFlatDirection()
Definition: ft_stencil.h:1129
int WriteNeighbors(std::vector< int > &start_offset, std::vector< int > &end_offset, std::vector< T > &data) const
WriteHood.
Definition: ft_stencil.h:814
~Stencil()
Definition: ft_stencil.h:220
std::vector< T > ReadNeighbors(std::vector< int > &start_offset, std::vector< int > &end_offset) const
read neighborhood
Definition: ft_stencil.h:701
int ReadNeighbors(std::vector< int > &start_offset, std::vector< int > &end_offset, std::vector< T > &rv) const
read neighborhood
Definition: ft_stencil.h:631
Stencil()
Definition: ft_stencil.h:144
unsigned long long get_id() const
Definition: ft_stencil.h:1092
void set_value(const T value_p)
Set the value object.
Definition: ft_stencil.h:874
int GetChunkID(unsigned long long &chunk_id_p) const
Definition: ft_stencil.h:1220
void set_my_g_location_rm(unsigned long long lrm)
Definition: ft_stencil.h:1080
Stencil(unsigned long long my_offset, T *chunk, std::vector< unsigned long long > &my_coordinate, std::vector< unsigned long long > &chunk_size, std::vector< unsigned long long > &global_data_size_p)
Definition: ft_stencil.h:186
void SetOutputVectorFlag(const bool is_output_vector_flag_p)
Set the Output Vector Flag object.
Definition: ft_stencil.h:1108
#define ITERATOR_MACRO(ordinates_p, start_p, end_p)
Definition: ft_array_iterator.h:97
#define ARRAY_VIEW_WRITE
Definition: ft_array_view_access.h:90
#define ARRAY_VIEW_READ
Definition: ft_array_view_access.h:89
double time_address_cal
double pre_row_major_order_cal
Definition: ft_stencil.h:96
double data_access_time
Definition: ft_stencil.h:96
double row_major_order_cal
Definition: ft_stencil.h:96
OutputVectorFlatDirection
Definition: ft_type.h:212
void PrintVector(std::string name, std::vector< T > v)
Definition: ft_utility.h:165
#define ROW_MAJOR_ORDER_MACRO(dsize, dsize_len, coordinate, offset)
macro version of above two functions for speed
Definition: ft_utility_macro.h:124
#define AU_EXIT(info)
Definition: ft_utility_macro.h:147