PythonOT / POT

POT : Python Optimal Transport
https://PythonOT.github.io/
MIT License
2.43k stars 500 forks source link

Gromov-Wasserstein tests segfault on i386/i686 in version 0.9.1 #521

Open gspr opened 1 year ago

gspr commented 1 year ago

Describe the bug

On the i386/i686 architecture, version 0.9.1's Gromov-Wasserstein test suite segfaults. It does not segfault on any other architecture I have tested on, nor does version 0.9.0 segfault on i386/i686.

To Reproduce

Steps to reproduce the behavior:

  1. On an i386/i686 machine or VM,
  2. build and install POT 0.9.1 and
  3. run pytest test/test_gromov.py and observe a segfault.

Backtrace (POT 0.9.1 is installed system-wide):

test/test_gromov.py ...s...................Fatal Python error: Segmentation fault

Current thread 0xf7b74700 (most recent call first):
  File "/usr/lib/python3/dist-packages/ot/lp/__init__.py", line 346 in emd
  File "/usr/lib/python3/dist-packages/ot/optim.py", line 392 in lp_solver
  File "/usr/lib/python3/dist-packages/ot/optim.py", line 279 in generic_conditional_gradient
  File "/usr/lib/python3/dist-packages/ot/optim.py", line 394 in cg
  File "/usr/lib/python3/dist-packages/ot/gromov/_gw.py", line 468 in fused_gromov_wasserstein
  File "/usr/lib/python3/dist-packages/ot/gromov/_gw.py", line 990 in <listcomp>
  File "/usr/lib/python3/dist-packages/ot/gromov/_gw.py", line 990 in fgw_barycenters
  File "/home/foo/tmp/pot-0.9.1/test/test_gromov.py", line 1332 in test_fgw_barycenter

Code sample

POT's own test/test_gromov.py suffices (see above).

Expected behavior

Tests should pass, or even fail, but definitely not segfault.

Environment (please complete the following information):

Output of the suggested code snippet:

>>> import platform; print(platform.platform())
Linux-5.10.0-25-amd64-i686-with-glibc2.37
>>> import sys; print("Python", sys.version)
Python 3.11.5 (main, Aug 29 2023, 15:31:31) [GCC 13.2.0]
>>> import numpy; print("NumPy", numpy.__version__)
NumPy 1.24.2
>>> import scipy; print("SciPy", scipy.__version__)
SciPy 1.10.1
>>> import ot; print("POT", ot.__version__)
POT 0.9.1

Additional context

Problem does not occur on other architectures. Problem does also not occur on i386/i686 in POT version 0.9.0.

rflamary commented 1 year ago

Hello,

i'm sorry but we do not maintain POT on 32bits processors so we will not fix i686 specific bugs. Of course if you or another contributor find a way to make code compatible for both 64 and 32 bits feel free to propose a PR.

I think this probably comes form default a size of int and long int in the C++ code.