Skip to content

Complex math errors compiling under clang 5 / Windows #8768

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

Closed
matthew-brett opened this issue Mar 10, 2017 · 5 comments
Closed

Complex math errors compiling under clang 5 / Windows #8768

matthew-brett opened this issue Mar 10, 2017 · 5 comments

Comments

@matthew-brett
Copy link
Contributor

Here I have compiled with the clang-cl.exe frontend replacing the standard visual studio 2015 cl.exe binary. I first installed http://llvm.org/pre-releases/win-snapshots/LLVM-5.0.0-r295586-win64.exe from http://llvm.org/builds , then:

PS C:\Program Files (x86)\Microsoft Visual Studio 14.0\vc\bin\amd64> cp 'C:\Program Files\LLVM\msbuild-bin\cl.exe' .

This results in the following test failures:

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'arcsin'>, [-2, 2], [1j, 1j], 1, -1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mb312\AppData\Roaming\Python\Python35\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "C:\repos\numpy\numpy\core\tests\test_umath.py", line 2075, in _check_branch_cut
    assert_(np.all(np.absolute(y0.imag - yp.imag) < atol), (y0, yp))
  File "C:\repos\numpy\numpy\testing\utils.py", line 91, in assert_
    raise AssertionError(smsg)
AssertionError: (array([-1.57079633+0.j,  1.57079633+0.j]), array([-1.57079633+1.3169579j,  1.57079633+1.3169579j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts(<ufunc 'arcsinh'>, [-2j, 2j], [1, 1], -1, 1, True)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mb312\AppData\Roaming\Python\Python35\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "C:\repos\numpy\numpy\core\tests\test_umath.py", line 2074, in _check_branch_cut
    assert_(np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp))
  File "C:\repos\numpy\numpy\testing\utils.py", line 91, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ 0.-1.57079633j,  0.+1.57079633j]), array([ 1.3169579-1.57079633j,  1.3169579+1.57079633j]))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'arcsin'>, [-2, 2], [1j, 1j], 1, -1, True, <clas
s 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mb312\AppData\Roaming\Python\Python35\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "C:\repos\numpy\numpy\core\tests\test_umath.py", line 2075, in _check_branch_cut
    assert_(np.all(np.absolute(y0.imag - yp.imag) < atol), (y0, yp))
  File "C:\repos\numpy\numpy\testing\utils.py", line 91, in assert_
    raise AssertionError(smsg)
AssertionError: (array([-1.57079637+0.j,  1.57079637+0.j], dtype=complex64), array([-1.57078254+1.31695795j,  1.57078254
+1.31695795j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_branch_cuts_complex64(<ufunc 'arcsinh'>, [-2j, 2j], [1, 1], -1, 1, True, <cla
ss 'numpy.complex64'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mb312\AppData\Roaming\Python\Python35\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "C:\repos\numpy\numpy\core\tests\test_umath.py", line 2074, in _check_branch_cut
    assert_(np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp))
  File "C:\repos\numpy\numpy\testing\utils.py", line 91, in assert_
    raise AssertionError(smsg)
AssertionError: (array([ 0.-1.57079637j,  0.+1.57079637j], dtype=complex64), array([ 1.31695795-1.57078254j,  1.31695795
+1.57078254j], dtype=complex64))

======================================================================
FAIL: test_umath.TestComplexFunctions.test_loss_of_precision(<class 'numpy.complex64'>,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mb312\AppData\Roaming\Python\Python35\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "C:\repos\numpy\numpy\core\tests\test_umath.py", line 1969, in check_loss_of_precision
    assert_(np.all(d < 1e-15))
  File "C:\repos\numpy\numpy\testing\utils.py", line 91, in assert_
    raise AssertionError(smsg)
AssertionError

There are no test errors compiling and testing the same numpy checkout with Visual C++ cl.exe (numpy commit 9bba99d). Any hints as to what might be going on?

@bashtage
Copy link
Contributor

@matthew-brett Have you tried this anytime recently? I've been trying this on some extensions that need uint128 and have had good success. Do you think that a ClangClCompiler would be worth trying?

@matthew-brett
Copy link
Contributor Author

Hi - sorry - no - I haven't compiled with Clang on Windows recently - but yes - it would be very good to have a CI matrix entry for Clang on Windows.

@bashtage
Copy link
Contributor

Master doesn't build right now due to differences in how intrinsics are included in MSVC and Clang.

1.16.x passes all tests with clang-cl, although I didn't bother building OpenBlas.

@bashtage
Copy link
Contributor

See #13816

@seberg
Copy link
Member

seberg commented Jan 28, 2024

Going to close this, there is a new/remaining issue around einsum, but I think this is just outdated now (and the linked PRs give you to more work). Yes: CI matrix might be nice though.

@seberg seberg closed this as completed Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants