Search code examples
pythoncupy

Is there any way to set number of threads , number of blocks and grids for CuPy computation? How?


I am using Cupy with following code,

import cupy as cp

vals, vecs = cp.linalg.eigh(Array)

For above code , I want to set number of threads in the code. How to do it. Let us say for 100 threads execute the code.


Solution

  • For high-level, NumPy-like APIs, there is currently no public interface to change the grid/block configuration. In addition, many linalg APIs (such as eigh in your example) delegate the job to the CUDA Math Libraries solvers, which do not allow users to set grid/block configuration either. I wonder what prompts to this need. It'd be nice if you could elaborate.