Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 33 additions & 15 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ">=3.10.0"
python-version: ">=3.11.0"

- name: Verify QuadBLAS submodule
run: |
ls -la quaddtype/numpy_quaddtype/QBLAS/
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/

- name: Install cibuildwheel
run: pip install cibuildwheel==2.20.0
run: pip install cibuildwheel==3.1.4

- name: Build wheels
env:
CIBW_BUILD: "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64"
CIBW_BUILD: "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64 cp313t-manylinux_x86_64 cp314-manylinux_x86_64 cp314t-manylinux_x86_64"
CIBW_ENABLE: cpython-prerelease cpython-freethreading
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD_VERBOSITY: "3"
CIBW_BEFORE_ALL: |
Expand All @@ -64,7 +65,11 @@ jobs:
auditwheel repair -w {dest_dir} --plat manylinux_2_28_x86_64 {wheel}
CIBW_TEST_COMMAND: |
pip install {package}[test]
pytest -s {project}/tests
if python -c "import sys; exit(0 if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else 1)"; then
pytest --parallel-threads=10 --iterations=10 {project}/tests
else
pytest -s {project}/tests
fi
CIBW_TEST_EXTRAS: "test"
run: |
python -m cibuildwheel --output-dir wheelhouse
Expand All @@ -90,7 +95,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: ">=3.11.0"

- name: Install dependencies
run: |
Expand All @@ -117,12 +122,16 @@ jobs:
ls -la quaddtype/numpy_quaddtype/QBLAS/
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/

- name: Install cibuildwheel
run: pip install cibuildwheel==2.20.0
- name: Installing Python dependencies
run: |
pip install -U pip
pip install cibuildwheel==3.1.4
pip install pytest-run-parallel

- name: Build wheels
env:
CIBW_BUILD: "cp310-* cp311-* cp312-*"
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-* cp313t-* cp314t-*"
CIBW_ENABLE: cpython-prerelease cpython-freethreading
CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }}
CIBW_BUILD_VERBOSITY: "3"
CIBW_ENVIRONMENT: >
Expand All @@ -136,7 +145,11 @@ jobs:
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_TEST_COMMAND: |
pip install {package}[test]
pytest -s {project}/tests
if python -c "import sys; exit(0 if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else 1)"; then
pytest --parallel-threads=10 --iterations=10 {project}/tests
else
pytest -s {project}/tests
fi
CIBW_TEST_EXTRAS: "test"
run: |
python -m cibuildwheel --output-dir wheelhouse
Expand Down Expand Up @@ -165,10 +178,10 @@ jobs:
with:
arch: ${{ matrix.architecture }}

- name: Set up Python 3.10
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: ">=3.11.0"
architecture: ${{ matrix.architecture }}

- name: Install CMake
Expand All @@ -193,12 +206,13 @@ jobs:
shell: bash -l {0}
run: |
pip install -U pip
pip install cibuildwheel==2.20.0 ninja meson meson-python numpy delvewheel pytest
pip install cibuildwheel==3.1.4 ninja meson meson-python numpy delvewheel pytest

- name: Build wheels
env:
CIBW_BUILD: "cp310-* cp311-* cp312-*"
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-* cp313-*"
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-* cp313t-* cp314t-*"
CIBW_ENABLE: cpython-prerelease cpython-freethreading
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-*"
CIBW_ARCHS_WINDOWS: ${{ matrix.architecture == 'x86' && 'x86' || 'AMD64' }}
CIBW_BUILD_VERBOSITY: "3"
DISTUTILS_USE_SDK: "1"
Expand All @@ -215,7 +229,11 @@ jobs:
CIBW_REPAIR_WHEEL_COMMAND: 'delvewheel repair -w {dest_dir} {wheel} --add-path C:\sleef\bin'
CIBW_TEST_COMMAND: |
pip install {package}[test]
pytest -s {project}/tests
if python -c "import sys; exit(0 if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else 1)"; then
pytest --parallel-threads=10 --iterations=10 {project}/tests
else
pytest -s {project}/tests
fi
CIBW_TEST_EXTRAS: test
CIBW_TEST_FAIL_FAST: 1
shell: pwsh
Expand Down
20 changes: 15 additions & 5 deletions quaddtype/numpy_quaddtype/src/quaddtype_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,17 @@ get_sleef_constant(PyObject *self, PyObject *args)
else if (strcmp(constant_name, "precision") == 0) {
Py_DECREF(result);
// precision = int(-log10(epsilon))
int64_t precision = Sleef_cast_to_int64q1(Sleef_negq1(Sleef_log10q1_u10(SLEEF_QUAD_EPSILON)));
int64_t precision =
Sleef_cast_to_int64q1(Sleef_negq1(Sleef_log10q1_u10(SLEEF_QUAD_EPSILON)));
return PyLong_FromLong(precision);
}
else if (strcmp(constant_name, "resolution") == 0) {
// precision = int(-log10(epsilon))
int64_t precision = Sleef_cast_to_int64q1(Sleef_negq1(Sleef_log10q1_u10(SLEEF_QUAD_EPSILON)));
int64_t precision =
Sleef_cast_to_int64q1(Sleef_negq1(Sleef_log10q1_u10(SLEEF_QUAD_EPSILON)));
// resolution = 10 ** (-precision)
result->value.sleef_value = Sleef_powq1_u10(Sleef_cast_from_int64q1(10), Sleef_cast_from_int64q1(-precision));
result->value.sleef_value =
Sleef_powq1_u10(Sleef_cast_from_int64q1(10), Sleef_cast_from_int64q1(-precision));
}
else {
PyErr_SetString(PyExc_ValueError, "Unknown constant name");
Expand All @@ -109,9 +112,12 @@ static PyMethodDef module_methods[] = {
{NULL, NULL, 0, NULL}};

static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT, .m_name = "_quaddtype_main",
PyModuleDef_HEAD_INIT,
.m_name = "_quaddtype_main",
.m_doc = "Quad (128-bit) floating point Data Type for NumPy with multiple backends",
.m_size = -1, .m_methods = module_methods};
.m_size = -1,
.m_methods = module_methods,
};

PyMODINIT_FUNC
PyInit__quaddtype_main(void)
Expand All @@ -123,6 +129,10 @@ PyInit__quaddtype_main(void)
return NULL;
}

#ifdef Py_GIL_DISABLED
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
#endif

if (init_quadprecision_scalar() < 0)
goto error;

Expand Down
1 change: 1 addition & 0 deletions quaddtype/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ dependencies = [
[project.optional-dependencies]
test = [
"pytest",
"pytest-run-parallel"
]
Loading