dpilger26 / NumCpp

C++ implementation of the Python Numpy library

Home Page:https://dpilger26.github.io/NumCpp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question :: It could be used inside a CUDA kernel ?

andrewssobral opened this issue · comments

Hi, thanks for this great library!

I was wondering if it could be used inside a CUDA kernel like Eigen?

For example:

__global__ void test_kernel(int n, float * r) {
  typedef Eigen::Matrix<thrust::complex<float>,2,2> cuMatrixXcf;

  cuMatrixXcf m;
  m << 1,0, 0,1;
  m *= threadIdx.x;

  Eigen::SelfAdjointEigenSolver< cuMatrixXcf > solver;
  solver.compute(m, Eigen::EigenvaluesOnly);

  auto const& D = solver.eigenvalues();
  
  for (int i = 0; i < n; ++i)
    r[n*threadIdx.x + i] = D(i);
}

Best regards,
Andrews

It has been several years since I last played around with any CUDA, and even then it was only little bits... With that said, I don't believe NumCpp would work in a CUDA kernel, and there has definitely been no effort in the library (if that is required, I would assume so?) to make sure that it would.

Closing due to inactivity.