Skip to content

Commit 769a713

Browse files
authored
Fixing Windows C++ data types for conda-forge Python 3.10 builds (#155)
* adding py310 test * using pybind dtypes * update dtypes in c++ file too * cibuildwheel syntax * windows cmd on gh actions
1 parent 15205b9 commit 769a713

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

.github/workflows/tests.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
python-version: ["3.8", "3.9"]
17+
python-version: ["3.8", "3.9", "3.10"]
1818
os: [ubuntu-latest, macos-latest, windows-latest]
1919
steps:
2020
- name: Clone the repo
@@ -26,15 +26,10 @@ jobs:
2626
uses: actions/setup-python@v2
2727
with:
2828
python-version: ${{ matrix.python-version }}
29-
- name: Set up windows compilers
30-
uses: ilammy/msvc-dev-cmd@v1
3129
- name: Install dependencies
3230
run: |
3331
python -m pip install -U pip pytest
3432
python -m pip install .
35-
env:
36-
DISTUTILS_USE_SDK: 1
37-
MSSdk: 1
3833
- name: Run tests
3934
run: python -m pytest -v tests
4035

@@ -71,14 +66,10 @@ jobs:
7166
with:
7267
submodules: true
7368
fetch-depth: 0
74-
- uses: ilammy/msvc-dev-cmd@v1
75-
- uses: joerick/cibuildwheel@v1.9.0
69+
- uses: pypa/cibuildwheel@2.5.0
7670
env:
77-
CIBW_BUILD: "cp3?-*"
78-
CIBW_SKIP: "cp35-* *-win32 *-manylinux_i686"
71+
CIBW_SKIP: "*-win32 *-manylinux_i686"
7972
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
80-
DISTUTILS_USE_SDK: 1
81-
MSSdk: 1
8273
- uses: actions/upload-artifact@v2
8374
with:
8475
path: ./wheelhouse/*.whl

src/george/include/george/parser.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ kernels::Kernel* parse_kernel_spec (const py::object& kernel_spec) {
111111
py::function f = py::function(metric.attr("get_parameter_vector"));
112112
py::array_t<double> vector = py::array_t<double>(f(true));
113113
auto data = vector.unchecked<1>();
114-
for (ssize_t i = 0; i < data.shape(0); ++i) {
114+
for (py::ssize_t i = 0; i < data.shape(0); ++i) {
115115
kernel->set_metric_parameter(i, data(i));
116116
}
117117

@@ -172,7 +172,7 @@ kernels::Kernel* parse_kernel_spec (const py::object& kernel_spec) {
172172
py::function f = py::function(metric.attr("get_parameter_vector"));
173173
py::array_t<double> vector = py::array_t<double>(f(true));
174174
auto data = vector.unchecked<1>();
175-
for (ssize_t i = 0; i < data.shape(0); ++i) {
175+
for (py::ssize_t i = 0; i < data.shape(0); ++i) {
176176
kernel->set_metric_parameter(i, data(i));
177177
}
178178

@@ -290,7 +290,7 @@ kernels::Kernel* parse_kernel_spec (const py::object& kernel_spec) {
290290
py::function f = py::function(metric.attr("get_parameter_vector"));
291291
py::array_t<double> vector = py::array_t<double>(f(true));
292292
auto data = vector.unchecked<1>();
293-
for (ssize_t i = 0; i < data.shape(0); ++i) {
293+
for (py::ssize_t i = 0; i < data.shape(0); ++i) {
294294
kernel->set_metric_parameter(i, data(i));
295295
}
296296

@@ -390,7 +390,7 @@ kernels::Kernel* parse_kernel_spec (const py::object& kernel_spec) {
390390
py::function f = py::function(metric.attr("get_parameter_vector"));
391391
py::array_t<double> vector = py::array_t<double>(f(true));
392392
auto data = vector.unchecked<1>();
393-
for (ssize_t i = 0; i < data.shape(0); ++i) {
393+
for (py::ssize_t i = 0; i < data.shape(0); ++i) {
394394
kernel->set_metric_parameter(i, data(i));
395395
}
396396

@@ -451,7 +451,7 @@ kernels::Kernel* parse_kernel_spec (const py::object& kernel_spec) {
451451
py::function f = py::function(metric.attr("get_parameter_vector"));
452452
py::array_t<double> vector = py::array_t<double>(f(true));
453453
auto data = vector.unchecked<1>();
454-
for (ssize_t i = 0; i < data.shape(0); ++i) {
454+
for (py::ssize_t i = 0; i < data.shape(0); ++i) {
455455
kernel->set_metric_parameter(i, data(i));
456456
}
457457

src/george/kernel_interface.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Docs...
4848
auto x1p = x1.unchecked<2>();
4949
auto x2p = x2.unchecked<2>();
5050
size_t n1 = x1p.shape(0), n2 = x2p.shape(0);
51-
if (x1p.shape(1) != ssize_t(self.ndim()) || x2p.shape(1) != ssize_t(self.ndim())) throw george::dimension_mismatch();
51+
if (x1p.shape(1) != py::ssize_t(self.ndim()) || x2p.shape(1) != py::ssize_t(self.ndim())) throw george::dimension_mismatch();
5252
py::array_t<double> result({n1, n2});
5353
auto resultp = result.mutable_unchecked<2>();
5454
for (size_t i = 0; i < n1; ++i) {
@@ -62,7 +62,7 @@ Docs...
6262
interface.def("value_symmetric", [](KernelInterface& self, py::array_t<double> x) {
6363
auto xp = x.unchecked<2>();
6464
size_t n = xp.shape(0);
65-
if (xp.shape(1) != ssize_t(self.ndim())) throw george::dimension_mismatch();
65+
if (xp.shape(1) != py::ssize_t(self.ndim())) throw george::dimension_mismatch();
6666
py::array_t<double> result({n, n});
6767
auto resultp = result.mutable_unchecked<2>();
6868
for (size_t i = 0; i < n; ++i) {
@@ -80,7 +80,7 @@ Docs...
8080
auto x1p = x1.unchecked<2>();
8181
auto x2p = x2.unchecked<2>();
8282
size_t n = x1p.shape(0);
83-
if (ssize_t(n) != x2p.shape(0) || x1p.shape(1) != ssize_t(self.ndim()) || x2p.shape(1) != ssize_t(self.ndim())) throw george::dimension_mismatch();
83+
if (py::ssize_t(n) != x2p.shape(0) || x1p.shape(1) != py::ssize_t(self.ndim()) || x2p.shape(1) != py::ssize_t(self.ndim())) throw george::dimension_mismatch();
8484
py::array_t<double> result(n);
8585
auto resultp = result.mutable_unchecked<1>();
8686
for (size_t i = 0; i < n; ++i) {
@@ -93,7 +93,7 @@ Docs...
9393
auto x1p = x1.unchecked<2>();
9494
auto x2p = x2.unchecked<2>();
9595
size_t n1 = x1p.shape(0), n2 = x2p.shape(0), size = self.size();
96-
if (x1p.shape(1) != ssize_t(self.ndim()) || x2p.shape(1) != ssize_t(self.ndim())) throw george::dimension_mismatch();
96+
if (x1p.shape(1) != py::ssize_t(self.ndim()) || x2p.shape(1) != py::ssize_t(self.ndim())) throw george::dimension_mismatch();
9797
py::array_t<double> result({n1, n2, size});
9898
auto resultp = result.mutable_unchecked<3>();
9999
auto w = which.unchecked<1>();
@@ -109,7 +109,7 @@ Docs...
109109
interface.def("gradient_symmetric", [](KernelInterface& self, py::array_t<unsigned> which, py::array_t<double> x) {
110110
auto xp = x.unchecked<2>();
111111
size_t n = xp.shape(0), size = self.size();
112-
if (xp.shape(1) != ssize_t(self.ndim())) throw george::dimension_mismatch();
112+
if (xp.shape(1) != py::ssize_t(self.ndim())) throw george::dimension_mismatch();
113113
py::array_t<double> result({n, n, size});
114114
auto resultp = result.mutable_unchecked<3>();
115115
auto w = which.unchecked<1>();
@@ -128,7 +128,7 @@ Docs...
128128
auto x1p = x1.unchecked<2>();
129129
auto x2p = x2.unchecked<2>();
130130
size_t n1 = x1p.shape(0), n2 = x2p.shape(0), ndim = self.ndim();
131-
if (x1p.shape(1) != ssize_t(ndim) || x2p.shape(1) != ssize_t(ndim)) throw george::dimension_mismatch();
131+
if (x1p.shape(1) != py::ssize_t(ndim) || x2p.shape(1) != py::ssize_t(ndim)) throw george::dimension_mismatch();
132132
py::array_t<double> result({n1, n2, ndim});
133133
auto resultp = result.mutable_unchecked<3>();
134134
for (size_t i = 0; i < n1; ++i) {
@@ -144,7 +144,7 @@ Docs...
144144
auto x1p = x1.unchecked<2>();
145145
auto x2p = x2.unchecked<2>();
146146
size_t n1 = x1p.shape(0), n2 = x2p.shape(0), ndim = self.ndim();
147-
if (x1p.shape(1) != ssize_t(ndim) || x2p.shape(1) != ssize_t(ndim)) throw george::dimension_mismatch();
147+
if (x1p.shape(1) != py::ssize_t(ndim) || x2p.shape(1) != py::ssize_t(ndim)) throw george::dimension_mismatch();
148148
py::array_t<double> result({n1, n2, ndim});
149149
auto resultp = result.mutable_unchecked<3>();
150150
for (size_t i = 0; i < n1; ++i) {

templates/parser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ kernels::Kernel* parse_kernel_spec (const py::object& kernel_spec) {
100100
py::function f = py::function(metric.attr("get_parameter_vector"));
101101
py::array_t<double> vector = py::array_t<double>(f(true));
102102
auto data = vector.unchecked<1>();
103-
for (ssize_t i = 0; i < data.shape(0); ++i) {
103+
for (py::ssize_t i = 0; i < data.shape(0); ++i) {
104104
kernel->set_metric_parameter(i, data(i));
105105
}
106106

0 commit comments

Comments
 (0)