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] The exercises in notebooks may be updated. Some of them cannot be compiled successfully. #90

Closed
AtomicVar opened this issue Jan 24, 2022 · 1 comment · Fixed by #108

Comments

@AtomicVar
Copy link
Contributor

Describe the bug
The simple example MatX/docs_input/notebooks/exercises/example2_tensor_add.cu cannot be compiled successfully.

To Reproduce
The current version of the code is

#include <matx.h>

using namespace matx;

int main() {

  tensorShape_t<2> shape({2, 3});
  tensor_t<float, 2> A(shape);
  tensor_t<float, 2> B(shape);
  tensor_t<float, 2> C(shape);
  tensor_t<float, 1> V({3});

  A.SetVals({ {1, 2, 3},
        {4, 5, 6}});
  
  B.SetVals({ {7, 8, 9},
        {10, 11, 12}});

  // TODO: Add tensors A and B and store the result in C

  
  A.Print();
  printf("\n");
  B.Print();
  printf("\n");
  C.Print();
}

If I change it to

#include <matx.h>

using namespace matx;

int main() {
  tensor_t<float, 2> A({2, 3});
  tensor_t<float, 2> B({2, 3});
  tensor_t<float, 2> C({2, 3});
  tensor_t<float, 1> V({3});

  A.SetVals({ {1, 2, 3},
        {4, 5, 6}});
  
  B.SetVals({ {7, 8, 9},
        {10, 11, 12}});

  // TODO: Add tensors A and B and store the result in C
  
  A.Print(0, 0);
  printf("\n");
  B.Print(0, 0);
  printf("\n");
  C.Print(0, 0);
}

It works.

Expected behavior
The examples should be compiled and work.

System details (please complete the following information):

  • OS: 20.04
  • CUDA version: CUDA 11.4
  • g++ version: 9.3.0
  • Codebase commit: d22dc84

Additional context
Add any other context about the problem here.

@luitjens
Copy link
Collaborator

Thank you, this was an oversight. Can you submit a pull request with your fixes?

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

Successfully merging a pull request may close this issue.

2 participants