Skip to content

Commit d8bb582

Browse files
committed
Adding Python GIL release commands.
1 parent 0a8b53c commit d8bb582

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python_bindings/pyfastpfor.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ PYBIND11_PLUGIN(pyfastpfor) {
107107

108108
m.def("delta1", [](py::array_t<uint32_t, py::array::c_style> input, size_t inputSize) -> void {
109109
uint32_t* buff = input.mutable_data();
110+
py::gil_scoped_release l;
111+
110112
Delta::fastDelta(buff, inputSize);
111113
}, py::arg("input"), py::arg("inputSize"),
112114
"In-place computation of differences between adjacent numbers.\n\n"
@@ -124,6 +126,8 @@ PYBIND11_PLUGIN(pyfastpfor) {
124126
m.def("delta4",
125127
[](py::array_t<uint32_t, py::array::c_style> input, size_t inputSize) -> void {
126128
uint32_t* buff = input.mutable_data();
129+
py::gil_scoped_release l;
130+
127131
Delta::deltaSIMD(buff, inputSize);
128132
}, py::arg("input"), py::arg("inputSize"),
129133
"In-place computation of differences between numbers that are 4 indices apart.\n"
@@ -142,6 +146,8 @@ PYBIND11_PLUGIN(pyfastpfor) {
142146

143147
m.def("prefixSum1", [](py::array_t<uint32_t, py::array::c_style> input, size_t inputSize) -> void {
144148
uint32_t* buff = input.mutable_data();
149+
py::gil_scoped_release l;
150+
145151
Delta::fastinverseDelta2(buff, inputSize);
146152
}, py::arg("input"), py::arg("inputSize"),
147153
"In-place inversion of delta1.\n\n"
@@ -159,6 +165,8 @@ PYBIND11_PLUGIN(pyfastpfor) {
159165
m.def("prefixSum4",
160166
[](py::array_t<uint32_t, py::array::c_style> input, size_t inputSize) -> void {
161167
uint32_t* buff = input.mutable_data();
168+
py::gil_scoped_release l;
169+
162170
Delta::inverseDeltaSIMD(buff, inputSize);
163171
}, py::arg("input"), py::arg("inputSize"),
164172
"In-place computation inversion of delta4.\n"

0 commit comments

Comments
 (0)