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 unit tests all failing #14

Open
will-gerard opened this issue Jan 20, 2023 · 1 comment
Open

Python unit tests all failing #14

will-gerard opened this issue Jan 20, 2023 · 1 comment

Comments

@will-gerard
Copy link

When I try to run either basic_tests or feasibility_tests, all tests appear to be failing with assertion errors. When I try to run, for example, test_basic_QP from basic_tests, the resulting values for x and y are too far away from the targets:

$ python -m unittest basic_test.basic_tests.test_basic_QP
F
======================================================================
FAIL: test_basic_QP (basic_test.basic_tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "//ppcg/cuosqp/module/tests/basic_test.py", line 42, in test_basic_QP
    nptest.assert_allclose(res.x, np.array([0., 5.]), rtol=1e-4, atol=1e-4)
  File "//ppcg/cuosqp/cuosqp/lib/python3.8/site-packages/numpy/testing/_private/utils.py", line 1590, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "//ppcg/cuosqp/cuosqp/lib/python3.8/site-packages/numpy/testing/_private/utils.py", line 862, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Not equal to tolerance rtol=0.0001, atol=0.0001

Mismatched elements: 2 / 2 (100%)
Max absolute difference: 4.
Max relative difference: 0.8
 x: array([0.75, 1.  ])
 y: array([0., 5.])

----------------------------------------------------------------------
Ran 1 test in 0.638s

FAILED (failures=1)

I am running python version 3.8.10:

$ python --version
Python 3.8.10

And nvcc version 11.1:

$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0

After following the installation instructions in the readme, attempts to run setup.py were failing to locate helper_cuda.cu. To get around this, I cloned https://github.com/nvidia/cuda-samples and added /Common to my Cpath. This allowed the setup.py installation to complete successfully, and now the tests do run, but encounter the assertion error displayed above.

Is this likely an issue with the version of Cuda I am running? Something else environmental? Any help or suggestions would be greatly appreciated!

@mercury1492
Copy link

I am getting the same unittests errors with Windows/python 3.9 (cuosqp compiled with CUDA 11.0 and Microsoft Visual Studio 17).

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

2 participants