This example show how to reduce 2D data in FasTensor . 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#include <iostream>
#include <stdarg.h>
#include <vector>
#include <stdlib.h>
 
using namespace std;
 
std::vector<unsigned long long> 
H_size = {8, 2};
 
 
{
 
    float temp_value = 0;
    int temp_index;
    std::vector<unsigned long long> temp_coord = iStencil.
GetCoordinate();
 
    temp_index = temp_coord[0];
 
    for (int i = 0; i < 4; i++)
        temp_value += iStencil(0, i);
    H->SetValue(
H->GetValue(temp_index, 0) + temp_value, temp_index, 0);
 
    
 
    temp_value = 0;
    for (int i = 4; i < 8; i++)
        temp_value += iStencil(0, i);
    H->SetValue(
H->GetValue(temp_index, 1) + temp_value, temp_index, 1);
 
 
    
 
    return 0;
}
 
int main(
int argc, 
char *argv[])
 
{
    
 
    
    std::vector<int> chunk_size = {8, 8};
    std::vector<int> overlap_size = {0, 0};
 
    H = 
new Array<float>(
"EP_MEMORY", 
H_size);
 
 
    
    Array<float> *A = new Array<float>("EP_DIR:EP_HDF5:./test-data/test_1f1p_dir_2d:/testg/testd", chunk_size, overlap_size);
 
    
    for (int i = 0; i < 8; i++)
    {
        for (int j = 0; j < 2; j++)
        {
        }
    }
 
    
 
    std::vector<int> skip_size = {1, 8};
    A->EnableApplyStride(skip_size);
 
    
 
 
    H->Nonvolatile(
"EP_HDF5:./test-data/test_1f1p_dir_2d_result.h5:/testg/testd");
 
 
    
    delete A;
 
 
    return 0;
}
Definition: ft_stencil.h:100
 
std::vector< unsigned long long > GetCoordinate() const
return the global coodinate of the current Stencil
Definition: ft_stencil.h:1028
 
#define AU_Init(argc, argv)
Definition: ft.h:112
 
#define AU_Finalize()
Definition: ft.h:113
 
int main(int argc, char *argv[])
Definition: ft_example_reduce2D_1f1p.cpp:137
 
Array< float > * H
Definition: ft_example_reduce2D_1f1p.cpp:112
 
Stencil< float > udf_hist_2d(const Stencil< float > &iStencil)
Definition: ft_example_reduce2D_1f1p.cpp:114
 
std::vector< unsigned long long > H_size
Example to sum each row of A (8 x 8) Store result in H (8 x 2) H[0,0] = sum (A[0,0],...
Definition: ft_example_reduce2D_1f1p.cpp:111
 
#define AU_SUM
Definition: ft_merge.h:92
 
Definition: ft_array.h:113