Skip to content

Commit

Permalink
Merge pull request #181 from clEsperanto/fix-OSx-int64-incompatiblity
Browse files Browse the repository at this point in the history
enforce 32 bit integer across package
  • Loading branch information
StRigaud authored May 14, 2024
2 parents a928bdb + fe5e182 commit 840e506
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ option(BUILD_SHARED_LIBS OFF)


## CLIc dependency
set(CLIC_REPO_TAG 0.10.2) # branch name for dev
set(CLIC_REPO_TAG 0.10.3) # branch name for dev
set(CLIC_REPO_URL https://github.com/clEsperanto/CLIc.git)
set(BUILD_OPENCL_BACKEND ON CACHE BOOL "Build with OCL if FOUND" FORCE)
set(BUILD_CUDA_BACKEND ON CACHE BOOL "Build with CUDA if FOUND" FORCE)
Expand Down
4 changes: 2 additions & 2 deletions pyclesperanto/_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ def get(self, origin: tuple = None, region: tuple = None) -> np.ndarray:
"int8": self._read_int8,
"int16": self._read_int16,
"int32": self._read_int32,
"int64": self._read_int64,
# "int64": self._read_int64,
"uint8": self._read_uint8,
"uint16": self._read_uint16,
"uint32": self._read_uint32,
"uint64": self._read_uint64,
# "uint64": self._read_uint64,
}
return caster[self.dtype.name](origin, region)

Expand Down
4 changes: 2 additions & 2 deletions pyclesperanto/_version.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# pyclesperanto version
VERSION_CODE = 0, 10, 2
VERSION_CODE = 0, 10, 3
VERSION_STATUS = ""
VERSION = ".".join(str(x) for x in VERSION_CODE) + VERSION_STATUS

# clic version
CLIC_VERSION_CODE = 0, 10, 2
CLIC_VERSION_CODE = 0, 10, 3
CLIC_VERSION_STATUS = ""
CLIC_VERSION = ".".join(str(x) for x in CLIC_VERSION_CODE) + CLIC_VERSION_STATUS

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ description = "GPU-accelerated image processing in python using OpenCL"
name = "pyclesperanto"
readme = "README.md"
requires-python = ">=3.7"
version = "0.10.2"
version = "0.10.3"

[project.urls]
Documentation = "https://clesperanto.github.io/pyclesperanto/"
Expand Down
28 changes: 10 additions & 18 deletions src/wrapper/array_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ py::object get_np_dtype(const cle::Array::Pointer &array)
{
case cle::dType::FLOAT:
return py::dtype::of<float>();
case cle::dType::INT64:
return py::dtype::of<int64_t>();
// case cle::dType::INT64:
// return py::dtype::of<int64_t>();
case cle::dType::INT32:
return py::dtype::of<int>();
case cle::dType::INT16:
return py::dtype::of<int16_t>();
case cle::dType::INT8:
return py::dtype::of<int8_t>();
case cle::dType::UINT64:
return py::dtype::of<uint64_t>();
// case cle::dType::UINT64:
// return py::dtype::of<uint64_t>();
case cle::dType::UINT32:
return py::dtype::of<uint32_t>();
case cle::dType::UINT16:
Expand All @@ -146,11 +146,7 @@ cle::dType get_cle_dtype(const py::object &type)
{
return cle::dType::FLOAT;
}
else if (np_type.equal(py::dtype("int64")) || np_type.equal(py::dtype("int")))
{
return cle::dType::INT64;
}
else if (np_type.equal(py::dtype("int32")))
else if (np_type.equal(py::dtype("int32")) || np_type.equal(py::dtype("int")) || np_type.equal(py::dtype("int64")))
{
return cle::dType::INT32;
}
Expand All @@ -162,11 +158,7 @@ cle::dType get_cle_dtype(const py::object &type)
{
return cle::dType::INT8;
}
else if (np_type.equal(py::dtype("uint64")))
{
return cle::dType::UINT64;
}
else if (np_type.equal(py::dtype("uint32")))
else if (np_type.equal(py::dtype("uint32")) || np_type.equal(py::dtype("uint64")))
{
return cle::dType::UINT32;
}
Expand Down Expand Up @@ -248,21 +240,21 @@ auto array_(py::module_ &m) -> void
.def("_write", &write_region<int8_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_write", &write_region<int16_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_write", &write_region<int32_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_write", &write_region<int64_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
// .def("_write", &write_region<int64_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_write", &write_region<uint8_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_write", &write_region<uint16_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_write", &write_region<uint32_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_write", &write_region<uint64_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())
// .def("_write", &write_region<uint64_t>, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none())

.def("_read_float32", &read_region<float>, py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_read_int8", &read_region<int8_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_read_int16", &read_region<int16_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_read_int32", &read_region<int32_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_read_int64", &read_region<int64_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
// .def("_read_int64", &read_region<int64_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_read_uint8", &read_region<uint8_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_read_uint16", &read_region<uint16_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_read_uint32", &read_region<uint32_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
.def("_read_uint64", &read_region<uint64_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())
// .def("_read_uint64", &read_region<uint64_t>, py::arg("origin") = py::none(), py::arg("region") = py::none())

.def("copy", &copy_region, py::arg("dst"), py::arg("src_origin") = py::none(), py::arg("dst_origin") = py::none(), py::arg("region") = py::none())
.def("fill", &cle::Array::fill, py::arg("value"))
Expand Down
4 changes: 2 additions & 2 deletions src/wrapper/types_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ auto types_(py::module_ &m) -> void
{
py::enum_<cle::dType> dtype(m, "_DataType");
dtype.value("float32", cle::dType::FLOAT);
dtype.value("int64", cle::dType::INT64);
// dtype.value("int64", cle::dType::INT64);
dtype.value("int32", cle::dType::INT32);
dtype.value("int16", cle::dType::INT16);
dtype.value("int8", cle::dType::INT8);
dtype.value("uint64", cle::dType::UINT64);
// dtype.value("uint64", cle::dType::UINT64);
dtype.value("uint32", cle::dType::UINT32);
dtype.value("uint16", cle::dType::UINT16);
dtype.value("uint8", cle::dType::UINT8);
Expand Down

0 comments on commit 840e506

Please sign in to comment.