-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test fixes for codegen; env vars to control algebra selection for pytest
- Loading branch information
1 parent
472ffb2
commit 4f471a5
Showing
3 changed files
with
26 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
import os | ||
from osqp import algebra_available | ||
|
||
|
||
def pytest_generate_tests(metafunc): | ||
|
||
# detect env vars to decide which algebras to include/skip | ||
algebras_include = os.environ.get('OSQP_ALGEBRA_INCLUDE', 'builtin mkl-direct mkl-indirect cuda').split() | ||
algebras_skip = os.environ.get('OSQP_ALGEBRA_SKIP', '').split() | ||
algebras = [x for x in algebras_include if x not in algebras_skip] | ||
|
||
parameters = ('algebra', 'solver_type', 'atol', 'rtol', 'decimal_tol') | ||
values = [] | ||
if algebra_available('builtin'): | ||
values.extend( | ||
[ | ||
('builtin', 'direct', 1e-3, 1e-4, 4), | ||
] | ||
if algebra_available('builtin') and 'builtin' in algebras: | ||
values.append( | ||
('builtin', 'direct', 1e-3, 1e-4, 4), | ||
) | ||
if algebra_available('mkl') and 'mkl-direct' in algebras: | ||
values.append( | ||
('mkl', 'direct', 1e-3, 1e-4, 4), | ||
) | ||
if algebra_available('mkl'): | ||
values.extend( | ||
[ | ||
('mkl', 'direct', 1e-3, 1e-4, 4), | ||
('mkl', 'indirect', 1e-3, 1e-4, 3), | ||
] | ||
if algebra_available('mkl') and 'mkl-indirect' in algebras: | ||
values.append( | ||
('mkl', 'indirect', 1e-3, 1e-4, 3), | ||
) | ||
if algebra_available('cuda'): | ||
values.extend( | ||
[ | ||
('cuda', 'indirect', 1e-2, 1e-3, 2), | ||
] | ||
if algebra_available('cuda') and 'cuda' in algebras: | ||
values.append( | ||
('cuda', 'indirect', 1e-2, 1e-3, 2), | ||
) | ||
|
||
metafunc.parametrize(parameters, values) |