oneAPI

作者: 半笔闪 | 来源:发表于2019-12-19 16:54 被阅读0次
    using namespace cl::sycl;
    // declare host arrays
    double *A = new double[M*N];
    double *B = new double[N*P];
    double *C = new double[M*P];
    {
    // Initializing the devices queue with a gpu_selector
    queue q{gpu_selector()};
    // Creating 1D buffers for matrices which are bound to host arrays
    buffer<double, 1> a{A, range<1>{M*N}};
    buffer<double, 1> b{B, range<1>{N*P}};
    buffer<double, 1> c{C, range<1>{M*P}};
    mkl::transpose nT = mkl::transpose::nontrans;
    // Syntax
    // void gemm(queue &exec_queue, transpose transa, transpose transb,
    // int64_t m, int64_t n, int64_t k, T alpha,
    // buffer<T,1> &a, int64_t lda,
    // buffer<T,1> &b, int64_t ldb, T beta,
    // buffer<T,1> &c, int64_t ldc);
    // call gemm
    mkl::blas::gemm(q, nT, nT, M, P, N, 1.0, a, M, b, N, 0.0, c, M);
    }
    // when we exit the block, the buffer destructor will write result back to C.
    
    

    相关文章

      网友评论

          本文标题:oneAPI

          本文链接:https://www.haomeiwen.com/subject/dxfvnctx.html