src-d / kmcuda

Large scale K-means and K-nn implementation on NVIDIA GPU / CUDA
Other
784 stars 144 forks source link

"Segmentation fault (core dumped)" When running test.py #42

Closed Anikacyp closed 5 years ago

Anikacyp commented 6 years ago

When I run test.py, I encounter this "Segmentation fault (core dumped)". I use python 3.6.5 and Cuda 9.0. Here is the build logs attachment: kmcuda.log

does anyone have the same issue?

vmarkovtsev commented 6 years ago

Hi @Anikacyp

These two lines are suspicious:

-- Found PythonInterp: /home/yapch/.virtualenvs/tensorflowgpu1.7_p3.6/bin/python3 (found suitable version "3.6.5", minimum required is "3") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (found suitable version "3.5.2", minimum required is "3") 

You must be building in a virtualenv and it leaks the native environment: part of the lib is built for 3.5 and part for 3.6. Building kmcuda in Python virtualenvs such as this is officially not supported - I generally recommend never using them and stick with Docker setups.

vmarkovtsev commented 6 years ago

There were also some minor incompatibilities with CUDA 9, fixed in https://github.com/src-d/kmcuda/pull/43

Anikacyp commented 6 years ago

@vmarkovtsev thanks for the quick reply, I'll try it.

Anikacyp commented 6 years ago

I rebuild with the latest repo without virtualenv used, still have the issue. The command is: cmake -DCMAKE_BUILD_TYPE=Release -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -D DISABLE_R=y . && make

Here's the log: kmcuda.log

vmarkovtsev commented 6 years ago

The log shows that cmake used the cached options. Try git clean -xfd and building again. If it still crashes, build in debug mode -DCMAKE_BUILD_TYPE=Debug and run under gdb gdb --args python3 .... At the point it crashes, exec bt and attach the output. Also please activate the most verbose log level in kmcuda verbosity=2.

hyh900220 commented 5 years ago

Hi, @vmarkovtsev I meet the same problem: "Segmentation fault (core dumped)" When running test.py I use ubuntu 16.04, python 3.5.2 and CUDA 8.0. I tried to use pip install libKMCUDA, the log it shows

The directory '/home/deeptexas-1/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/deeptexas-1/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting libKMCUDA
  Downloading https://files.pythonhosted.org/packages/b9/ae/db37581df07f7e225fac11e62cb8231437949780f41e8542979bed7aaba3/libKMCUDA-6.2.1-cp35-cp35m-manylinux1_x86_64.whl (643kB)
    100% |████████████████████████████████| 645kB 61kB/s 
Requirement already satisfied: numpy in ./.local/lib/python3.5/site-packages (from libKMCUDA) (1.15.0)
Installing collected packages: libKMCUDA
Successfully installed libKMCUDA-6.2.1

but when I try to run this sample

import numpy
from matplotlib import pyplot
from libKMCUDA import kmeans_cuda

numpy.random.seed(0)
arr = numpy.empty((10000, 2), dtype=numpy.float32)
arr[:2500] = numpy.random.rand(2500, 2) + [0, 2]
arr[2500:5000] = numpy.random.rand(2500, 2) - [0, 2]
arr[5000:7500] = numpy.random.rand(2500, 2) + [2, 0]
arr[7500:] = numpy.random.rand(2500, 2) - [2, 0]
centroids, assignments = kmeans_cuda(arr, 4, verbosity=1, seed=3)
print(centroids)
pyplot.scatter(arr[:, 0], arr[:, 1], c=assignments)
pyplot.scatter(centroids[:, 0], centroids[:, 1], c="white", s=150)

it shows error

arguments: 1 0x7ffe7faab5e4 0.010 0.10 0 10000 2 4 3 0 0 2 0x32b4ff0 0x32f3ef0 0x33585e0 (nil)
Illegal instruction (core dumped)

so I try to build from source , the command is

cmake -DCMAKE_BUILD_TYPE=Release -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 .
make

and the build logs is kmcuda_build_log.txt

but when I running test.py, it shows ".Segmentation fault (core dumped)"

Thanks!

vmarkovtsev commented 5 years ago

@hyh900220 Illegal instruction means that your CPU arch is older/not compatible with the arch for which the package was built. You have to build it yourself.

vmarkovtsev commented 5 years ago

Actually, there was no response to the original issue for 2 months so closing. Feel free to reopen if there is new information!

hyh900220 commented 5 years ago

my CPU is E5-1650, motherboard is intel C602 chipset, 32G ddr3 ram. what build command should I use? I was use

 cmake -DCMAKE_BUILD_TYPE=Release -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 .
 && make

but it still can't run test.py, it shows ".Segmentation fault (core dumped)"

vmarkovtsev commented 5 years ago

Let's continue in a new issue - it is different from the screwed Python environment - the origin of this one. I think I know what is the problem in your case, it is trivial and easy to fix.

hyh900220 commented 5 years ago

new issue to #52

mtshikomba commented 4 years ago

I had the same issue. the solution was to uninstall python3 and reinstall again.

it all worked fine