Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python segfaults after import kp #230

Closed
thinking-tower opened this issue Jun 12, 2021 · 0 comments · Fixed by #231
Closed

Python segfaults after import kp #230

thinking-tower opened this issue Jun 12, 2021 · 0 comments · Fixed by #231

Comments

@thinking-tower
Copy link
Contributor

thinking-tower commented Jun 12, 2021

Issue description

After installing kp, import kp throws an error.

Code example

# use pip
pip install kp 
# or compile from source
git clone https://github.com/EthicalML/vulkan-kompute.git
git submodule update --init --recursive
python setup.py develop
>>> import kp
>>> exit()
Segmentation fault (core dumped)

Reproduce wth Docker

Method 1:

  • cd vulkan-kompute/docker-builders
  • docker build -t komputebuilder -f KomputeBuilder.Dockerfile .
  • Create a Dockerfile called testsegfault.Dockerfile, containing
FROM komputebuilder

RUN apt-get update

RUN add-apt-repository ppa:deadsnakes/ppa

RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y python3.9 python3.9-dev python3.9-distutils

RUN python3.9 -m pip install --upgrade setuptools pip distlib

RUN git clone https://github.com/EthicalML/vulkan-kompute.git /builder/vulkan-kompute --recursive

WORKDIR /builder/vulkan-kompute

RUN python3.9 setup.py install

RUN python3.9 -c "import kp"

  • docker build -f testsegfault.Dockerfile .

Method 2:

  • cd vulkan-kompute/docker-builders
  • Create a Dockerfile KomputeBuilderPython.Dockerfile containing
FROM python:3.9.5-buster

RUN apt-get update -y
RUN apt-get install -y wget
RUN apt-get install -y gnupg
RUN apt-get install -y ca-certificates
RUN apt-get install -y software-properties-common

# Repository to latest cmake
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -
RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'

# Repository for latest git (needed for gh actions)
RUN add-apt-repository -y ppa:git-core/ppa

RUN apt-get install -y git
RUN apt-get install -y cmake g++
RUN apt-get install -y libvulkan-dev
# Swiftshader dependencies
RUN apt-get install -y libx11-dev zlib1g-dev
RUN apt-get install -y libxext-dev

COPY --from=axsauze/swiftshader:0.1 /swiftshader/ /swiftshader/

RUN mkdir builder
WORKDIR /builder
  • docker build -t komputebuilderpython -f KomputeBuilderPython.Dockerfile .
  • Create a Dockerfile called testsegfault.Dockerfile, containing
FROM komputebuilderpython

RUN git clone https://github.com/EthicalML/vulkan-kompute.git /builder/vulkan-kompute --recursive

WORKDIR /builder/vulkan-kompute

RUN python3 -m pip install numpy

RUN python3 setup.py install

RUN python3 -c "import kp"

  • docker build -f testsegfault.Dockerfile .

Notes

Using Method 2, it doesn't segfault if you replace FROM python:3.9.5-buster to FROM python:3.8.10-buster.

Version Status
python:3.9.5-buster Segfault
python:3.8.10-buster Fine
python:3.7.10-buster FIne

I couldn't reproduce the issue on Windows.

System Info

macOS

  • OS: macOS Big Sur 11.2.3
  • Architecture: arm64
  • CMake version: 3.19.6
  • Python version: 3.9

Ubuntu

  • OS: Ubuntu 20.04
  • Architecture: x86_64
  • CMake version: 3.20.1
  • Python version: 3.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant