Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unexpected behaviour on Nvidia Jetson Orin #899

Closed
SamDSchofield opened this issue Mar 5, 2025 · 2 comments
Closed

[BUG] Unexpected behaviour on Nvidia Jetson Orin #899

SamDSchofield opened this issue Mar 5, 2025 · 2 comments

Comments

@SamDSchofield
Copy link

Describe the Bug
MatX code that appears to work correctly on my desktop machine works incorrectly (operations returns all zeros) when running on my Jetson Orin AGX (Jetpack 6.0).

To Reproduce
Run the following code on a Jetson

#include <matx.h>

int main(int argc, char **argv) {
    auto a = matx::make_tensor<float>({3, 3});
    auto b = matx::make_tensor<float>({3, 3});

    a.SetVals({{1,2,3}, {4,5,6}, {7,8,9}});

    (b = 2*a).run();

    matx::print(a);
    matx::print(b);
}

Expected Behavior
The code should output (result on my desktop machine):

Tensor{float} Rank: 2, Sizes:[3, 3], Strides:[3,1]
000000:  1.0000e+00  2.0000e+00  3.0000e+00 
000001:  4.0000e+00  5.0000e+00  6.0000e+00 
000002:  7.0000e+00  8.0000e+00  9.0000e+00 
Tensor{float} Rank: 2, Sizes:[3, 3], Strides:[3,1]
000000:  2.0000e+00  4.0000e+00  6.0000e+00 
000001:  8.0000e+00  1.0000e+01  1.2000e+01 
000002:  1.4000e+01  1.6000e+01  1.8000e+01 

Instead, it outputs (on Jetson):

tensor_2_f32: Tensor{float} Rank: 2, Sizes:[3, 3], Strides:[3,1]
000000:  1.0000e+00  2.0000e+00  3.0000e+00 
000001:  4.0000e+00  5.0000e+00  6.0000e+00 
000002:  7.0000e+00  8.0000e+00  9.0000e+00 
tensor_2_f32: Tensor{float} Rank: 2, Sizes:[3, 3], Strides:[3,1]
000000:  0.0000e+00  0.0000e+00  0.0000e+00 
000001:  0.0000e+00  0.0000e+00  0.0000e+00 
000002:  0.0000e+00  0.0000e+00  0.0000e+00 

System Details (please complete the following information):

  • OS: Jetpack 6.0
  • CUDA version: 12.6.68
  • g++ version: 11.4.0
@cliffburdick
Copy link
Collaborator

Hi @SamDSchofield , can you give us your compiler command? I just wanted to make sure you're using the correct architecture. You can also check for CUDA errors using cuda-gdb.

@SamDSchofield
Copy link
Author

Hi @cliffburdick, it turns out the issue was caused by having my CMAKE_CUDA_ARCHITECTURES set to the wrong value. Changing set(CMAKE_CUDA_ARCHITECTURES 70) to set(CMAKE_CUDA_ARCHITECTURES 87) in my CMakeLists.txt solved the issue. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants