Skip to content

Commit 1d48f34

Browse files
authored
Merge pull request #134 from SwayamInSync/main
2 parents 37c753d + 8695461 commit 1d48f34

File tree

3 files changed

+49
-20
lines changed

3 files changed

+49
-20
lines changed

.github/workflows/build_wheels.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,20 @@ jobs:
2727
- name: Set up Python
2828
uses: actions/setup-python@v4
2929
with:
30-
python-version: ">=3.10.0"
30+
python-version: ">=3.11.0"
3131

3232
- name: Verify QuadBLAS submodule
3333
run: |
3434
ls -la quaddtype/numpy_quaddtype/QBLAS/
3535
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
3636
3737
- name: Install cibuildwheel
38-
run: pip install cibuildwheel==2.20.0
38+
run: pip install cibuildwheel==3.1.4
3939

4040
- name: Build wheels
4141
env:
42-
CIBW_BUILD: "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64"
42+
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"
43+
CIBW_ENABLE: cpython-prerelease cpython-freethreading
4344
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
4445
CIBW_BUILD_VERBOSITY: "3"
4546
CIBW_BEFORE_ALL: |
@@ -64,7 +65,11 @@ jobs:
6465
auditwheel repair -w {dest_dir} --plat manylinux_2_28_x86_64 {wheel}
6566
CIBW_TEST_COMMAND: |
6667
pip install {package}[test]
67-
pytest -s {project}/tests
68+
if python -c "import sys; exit(0 if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else 1)"; then
69+
pytest --parallel-threads=10 --iterations=10 {project}/tests
70+
else
71+
pytest -s {project}/tests
72+
fi
6873
CIBW_TEST_EXTRAS: "test"
6974
run: |
7075
python -m cibuildwheel --output-dir wheelhouse
@@ -90,7 +95,7 @@ jobs:
9095
- name: Set up Python
9196
uses: actions/setup-python@v4
9297
with:
93-
python-version: "3.10"
98+
python-version: ">=3.11.0"
9499

95100
- name: Install dependencies
96101
run: |
@@ -117,12 +122,16 @@ jobs:
117122
ls -la quaddtype/numpy_quaddtype/QBLAS/
118123
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
119124
120-
- name: Install cibuildwheel
121-
run: pip install cibuildwheel==2.20.0
125+
- name: Installing Python dependencies
126+
run: |
127+
pip install -U pip
128+
pip install cibuildwheel==3.1.4
129+
pip install pytest-run-parallel
122130
123131
- name: Build wheels
124132
env:
125-
CIBW_BUILD: "cp310-* cp311-* cp312-*"
133+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-* cp313t-* cp314t-*"
134+
CIBW_ENABLE: cpython-prerelease cpython-freethreading
126135
CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }}
127136
CIBW_BUILD_VERBOSITY: "3"
128137
CIBW_ENVIRONMENT: >
@@ -136,7 +145,11 @@ jobs:
136145
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
137146
CIBW_TEST_COMMAND: |
138147
pip install {package}[test]
139-
pytest -s {project}/tests
148+
if python -c "import sys; exit(0 if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else 1)"; then
149+
pytest --parallel-threads=10 --iterations=10 {project}/tests
150+
else
151+
pytest -s {project}/tests
152+
fi
140153
CIBW_TEST_EXTRAS: "test"
141154
run: |
142155
python -m cibuildwheel --output-dir wheelhouse
@@ -165,10 +178,10 @@ jobs:
165178
with:
166179
arch: ${{ matrix.architecture }}
167180

168-
- name: Set up Python 3.10
181+
- name: Set up Python
169182
uses: actions/setup-python@v4
170183
with:
171-
python-version: "3.10"
184+
python-version: ">=3.11.0"
172185
architecture: ${{ matrix.architecture }}
173186

174187
- name: Install CMake
@@ -193,12 +206,13 @@ jobs:
193206
shell: bash -l {0}
194207
run: |
195208
pip install -U pip
196-
pip install cibuildwheel==2.20.0 ninja meson meson-python numpy delvewheel pytest
209+
pip install cibuildwheel==3.1.4 ninja meson meson-python numpy delvewheel pytest
197210
198211
- name: Build wheels
199212
env:
200-
CIBW_BUILD: "cp310-* cp311-* cp312-*"
201-
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-* cp313-*"
213+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-* cp313t-* cp314t-*"
214+
CIBW_ENABLE: cpython-prerelease cpython-freethreading
215+
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-*"
202216
CIBW_ARCHS_WINDOWS: ${{ matrix.architecture == 'x86' && 'x86' || 'AMD64' }}
203217
CIBW_BUILD_VERBOSITY: "3"
204218
DISTUTILS_USE_SDK: "1"
@@ -215,7 +229,11 @@ jobs:
215229
CIBW_REPAIR_WHEEL_COMMAND: 'delvewheel repair -w {dest_dir} {wheel} --add-path C:\sleef\bin'
216230
CIBW_TEST_COMMAND: |
217231
pip install {package}[test]
218-
pytest -s {project}/tests
232+
if python -c "import sys; exit(0 if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else 1)"; then
233+
pytest --parallel-threads=10 --iterations=10 {project}/tests
234+
else
235+
pytest -s {project}/tests
236+
fi
219237
CIBW_TEST_EXTRAS: test
220238
CIBW_TEST_FAIL_FAST: 1
221239
shell: pwsh

quaddtype/numpy_quaddtype/src/quaddtype_main.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,17 @@ get_sleef_constant(PyObject *self, PyObject *args)
8080
else if (strcmp(constant_name, "precision") == 0) {
8181
Py_DECREF(result);
8282
// precision = int(-log10(epsilon))
83-
int64_t precision = Sleef_cast_to_int64q1(Sleef_negq1(Sleef_log10q1_u10(SLEEF_QUAD_EPSILON)));
83+
int64_t precision =
84+
Sleef_cast_to_int64q1(Sleef_negq1(Sleef_log10q1_u10(SLEEF_QUAD_EPSILON)));
8485
return PyLong_FromLong(precision);
8586
}
8687
else if (strcmp(constant_name, "resolution") == 0) {
8788
// precision = int(-log10(epsilon))
88-
int64_t precision = Sleef_cast_to_int64q1(Sleef_negq1(Sleef_log10q1_u10(SLEEF_QUAD_EPSILON)));
89+
int64_t precision =
90+
Sleef_cast_to_int64q1(Sleef_negq1(Sleef_log10q1_u10(SLEEF_QUAD_EPSILON)));
8991
// resolution = 10 ** (-precision)
90-
result->value.sleef_value = Sleef_powq1_u10(Sleef_cast_from_int64q1(10), Sleef_cast_from_int64q1(-precision));
92+
result->value.sleef_value =
93+
Sleef_powq1_u10(Sleef_cast_from_int64q1(10), Sleef_cast_from_int64q1(-precision));
9194
}
9295
else {
9396
PyErr_SetString(PyExc_ValueError, "Unknown constant name");
@@ -109,9 +112,12 @@ static PyMethodDef module_methods[] = {
109112
{NULL, NULL, 0, NULL}};
110113

111114
static struct PyModuleDef moduledef = {
112-
PyModuleDef_HEAD_INIT, .m_name = "_quaddtype_main",
115+
PyModuleDef_HEAD_INIT,
116+
.m_name = "_quaddtype_main",
113117
.m_doc = "Quad (128-bit) floating point Data Type for NumPy with multiple backends",
114-
.m_size = -1, .m_methods = module_methods};
118+
.m_size = -1,
119+
.m_methods = module_methods,
120+
};
115121

116122
PyMODINIT_FUNC
117123
PyInit__quaddtype_main(void)
@@ -123,6 +129,10 @@ PyInit__quaddtype_main(void)
123129
return NULL;
124130
}
125131

132+
#ifdef Py_GIL_DISABLED
133+
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
134+
#endif
135+
126136
if (init_quadprecision_scalar() < 0)
127137
goto error;
128138

quaddtype/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ dependencies = [
2121
[project.optional-dependencies]
2222
test = [
2323
"pytest",
24+
"pytest-run-parallel"
2425
]

0 commit comments

Comments
 (0)