Skip to content

how can i get the kernelParams number ?? #543

Answered by galv
pipul asked this question in Q&A
Discussion options

You must be logged in to vote

Hello pipul, there is not a direct API, but you can do this https://github.com/pytorch/pytorch/pull/137318/files#diff-d7302d133bb5e0890fc94de9aeea4d9d442555a3b40772c9db10edb5cf36a35cR424-R429

In other words:

for(size_t i = 0; cudaFuncGetParamInfo(func, i, &param_offset, &param_size) != CUDA_ERROR_INVALID_VALUE; i++) {}
// i now contains the total number of arguments to your kernel.

I'm sure you can translate that to python.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@galv
Comment options

Answer selected by leofang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants