Beispiel #1
0
    // Create vector of the specified size.
    static boost::shared_ptr<vector>
    create_vector(size_t size, const params &prm)
    {
        precondition(!prm.context().empty(), "Empty VexCL context!");

        return boost::make_shared<vector>(prm.context(), size);
    }
Beispiel #2
0
    // Copy vector from builtin backend.
    static boost::shared_ptr<vector>
    copy_vector(typename builtin<real>::vector const &x, const params &prm)
    {
        precondition(!prm.context().empty(), "Empty VexCL context!");

        return boost::make_shared<vector>(prm.context(), x);
    }
Beispiel #3
0
    // Copy matrix from builtin backend.
    static boost::shared_ptr<matrix>
    copy_matrix(boost::shared_ptr< typename builtin<real>::matrix > A, const params &prm)
    {
        precondition(!prm.context().empty(), "Empty VexCL context!");

        const typename builtin<real>::matrix &a = *A;

        BOOST_AUTO(Aptr, a.ptr_data());
        BOOST_AUTO(Acol, a.col_data());
        BOOST_AUTO(Aval, a.val_data());

        return boost::make_shared<matrix>(prm.context(), rows(*A), cols(*A), Aptr, Acol, Aval);
    }
Beispiel #4
0
    lemon_interface(const params &p) {
      state_ = ::ParseAlloc(&pooled::tracked_byte_alloc);
      if (p.trace()) {
#if NERVE_TRACE_PARSER
        ::ParseTrace(stdout, detail::parse_trace_prefix);
#endif
      }
      context_ = p.context();
    }
Beispiel #5
0
 scatter(size_t size, const std::vector<ptrdiff_t> &I, const params &prm)
     : S(prm.context(), size, std::vector<size_t>(I.begin(), I.end()))
     , tmp(I.size())
 { }
Beispiel #6
0
 gather(size_t src_size, const std::vector<ptrdiff_t> &I, const params &prm)
     : G(prm.context(), src_size, std::vector<size_t>(I.begin(), I.end())) { }