From 906423d05212055e19f3986095c3714923b47646 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Fri, 26 Apr 2024 12:04:28 +0200 Subject: [PATCH 1/3] enforce 32 bit for Darwin --- src/wrapper/array_.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wrapper/array_.cpp b/src/wrapper/array_.cpp index 8d06efa7..31a9fe74 100644 --- a/src/wrapper/array_.cpp +++ b/src/wrapper/array_.cpp @@ -148,7 +148,11 @@ cle::dType get_cle_dtype(const py::object &type) } else if (np_type.equal(py::dtype("int64")) || np_type.equal(py::dtype("int"))) { +#if __APPLE__ + return cle::dType::INT32; +#else return cle::dType::INT64; +#endif } else if (np_type.equal(py::dtype("int32"))) { @@ -164,7 +168,11 @@ cle::dType get_cle_dtype(const py::object &type) } else if (np_type.equal(py::dtype("uint64"))) { +#if __APPLE__ + return cle::dType::UINT32; +#else return cle::dType::UINT64; +#endif } else if (np_type.equal(py::dtype("uint32"))) { From 2ce62c73ca86c43f3aec010476894c747cf831f5 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Mon, 13 May 2024 17:22:58 +0200 Subject: [PATCH 2/3] update: remove 64bit for all --- CMakeLists.txt | 2 +- pyclesperanto/_array.py | 42 ++++++++++++++++++++--------------------- src/wrapper/array_.cpp | 36 ++++++++++------------------------- src/wrapper/types_.cpp | 4 ++-- 4 files changed, 34 insertions(+), 50 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b02dde7..34a1085e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ option(BUILD_SHARED_LIBS OFF) ## CLIc dependency -set(CLIC_REPO_TAG 0.10.1) # branch name for dev +set(CLIC_REPO_TAG remove-64-bit-type) # 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) diff --git a/pyclesperanto/_array.py b/pyclesperanto/_array.py index 984caf2a..33fedd70 100644 --- a/pyclesperanto/_array.py +++ b/pyclesperanto/_array.py @@ -9,12 +9,12 @@ def _prepare_array(arr) -> np.ndarray: """Converts a given array to a numpy array with C memory layout. - + Parameters ---------- - arr : + arr : The array to convert. - + Returns ------- np.ndarray @@ -37,7 +37,7 @@ def __repr__(self) -> str: def set(self, array: np.ndarray, origin: tuple = None, region: tuple = None) -> None: """Set the content of the Array to the given numpy array. - + Parameters ---------- array : np.ndarray @@ -46,7 +46,7 @@ def set(self, array: np.ndarray, origin: tuple = None, region: tuple = None) -> The origin of the region of interest, by default None region : tuple, optional The region of interest, by default None - + Returns ------- Array @@ -73,14 +73,14 @@ def set(self, array: np.ndarray, origin: tuple = None, region: tuple = None) -> def get(self, origin: tuple = None, region: tuple = None) -> np.ndarray: """Get the content of the Array into a numpy array. - + Parameters ---------- origin : tuple, optional The origin of the region of interest, by default None region : tuple, optional The region of interest, by default None - + Returns ------- np.ndarray @@ -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) @@ -110,7 +110,7 @@ def __array__(self, dtype=None) -> np.ndarray: def to_device(cls, arr, *args, **kwargs): """Create an Array object from a numpy array (same shape, dtype, and memory). - + Parameters ---------- arr : np.ndarray @@ -119,7 +119,7 @@ def to_device(cls, arr, *args, **kwargs): The memory type, by default "buffer" device : Device, optional The device, by default None - + Returns ------- Array @@ -134,7 +134,7 @@ def to_device(cls, arr, *args, **kwargs): def from_array(cls, arr, *args, **kwargs): """Create an Array object from a numpy array (same shape, dtype, and memory). - + Parameters ---------- arr : np.ndarray @@ -143,7 +143,7 @@ def from_array(cls, arr, *args, **kwargs): The memory type, by default "buffer" device : Device, optional The device, by default None - + Returns ------- Array @@ -155,7 +155,7 @@ def from_array(cls, arr, *args, **kwargs): def empty(cls, shape, dtype=float, *args, **kwargs): """Create an empty Array object from a shape. - + Parameters ---------- shape : tuple, list or np.ndarray @@ -166,7 +166,7 @@ def empty(cls, shape, dtype=float, *args, **kwargs): The memory type, by default "buffer" device : Device, optional The device, by default None - + Returns ------- Array @@ -181,12 +181,12 @@ def empty(cls, shape, dtype=float, *args, **kwargs): def empty_like(cls, arr): """Create an empty Array object from an other array. - + Parameters ---------- arr : np.ndarray or Array or other array-like structure The array to create like. - + Returns ------- Array @@ -198,7 +198,7 @@ def empty_like(cls, arr): def zeros(cls, shape, dtype=float, *args, **kwargs): """Create an Array object full of zeros from a shape. - + Parameters ---------- shape : tuple, list or np.ndarray @@ -209,7 +209,7 @@ def zeros(cls, shape, dtype=float, *args, **kwargs): The memory type, by default "buffer" device : Device, optional The device, by default None - + Returns ------- Array @@ -223,12 +223,12 @@ def zeros(cls, shape, dtype=float, *args, **kwargs): def zeros_like(cls, arr): """Create an Array object filled with zeros from an other array. - + Parameters ---------- arr : np.ndarray or Array or other array-like structure The array to create like. - + Returns ------- Array diff --git a/src/wrapper/array_.cpp b/src/wrapper/array_.cpp index 31a9fe74..8bced778 100644 --- a/src/wrapper/array_.cpp +++ b/src/wrapper/array_.cpp @@ -117,16 +117,16 @@ py::object get_np_dtype(const cle::Array::Pointer &array) { case cle::dType::FLOAT: return py::dtype::of(); - case cle::dType::INT64: - return py::dtype::of(); + // case cle::dType::INT64: + // return py::dtype::of(); case cle::dType::INT32: return py::dtype::of(); case cle::dType::INT16: return py::dtype::of(); case cle::dType::INT8: return py::dtype::of(); - case cle::dType::UINT64: - return py::dtype::of(); + // case cle::dType::UINT64: + // return py::dtype::of(); case cle::dType::UINT32: return py::dtype::of(); case cle::dType::UINT16: @@ -146,15 +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"))) - { -#if __APPLE__ - return cle::dType::INT32; -#else - return cle::dType::INT64; -#endif - } - 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; } @@ -166,15 +158,7 @@ cle::dType get_cle_dtype(const py::object &type) { return cle::dType::INT8; } - else if (np_type.equal(py::dtype("uint64"))) - { -#if __APPLE__ - return cle::dType::UINT32; -#else - return cle::dType::UINT64; -#endif - } - 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; } @@ -256,21 +240,21 @@ auto array_(py::module_ &m) -> void .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) - .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) + // .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) - .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) + // .def("_write", &write_region, py::arg("value"), py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_read_float32", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_read_int8", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_read_int16", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_read_int32", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) - .def("_read_int64", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) + // .def("_read_int64", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_read_uint8", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_read_uint16", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("_read_uint32", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) - .def("_read_uint64", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) + // .def("_read_uint64", &read_region, py::arg("origin") = py::none(), py::arg("region") = py::none()) .def("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")) diff --git a/src/wrapper/types_.cpp b/src/wrapper/types_.cpp index a2f9ec7e..0d61a39c 100644 --- a/src/wrapper/types_.cpp +++ b/src/wrapper/types_.cpp @@ -11,11 +11,11 @@ auto types_(py::module_ &m) -> void { py::enum_ 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); From fe5e182fdb46df64aaca2ffa514a3185ed61374c Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Tue, 14 May 2024 13:33:42 +0200 Subject: [PATCH 3/3] bump version 0.10.3 --- CMakeLists.txt | 2 +- pyclesperanto/_version.py | 4 ++-- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34a1085e..1fbcbb9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ option(BUILD_SHARED_LIBS OFF) ## CLIc dependency -set(CLIC_REPO_TAG remove-64-bit-type) # 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) diff --git a/pyclesperanto/_version.py b/pyclesperanto/_version.py index 5d4543bd..13a63a88 100644 --- a/pyclesperanto/_version.py +++ b/pyclesperanto/_version.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 964574ce..240fed92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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/"