XanaduAI / thewalrus

A library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling.
https://the-walrus.readthedocs.io
Apache License 2.0
100 stars 55 forks source link

FTBFS 0.16.2 on aarch64 #290

Closed ggardet closed 2 years ago

ggardet commented 2 years ago

Expected behavior

Build fails on aarch64, but it should succeed.

Actual behavior

Build error log:

[   61s] creating build/temp.linux-aarch64-3.9/thewalrus
[   61s] compile options: '-I./thewalrus -I./include -I/usr/lib64/python3.9/site-packages/numpy/core/include -I/usr/lib64/python3.9/site-packages/numpy/core/include -Ibuild/src.linux-aarch64-3.9/numpy/distutils/include -I/usr/include/python3.9 -c'
[   61s] extra options: '-O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mbranch-protection=standard -flto=auto -fPIC -Werror=return-type -fopenmp -Wall -funwind-tables -fstack-clash-protection -fasynchronous-unwind-tables -std=c++11 -fopenmp -shared'
[   61s] g++: ./thewalrus/libwalrus.cpp
[   61s] In file included from /usr/lib64/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1969,
[   61s]                  from /usr/lib64/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
[   61s]                  from /usr/lib64/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:4,
[   61s]                  from ./thewalrus/libwalrus.cpp:695:
[   61s] /usr/lib64/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
[   61s]    17 | #warning "Using deprecated NumPy API, disable it with " \
[   61s]       |  ^~~~~~~
[   62s] In file included from ./thewalrus/../include/libwalrus.hpp:19,
[   62s]                  from ./thewalrus/libwalrus.cpp:710:
[   62s] ./include/permanent.hpp:25:9: error: ‘__float128’ does not name a type; did you mean ‘_Float128’?
[   62s]    25 | typedef __float128 qp;
[   62s]       |         ^~~~~~~~~~
[   62s]       |         _Float128
[   62s] ./include/permanent.hpp: In function ‘double libwalrus::permanent_quad(std::vector<double>&)’:
[   62s] ./include/permanent.hpp:346:17: error: ‘qp’ was not declared in this scope
[   62s]   346 |     std::vector<qp> matq(mat.begin(), mat.end());
[   62s]       |                 ^~
[   62s] ./include/permanent.hpp:346:19: error: template argument 1 is invalid
[   62s]   346 |     std::vector<qp> matq(mat.begin(), mat.end());
[   62s]       |                   ^
[   62s] ./include/permanent.hpp:346:19: error: template argument 2 is invalid
[   62s] ./include/permanent.hpp:346:48: error: expression list treated as compound expression in initializer [-fpermissive]
[   62s]   346 |     std::vector<qp> matq(mat.begin(), mat.end());
[   62s]       |                                                ^
[   62s] ./include/permanent.hpp:346:46: error: cannot convert ‘std::vector<double>::iterator’ to ‘int’ in initialization
[   62s]   346 |     std::vector<qp> matq(mat.begin(), mat.end());
[   62s]       |                                       ~~~~~~~^~
[   62s]       |                                              |
[   62s]       |                                              std::vector<double>::iterator
[   62s] ./include/permanent.hpp:347:7: error: expected ‘;’ before ‘perm’
[   62s]   347 |     qp perm = permanent(matq);
[   62s]       |       ^~~~~
[   62s]       |       ;
[   62s] ./include/permanent.hpp:348:32: error: ‘perm’ was not declared in this scope
[   62s]   348 |     return static_cast<double>(perm);
[   62s]       |                                ^~~~
[   62s] ./include/permanent.hpp:346:21: warning: unused variable ‘matq’ [-Wunused-variable]
[   62s]   346 |     std::vector<qp> matq(mat.begin(), mat.end());
[   62s]       |                     ^~~~
[   62s] ./include/permanent.hpp: In function ‘double libwalrus::perm_BBFG_qp(std::vector<double>&)’:
[   62s] ./include/permanent.hpp:565:17: error: ‘qp’ was not declared in this scope
[   62s]   565 |     std::vector<qp> matqp(mat.begin(), mat.end());
[   62s]       |                 ^~
[   62s] ./include/permanent.hpp:565:19: error: template argument 1 is invalid
[   62s]   565 |     std::vector<qp> matqp(mat.begin(), mat.end());
[   62s]       |                   ^
[   62s] ./include/permanent.hpp:565:19: error: template argument 2 is invalid
[   62s] ./include/permanent.hpp:565:49: error: expression list treated as compound expression in initializer [-fpermissive]
[   62s]   565 |     std::vector<qp> matqp(mat.begin(), mat.end());
[   62s]       |                                                 ^
[   62s] ./include/permanent.hpp:565:47: error: cannot convert ‘std::vector<double>::iterator’ to ‘int’ in initialization
[   62s]   565 |     std::vector<qp> matqp(mat.begin(), mat.end());
[   62s]       |                                        ~~~~~~~^~
[   62s]       |                                               |
[   62s]       |                                               std::vector<double>::iterator
[   62s] ./include/permanent.hpp:566:7: error: expected ‘;’ before ‘perm’
[   62s]   566 |     qp perm = perm_BBFG(matqp);
[   62s]       |       ^~~~~
[   62s]       |       ;
[   62s] ./include/permanent.hpp:567:32: error: ‘perm’ was not declared in this scope
[   62s]   567 |     return static_cast<double>(perm);
[   62s]       |                                ^~~~
[   62s] ./include/permanent.hpp:565:21: warning: unused variable ‘matqp’ [-Wunused-variable]
[   62s]   565 |     std::vector<qp> matqp(mat.begin(), mat.end());
[   62s]       |                     ^~~~~
[   62s] In file included from ./thewalrus/../include/libwalrus.hpp:20,
[   62s]                  from ./thewalrus/libwalrus.cpp:710:
[   62s] ./include/hermite_multidimensional.hpp: In instantiation of ‘T* libwalrus::hermite_multidimensional_cpp(const std::vector<T>&, const std::vector<T>&, const int&) [with T = std::complex<double>]’:
[   62s] ./thewalrus/libwalrus.cpp:6227:82:   required from here
[   62s] ./include/hermite_multidimensional.hpp:108:11: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class std::complex<double>’; use assignment or value-initialization instead [-Wclass-memaccess]
[   62s]   108 |     memset(&H[0],0,sizeof(T)*Hdim);
[   62s]       |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
[   62s] In file included from ./include/stdafx.h:19,
[   62s]                  from ./include/trace_hafnian.hpp:22,
[   62s]                  from ./thewalrus/../include/libwalrus.hpp:16,
[   62s]                  from ./thewalrus/libwalrus.cpp:710:
[   62s] /usr/include/c++/11/complex:1229:11: note: ‘class std::complex<double>’ declared here
[   62s]  1229 |     class complex<double>
[   62s]       |           ^~~~~~~~~~~~~~~
[   62s] In file included from ./thewalrus/../include/libwalrus.hpp:20,
[   62s]                  from ./thewalrus/libwalrus.cpp:710:
[   62s] ./include/hermite_multidimensional.hpp: In instantiation of ‘T* libwalrus::renorm_hermite_multidimensional_cpp(const std::vector<T>&, const std::vector<T>&, const int&) [with T = std::complex<double>]’:
[   62s] ./thewalrus/libwalrus.cpp:6709:89:   required from here
[   62s] ./include/hermite_multidimensional.hpp:165:11: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class std::complex<double>’; use assignment or value-initialization instead [-Wclass-memaccess]
[   62s]   165 |     memset(&H[0],0,sizeof(T)*Hdim);
[   62s]       |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
[   62s] In file included from ./include/stdafx.h:19,
[   62s]                  from ./include/trace_hafnian.hpp:22,
[   62s]                  from ./thewalrus/../include/libwalrus.hpp:16,
[   62s]                  from ./thewalrus/libwalrus.cpp:710:
[   62s] /usr/include/c++/11/complex:1229:11: note: ‘class std::complex<double>’ declared here
[   62s]  1229 |     class complex<double>
[   62s]       |           ^~~~~~~~~~~~~~~
[   62s] In file included from ./thewalrus/../include/libwalrus.hpp:20,
[   62s]                  from ./thewalrus/libwalrus.cpp:710:
[   62s] ./include/hermite_multidimensional.hpp: In instantiation of ‘T* libwalrus::interferometer_cpp(const std::vector<T>&, const int&) [with T = std::complex<double>]’:
[   62s] ./thewalrus/libwalrus.cpp:7156:72:   required from here
[   62s] ./include/hermite_multidimensional.hpp:217:11: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class std::complex<double>’; use assignment or value-initialization instead [-Wclass-memaccess]
[   62s]   217 |     memset(&H[0],0,sizeof(T)*Hdim);
[   62s]       |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
[   62s] In file included from ./include/stdafx.h:19,
[   62s]                  from ./include/trace_hafnian.hpp:22,
[   62s]                  from ./thewalrus/../include/libwalrus.hpp:16,
[   62s]                  from ./thewalrus/libwalrus.cpp:710:
[   62s] /usr/include/c++/11/complex:1229:11: note: ‘class std::complex<double>’ declared here
[   62s]  1229 |     class complex<double>
[   62s]       |           ^~~~~~~~~~~~~~~
[   62s] error: Command "g++ -Wno-unused-result -Wsign-compare -DNDEBUG -mbranch-protection=standard -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -mbranch-protection=standard -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -mbranch-protection=standard -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -mbranch-protection=standard -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -fopenmp -fPIC -I./thewalrus -I./include -I/usr/lib64/python3.9/site-packages/numpy/core/include -I/usr/lib64/python3.9/site-packages/numpy/core/include -Ibuild/src.linux-aarch64-3.9/numpy/distutils/include -I/usr/include/python3.9 -c ./thewalrus/libwalrus.cpp -o build/temp.linux-aarch64-3.9/thewalrus/libwalrus.o -MMD -MF build/temp.linux-aarch64-3.9/thewalrus/libwalrus.o.d -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mbranch-protection=standard -flto=auto -fPIC -Werror=return-type -fopenmp -Wall -funwind-tables -fstack-clash-protection -fasynchronous-unwind-tables -std=c++11 -fopenmp -shared" failed with exit status 1
[   62s] 
[   62s] ########### EXT COMPILER OPTIMIZATION ###########
[   62s] Platform      : 
[   62s]   Architecture: aarch64
[   62s]   Compiler    : gcc
[   62s] 
[   62s] CPU baseline  : 
[   62s]   Requested   : 'min'
[   62s]   Enabled     : NEON NEON_FP16 NEON_VFPV4 ASIMD
[   62s]   Flags       : none
[   62s]   Extra checks: none
[   62s] 
[   62s] CPU dispatch  : 
[   62s]   Requested   : 'max -xop -fma4'
[   62s]   Enabled     : ASIMDHP ASIMDDP
[   62s]   Generated   : none

Reproduces how often

100% on openSUSE Tumbleweed aarch64.

System information

openSUSE Tumbleweed.

Source code

No response

Tracebacks

No response

Additional information

No response

CatalinaAlbornoz commented 2 years ago

Hi @ggardet, thank you for pointing out this bug. The team will work on finding a fix.

brownj85 commented 2 years ago

Hi @ggardet , would you be able to check if you can build the branch from #296?

ggardet commented 2 years ago

296 on top of 0.16.2 fixes the build, but it fails on test on aarch64:

[  138s] thewalrus/tests/test_hafnian.py::TestHafnianWrapper::test_real_wrapper Fatal Python error: /var/tmp/rpm-tmp.KxmHrY: line 39:  2390 Segmentation fault 

And also on ppc64le:

[  303s] thewalrus/tests/test_hafnian.py::TestHafnianWrapper::test_real_wrapper Fatal Python error: Segmentation fault
[  303s] 
[  303s] Thread 0x00007fffa8a938c0 (most recent call first):
[  303s]   File "/home/abuild/rpmbuild/BUILDROOT/python-thewalrus-0.16.2-16.1.ppc64le/usr/lib64/python3.9/site-packages/thewalrus/_hafnian.py", line 214 in hafnian
[  303s]   File "/home/abuild/rpmbuild/BUILD/thewalrus-0.16.2/thewalrus/tests/test_hafnian.py", line 135 in test_real_wrapper
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/python.py", line 183 in pytest_pyfunc_call
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/python.py", line 1641 in runtest
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/runner.py", line 162 in pytest_runtest_call
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/runner.py", line 255 in <lambda>
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/runner.py", line 311 in from_call
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/runner.py", line 254 in call_runtest_hook
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/runner.py", line 215 in call_and_report
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/runner.py", line 126 in runtestprotocol
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/runner.py", line 109 in pytest_runtest_protocol
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/main.py", line 348 in pytest_runtestloop
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/main.py", line 323 in _main
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/main.py", line 269 in wrap_session
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/main.py", line 316 in pytest_cmdline_main
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
[  303s]   File "/usr/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 162 in main
[  303s]   File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 185 in console_main
[  303s]   File "/usr/bin/pytest-3.9", line 33 in <module>
[  303s] /var/tmp/rpm-tmp.puaZ07: line 39:  2470 Segmentation fault      PYTHONPATH=${PYTHONPATH:+$PYTHONPATH:}/home/abuild/rpmbuild/BUILDROOT/python-thewalrus-0.16.2-16.1.ppc64le/usr/lib64/python3.9/site-packages 
CatalinaAlbornoz commented 2 years ago

Thank you for checking @ggardet !

thisac commented 2 years ago

Closing this since it should be fixed in the latest release. The Walrus no longer contains any C++ dependencies, and should work fine on all platforms. @ggardet Let me know if you're still having issues.