Example #1
0
 /// Before each run, build a vector of random integers.
 virtual void setUp(int64_t experimentSize)
 {
     experimentSize = experimentSize <= 0 ? 1 : experimentSize;
     try
     {
         deviceGC();
         int depth = 100;
         input_cube = constant(1.0, experimentSize, experimentSize, depth, this->data_type);
         input_cube.eval();
         output = array(depth, this->data_type);
         output.eval();
         af::sync();
     }
     catch (af::exception & e)
     {
         // print out the error, rethrow the error to cause the test to fail.
         std::cout << e << std::endl;
         throw e;
     }
 }
Example #2
0
    static array::array_proxy gen_indexing(const array &ref, const index &s0, const index &s1, const index &s2, const index &s3, bool linear = false)
    {
        ref.eval();
        af_index_t inds[AF_MAX_DIMS];
        inds[0] = s0.get();
        inds[1] = s1.get();
        inds[2] = s2.get();
        inds[3] = s3.get();

        return array::array_proxy(const_cast<array&>(ref), inds, linear);
    }
Example #3
0
 void run(const int iter)
 {
     try {
         for (int i = 0; i < iter; i++) {
             y = a * x + y;
             y.eval();
         }
         af::sync();
     } catch(const af::exception &ex) {
         std::cout << ex.what() << std::endl;
         throw;
     }
 }
Example #4
0
void Window::plot3(const array& P, const char* const title) {
    af_cell temp{_r, _c, title, AF_COLORMAP_DEFAULT};
    P.eval();
    AF_THROW(af_draw_plot_nd(get(), P.get(), &temp));
}