Closed flxai closed 5 years ago
That looks like you have the wrong C and C++ compiler version tied to your CUDA installation. A quick Google search suggests this might be a potential solution.
Also, do a fresh git pull before you use again. I fixed a wrong import path in the test script.
Thank you, it seems to work now. I adopted the linking like so:
sudo ln -s /usr/bin/gcc-5 /usr/local/cuda-9.0/bin/gcc
sudo ln -s /usr/bin/g++-5 /usr/local/cuda-9.0/bin/g++
The build then successfully finished with what I think to be negligible warnings:
pkg/include/cuda/emd.cuh(39): warning: specified alignment (4) is different from alignment (8) specified on a previous declaration
detected during instantiation of "void approx_match_kernel(int64_t, int64_t, int64_t, int64_t, const T *, const T *, T *, T *) [with T=float]"
(237): here
pkg/include/cuda/emd.cuh(262): warning: specified alignment (4) is different from alignment (8) specified on a previous declaration
detected during instantiation of "void match_cost_kernel(int64_t, int64_t, int64_t, int64_t, const T *, const T *, const T *, T *) [with T=float]"
(318): here
pkg/include/cuda/emd.cuh(342): warning: specified alignment (4) is different from alignment (8) specified on a previous declaration
detected during instantiation of "void match_cost_grad2_kernel(int64_t, int64_t, int64_t, int64_t, const T *, const T *, const T *, T *) [with T=float]"
(444): here
Running test_emd_loss.py
gives the following output:
Time: 0.0057408809661865234
tensor([6.1624], device='cuda:0', dtype=torch.float64,
grad_fn=<EMDFunctionBackward>)
tensor(6.1624, device='cuda:0', dtype=torch.float64, grad_fn=<SumBackward0>)
tensor([[[ 0.2854, 1.2197, 0.8785],
[ 0.8848, 1.1097, -0.0566],
[ 1.9640, 0.0908, -0.3259],
[ 0.9830, -0.1142, 1.2023],
[ 1.0209, 0.7352, 1.4240]]], device='cuda:0', dtype=torch.float64)
tensor([[[-5.0648e-02, -1.2653e-01, 4.4372e-02],
[ 3.3235e+00, 6.3753e+00, -8.6020e+00],
[ 7.8830e-01, 7.8198e-01, 4.4210e-01],
[ 4.3565e-02, 6.3839e-02, 7.6730e-02],
[ 4.7981e+00, 2.4774e+00, 5.1132e+00],
[ 3.2840e-03, 1.0217e-01, 5.4416e-03],
[ 4.7761e-05, 9.6071e-04, 5.0468e-05],
[-1.4062e-05, -2.7342e-05, -1.1873e-05],
[ 1.2999e-03, 5.5120e-03, -1.7161e-05],
[ 5.4406e-02, 3.7113e-02, -6.4375e-03]]], device='cuda:0',
dtype=torch.float64)
So it all seems OK. Thanks again! :)
I tried to built this on Ubuntu 18.04. Unfortunately I'm hit with the following error when invoking
python setup.py install
:The directory
/usr/local/cuda
links to/usr/local/cuda-9.0
. I installed CUDA v9.0 through the packagecuda-toolkit-9-0
from the following repository:I installed PyTorch v1.0.0 through Anaconda like so:
What am I doing wrong? Sorry if this is the wrong place to ask. I'd happily accept a nudge to some other kind of documentation.