cuosqp icon indicating copy to clipboard operation
cuosqp copied to clipboard

Python unit tests all failing

Open will-gerard opened this issue 1 year ago • 1 comments

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!

will-gerard avatar Jan 20 '23 20:01 will-gerard