This example show how to use EP_MEMORY in FasTensor to cache data in memory.
#include <iostream>
#include <stdarg.h>
#include <vector>
#include <stdlib.h>
using namespace std;
{
oStencil = iStencil(0, 0) * 2.0;
return oStencil;
}
{
oStencil = iStencil(0, 0) * 2.0;
return oStencil;
}
#ifdef HAS_DASH_ENDPOINT
int main(
int argc,
char *argv[])
{
std::vector<int> chunk_size = {4, 16};
std::vector<int> overlap_size = {1, 1};
Array<float> *A = new Array<float>("EP_HDF5:./test-data/testf-16x16-cache.h5:/testg/testd", chunk_size, overlap_size);
Array<float> *B = new Array<float>("EP_MEMORY");
Array<float> *C = new Array<float>("EP_HDF5:./test-data/testf-16x16-cache-output.h5:/testg/testd");
B->Nonvolatile("EP_HDF5:./test-data/testf-16x16-cache-intermediate.h5:/testg/testd");
delete A;
delete B;
delete C;
return 0;
}
#else
int main(
int argc,
char *argv[])
{
std::vector<int> chunk_size = {4, 16};
std::vector<int> overlap_size = {1, 1};
Array<float> *A = new Array<float>("EP_HDF5:./test-data/testf-16x16-cache.h5:/testg/testd", chunk_size, overlap_size);
Array<float> *B = new Array<float>("EP_HDF5:./test-data/testf-16x16-cache-intermediate.h5:/testg/testd");
Array<float> *C = new Array<float>("EP_HDF5:./test-data/testf-16x16-cache-output.h5:/testg/testd");
delete A;
delete B;
delete C;
return 0;
}
#endif
Definition: ft_stencil.h:100
#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_cache.cpp:157
Stencil< float > udf_cache2(const Stencil< float > &iStencil)
Definition: ft_example_cache.cpp:109
Stencil< float > udf_cache1(const Stencil< float > &iStencil)
Definition: ft_example_cache.cpp:101
Definition: ft_array.h:113