question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wheels segfault when on CUDA

See original GitHub issue

Expected behavior and actual behavior.

Something is still wrong with the 1.8.5.post1 wheels: When importing from Shapely in a certain way, I later-on get segfaults when running code on the GPU.

(My guess is that somehow the way the post-release was done in https://github.com/shapely/shapely/issues/1567 is unusual and broken.)

Steps to reproduce the problem.

python -c "from shapely.geometry import Polygon; import torch; torch.randn(10).cuda()"
Segmentation fault (core dumped)

(This is the minimal example I could come up with. There are lots of real segfaults when doing other CUDA stuff with this version of Shapely.)

It goes away with importing all of Shapely.

It also goes away when installing 1.8.5.post1 from source (either pip install --no-binary shapely --force-reinstall shapely or pip install --force-reinstall git+https://github.com/shapely/shapely@maint-1.8).

Operating system

This is Linux with Python 3.8. (I tried different versions of Pytorch and CUDA toolkit – always the same.)

Shapely version and provenance

1.8.5.post1 wheel as published on PyPI

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jorisvandenbosschecommented, Nov 18, 2022

(BTW, import shapely of course does not do anything, because it’s just the namespace pkg on 1.8.x. But from shapely import * works without crashing. So that’s the workaround I actually meant.)

What I think is happening here is that from shapely import * is also not doing anything (for the same reason). So the reason that this “workaround” seems to work, is also because it just not yet imports anything, just like import shapely (and in contrast with import shapely.geometry).

So the issue is still that in general importing actual shapely functionality before importing torch gives segfaults.

0reactions
bertskycommented, Nov 11, 2022

I certainly understand you cannot require that right now (certainly given we are still in betal), but I would certainly recommend in already trying it out, to ensure we find those other issues and can fix them.

Yes, the problem is that (in my experience) most errors only happen rarely, as they depend on so much from the data side. As soon as we have our data regression test ready, we’ll include prereleases in CI to get early warnings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compilation with cuda.jit randomly fails with segfault #6022
I'm porting a code over to python and using numba with cuda. I'm getting random segfaults that appear to be during the cuda...
Read more >
Theano segmentation fault with cuda-9.0 - Stack Overflow
I tried installing and using Theano with Cuda-9.0 on a P100 node. The installation itself went smooth, but I get Segmentation fault (see ......
Read more >
Pytorch resulting in segfault when calling convert
I am trying to run Pytorch on my Xavier and running into the following issue which creates a segfault. I have installed the...
Read more >
Installation — pytorch_geometric documentation
We provide pip wheels for these packages for all major OS/PyTorch/CUDA ... *_cuda' , or execution simply crashes with Segmentation fault (core dumped)...
Read more >
Segmentation fault - PyTorch Forums
Every time at 95-99% of first epoch, the system crashed with little information (Segmentation fault). I am sure the GPU and CPU memory...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found