8000 How can I access data in cuda kernel like in pytorch? · Issue #79 · pytorch/extension-cpp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
How can I access data in cuda kernel like in pytorch? #79
Open
@Arsmart123

Description

@Arsmart123
  • OS: win10
  • PyTorch version: 1.10
  • How you installed PyTorch (conda, pip, source): pip
  • Python version: 3.9
  • CUDA/cuDNN version: 11.3
  • GPU models and configuration: 1650 geforce PC
  • GCC version (if compiling from source): not sure/.....

I have a tensor a in pytorch, a. And then I transpose it to have a1. But it will not really transpose in memory, but just change the way we read it. And then we pass this pointer to the cuda kernel like is written in the tutorial. Then we access it within the kernel. It is not transposed!!!!! But we enter the pytorch interface and print out the transposed a1, it is correct!

How can we access the tensor within the kernel? We do not know whether it is
transposed or not!!!!

Thank you!!!
test.zip
I have attached a file here. You can reproduce it by unzip it.
Then open a python env with pytorch. Also have GPU
Then enter: python pytorch/setup.py install
You will install the "add3" library.
Then run the "delete.py" file within it. You will see how the bug appears like I discribe above!!

Another way to solve it is to understand how nn.linear solve it. How they can access data correctly? I think this is the implementation for nn.linear inside:
https://github.com/pytorch/pytorch/blob/4cb534f92ef6f5b2ec99109b0329f93a859ae831/torch/csrc/api/src/nn/modules/linear.cpp
But again it links to "torch::nn::linear" And I really can not find the cpp code for it.....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0