[eigen] Tensor Execution on GPUs

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hello,

I'm currently trying to use GpuDevice to perform operations on Tensors, but having trouble with compiling the following statements:

Eigen::Tensor<float,1> in(2);
in[0] = 1.f; in[1] = -2.f;
Eigen::Tensor<float,1> out(2);
Eigen::CudaStreamDevice stream;
Eigen::GpuDevice dev(&stream);
out.device(dev) = in.tanh();

I've attached a relatively simple example that I think should be working with nvcc, but for some reason I'm getting the following linking error and I wasn't able to figure out what the problem was. Does anything look out of place here?

Graham

---------------------------------------------------------------

nvcc -o test-tanh tanh.cc -I/home/is/neubig/usr/local/eigen -std=c++11 -DEIGEN_USE_GPU
/tmp/tmpxft_0000699c_00000000-4_tanh.o: In function `Eigen::TensorDevice<Eigen::Tensor<float, 1, 0, long>, Eigen::GpuDevice>& Eigen::TensorDevice<Eigen::Tensor<float, 1, 0, long>, Eigen::GpuDevice>::operator=<Eigen::TensorCwiseUnaryOp<Eigen::internal::scalar_tanh_op<float>, Eigen::Tensor<float, 1, 0, long> const> >(Eigen::TensorCwiseUnaryOp<Eigen::internal::scalar_tanh_op<float>, Eigen::Tensor<float, 1, 0, long> const> const&)':
tanh.cc:(.text._ZN5Eigen12TensorDeviceINS_6TensorIfLi1ELi0ElEENS_9GpuDeviceEEaSINS_18TensorCwiseUnaryOpINS_8internal14scalar_tanh_opIfEEKS2_EEEERS4_RKT_[_ZN5Eigen12TensorDeviceINS_6TensorIfLi1ELi0ElEENS_9GpuDeviceEEaSINS_18TensorCwiseUnaryOpINS_8internal14scalar_tanh_opIfEEKS2_EEEERS4_RKT_]+0x4c): undefined reference to `Eigen::internal::TensorExecutor<Eigen::TensorAssignOp<Eigen::Tensor<float, 1, 0, long>, Eigen::TensorCwiseUnaryOp<Eigen::internal::scalar_tanh_op<float>, Eigen::Tensor<float, 1, 0, long> const> const> const, Eigen::GpuDevice, true>::run(Eigen::TensorAssignOp<Eigen::Tensor<float, 1, 0, long>, Eigen::TensorCwiseUnaryOp<Eigen::internal::scalar_tanh_op<float>, Eigen::Tensor<float, 1, 0, long> const> const> const&, Eigen::GpuDevice const&)'
collect2: error: ld returned 1 exit status
Makefile:11: recipe for target 'test-tanh' failed
make: *** [test-tanh] Error 1

Attachment: eigen.tar.gz
Description: GNU Zip compressed data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/