tensor-compiler / taco

The Tensor Algebra Compiler (taco) computes sparse tensor expressions on CPUs and GPUs
http://tensor-compiler.org
Other
1.24k stars 186 forks source link

Failure due to CUDA errors when generating code for CPU? #547

Open khaled3ttia opened 1 year ago

khaled3ttia commented 1 year ago

Hello,

I am running into a slightly strange issue when trying to generate and run the kernel for tensor times vector.

Here is the code I am using

#include "taco.h"
#include <numeric>
#include <random>
#include <unistd.h>

#define floattype double

using namespace taco;
int main(int argc, char *argv[]) {

  std::default_random_engine gen(0);
  std::uniform_real_distribution<floattype> unif(0.0, 1.0);

  // 3D Tensor file path
  std::string tnsFile = "~/Documents/taco/test/data/3tensor.tns";

  // Used formats
  Format csr({Dense, Sparse});
  Format csf({Sparse, Sparse, Sparse});
  Format dv({Dense});

  // Load the sparse tensor
  Tensor<floattype> B = read(tnsFile, csf);

  // Prepare the tensor for the result
  Tensor<floattype> A({B.getDimension(0), B.getDimension(1)}, Dense);

  // populate a random dense vector
  Tensor<floattype> c({B.getDimension(2)}, dv);

  for (int i = 0; i < c.getDimension(0); ++i) {

    c.insert({i}, unif(gen));
  }

  c.pack();

  IndexVar i, j, k, l;

  // The main expression
  A(i, j) = B(i, j, k) * c(k);

  // GO!
  A.compile();
  A.assemble();
  A.compute();
}

The compilation command is as follows: g++ -std=c++17 -O3 -DNDEBUG -DTACO -I ~/Documents/taco/include taco_3d.cpp -o taco_3d.x -ltaco

I get no compilation errors, but when I run the executable the error I get is:

$ ./taco_3d.x
/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(131): error: expected a ")"

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(141): error: expected a ")"

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(144): error: expected an identifier

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(144): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(145): error: expected an identifier

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(145): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(146): error: expected an identifier

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(146): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(147): error: expected an identifier

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(147): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(148): error: expected an identifier

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(148): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(149): error: expected an identifier

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(149): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(150): error: expected an identifier
                                                                                                                                                                           /tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(150): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(151): error: identifier "A93" is undefined

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(157): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(157): error: user-defined literal operator not found                                                                                  
/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(158): error: user-defined literal operator not found                                                                                  
/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(159): error: user-defined literal operator not found                                                                                  
/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(159): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(160): error: user-defined literal operator not found                                                                                  
/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(163): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(163): error: user-defined literal operator not found                                                                                  
/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(164): error: user-defined literal operator not found

/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu(165): error: user-defined literal operator not found                                                                                  
27 errors detected in the compilation of "/tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu".                                                                                           terminate called after throwing an instance of 'taco::TacoException'
  what():  Error at /home/hpclab/Documents/taco/src/codegen/module.cpp:156 in compile:                                                                                      Compilation command failed:
nvcc -w -O3 -Xcompiler "-fPIC -shared -ffast-math -O3" --generate-code arch=compute_86,code=sm_86 /tmp/taco_tmp_txUdPh/5x1096hkmtw4.cu /tmp/taco_tmp_txUdPh/5x1096hkmtw4_shims.cpp -o /tmp/taco_tmp_txUdPh/5x1096hkmtw4.so -lm
returned 256
Aborted (core dumped)

Any pointers on how to fix this? Thank you!