torchinterp1d icon indicating copy to clipboard operation
torchinterp1d copied to clipboard

Cannot build torchsearchsorted under ubuntu 16.04

Open iago-lito opened this issue 5 years ago • 14 comments

Following the instructions given there, I get the following error running python setup.py install:

torchsearchsorted/cuda/searchsorted_cuda_kernel.cu(131): error: more than one instance of overloaded function "fmax" matches the argument list:
            function "fmax(double, double)"
            function "fmax(float, float)"
            argument types are: (int64_t, int64_t)

torchsearchsorted/cuda/searchsorted_cuda_kernel.cu(137): error: more than one instance of overloaded function "fmin" matches the argument list:
            function "fmin(double, double)"
            function "fmin(float, float)"
            argument types are: (int, int64_t)

2 errors detected in the compilation of "/tmp/tmpxft_0001f79e_00000000-6_searchsorted_cuda_kernel.cpp1.ii".
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

The machine I try to compile it on is quite not up-to-date I think. However, I cannot upgrade it for I have no root access :\

$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

Yet the hardware is good :P

$ nvidia-smi
Thu Mar 21 19:05:37 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.130                Driver Version: 384.130                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:03:00.0 Off |                  N/A |
|  0%   29C    P0    57W / 250W |      0MiB / 11172MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

What should I do?

iago-lito avatar Mar 21 '19 18:03 iago-lito

hi @iago-lito , I tried to modify the fmin and fmax to use std::min and std::max instead. Probably this was the pb

could you try again to pull the torchsearchsorted repo and install it ?

aliutkus avatar Mar 22 '19 07:03 aliutkus

Thank you for support :)

I did. Well, this step passed, but a whole bunch of new ones followed :\ See the complete output here.

Would it be a problem with compilers / cuda / python versions?

iago-lito avatar Mar 22 '19 09:03 iago-lito

damn, which version of cuda are you using?

aliutkus avatar Mar 22 '19 09:03 aliutkus

Wops, I didn't write the whole output, sorry for that:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

This is rather old I think. I'm in touch with the admin, but there is no guarantee it'll be upgraded soon.. :\

iago-lito avatar Mar 22 '19 10:03 iago-lito

I tried something else, sorry for the inconvenience. Could you please start again pulling torchsearchsorted and installing again ?

aliutkus avatar Mar 22 '19 10:03 aliutkus

Not much progress.. X)

iago-lito avatar Mar 22 '19 10:03 iago-lito

are you using torch 1.0 ?

aliutkus avatar Mar 22 '19 10:03 aliutkus

Yupe:

$ pip3 show torch
Name: torch
Version: 1.0.1.post2
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: /usr/local/lib/python3.5/dist-packages
Requires: 
Required-by: 
You are using pip version 18.0, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

iago-lito avatar Mar 22 '19 10:03 iago-lito

OK, I'm sorry since I cannot reproduce the bug, I got difficulties fixing it.

Could you investigate the problem ? It seems to be around these fmin and fmax calls. Maybe you find some other way to do the same computations ? If you manage, I'd be glad to have a pull request

aliutkus avatar Mar 22 '19 12:03 aliutkus

I understand. I'll do my best. But I won't if an simple upgrade fixes the error, and I will investigate this option first. Thank you for support anyway :)

iago-lito avatar Mar 22 '19 12:03 iago-lito

that was quick

yeah, this is all working on cuda 10. I did not test, but it's clearly a pity that such a stupid cast between integers is causing so much troubles. I apologize for this

aliutkus avatar Apr 15 '19 07:04 aliutkus

I guess this implementation only works on cuda 10. It doesn't build on cuda 9 or 8 version of pytorch, as it returns an invalid cast error. python36\lib\site-packages\torch\lib\include\pybind11\cast.h(1439): error: expression must be a pointer to a complete object type

lkn2993 avatar May 12 '19 18:05 lkn2993

true, although having a cast that works on cuda < 10 is probably just a trivial change of one line. I'd welcome it gladly

aliutkus avatar May 13 '19 06:05 aliutkus

I've got the test.py case working in 16.04 with cuda9.2, as an FYI.

crvogt avatar Oct 11 '19 12:10 crvogt