From a3aedc738bc4459c91f72dbef324cb60f8270454 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Tue, 22 Oct 2024 02:20:31 -0700 Subject: [PATCH 1/3] Use Cython's `array` to back `Py_ssize_t[::1]` (#1087) In `Array`, `Py_ssize_t[::1]` objects are currently backed by [CPython `array`'s]( https://cython.readthedocs.io/en/latest/src/userguide/memoryviews.html#cpython-array-module ) with some internal bits expressed in Cython. However these are not compatible with [Python's Limited API and Stable ABI]( https://docs.python.org/3/c-api/stable.html#c-api-stability ). To address that, switch to [Cython's own `array` type]( https://cython.readthedocs.io/en/latest/src/userguide/memoryviews.html#cython-arrays ). As this is baked into Cython and doesn't use anything special, it is compatible with Python's Limited API and Stable ABI. xref: https://github.com/rapidsai/build-planning/issues/42 Authors: - https://github.com/jakirkham Approvers: - Peter Andreas Entschev (https://github.com/pentschev) URL: https://github.com/rapidsai/ucx-py/pull/1087 --- ucp/_libs/arr.pyx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ucp/_libs/arr.pyx b/ucp/_libs/arr.pyx index 1f2130f1..635d897c 100644 --- a/ucp/_libs/arr.pyx +++ b/ucp/_libs/arr.pyx @@ -4,13 +4,12 @@ # cython: language_level=3 -from cpython.array cimport array, newarrayobject from cpython.buffer cimport PyBuffer_IsContiguous +from cpython.mem cimport PyMem_Free, PyMem_Malloc from cpython.memoryview cimport ( PyMemoryView_FromObject, PyMemoryView_GET_BUFFER, ) -from cpython.object cimport PyObject from cpython.ref cimport Py_INCREF from cpython.tuple cimport PyTuple_New, PyTuple_SET_ITEM from cython cimport ( @@ -20,6 +19,7 @@ from cython cimport ( nonecheck, wraparound, ) +from cython.view cimport array from libc.stdint cimport uintptr_t from libc.string cimport memcpy @@ -62,13 +62,14 @@ cdef dict itemsize_mapping = { } -cdef array array_Py_ssize_t = array("q") +cdef sizeof_Py_ssize_t = sizeof(Py_ssize_t) -cdef inline Py_ssize_t[::1] new_Py_ssize_t_array(Py_ssize_t n): - return newarrayobject( - (array_Py_ssize_t).ob_type, n, array_Py_ssize_t.ob_descr - ) +cdef Py_ssize_t[::1] new_Py_ssize_t_array(Py_ssize_t n): + cdef array a = array((n,), sizeof_Py_ssize_t, b"q", "c", False) + a.data = PyMem_Malloc(n * sizeof(Py_ssize_t)) + a.callback_free_data = PyMem_Free + return a @auto_pickle(False) From 317b2207a6709cd3870e0cdd4649a1b9125f4c43 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 29 Oct 2024 18:16:51 -0500 Subject: [PATCH 2/3] remove unnecessary sccache configuration, other small CI changes (#1089) Contributes to https://github.com/rapidsai/build-planning/issues/111 Proposes some small packaging/CI changes, matching similar changes being made across RAPIDS. * updating to the latest `rapids-dependency-file-generator` (v1.16.0) * removing unnecessary calls to `rapids-configure-sccache` (this project does not use `sccache`) ## Notes for Reviewers I'd originally started this PR with the goal of printing `sccache` stats in builds here... but realized this project does not use `sccache`. I chose not to pursue adding `sccache` here. The fact that this project doesn't use CMake means it'd take some effort to figure out how to inject `sccache` into the compilation (`CC` / `CXX` environment variables? something else?). Conda and wheel builds are only spending around 20 seconds actually compiling Cython code, so it doesn't seem worth the effort. Authors: - James Lamb (https://github.com/jameslamb) Approvers: - Mike Sarahan (https://github.com/msarahan) URL: https://github.com/rapidsai/ucx-py/pull/1089 --- .pre-commit-config.yaml | 2 +- ci/build_python.sh | 2 -- ci/build_wheel.sh | 14 ++++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index df6e0b46..dcd83501 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - --fix - --rapids-version=24.12 - repo: https://github.com/rapidsai/dependency-file-generator - rev: v1.13.11 + rev: v1.16.0 hooks: - id: rapids-dependency-file-generator args: ["--clean"] diff --git a/ci/build_python.sh b/ci/build_python.sh index 1e423cc1..2fdcd640 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -5,8 +5,6 @@ set -euo pipefail rapids-configure-conda-channels -source rapids-configure-sccache - source rapids-date-string rapids-print-env diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 7db292dd..f3f69ddd 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -3,17 +3,19 @@ set -euo pipefail -package_name="ucx-py" -underscore_package_name=$(echo "${package_name}" | tr "-" "_") - -source rapids-configure-sccache source rapids-date-string rapids-generate-version > ./VERSION RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" -python -m pip wheel . -w dist --no-deps --disable-pip-version-check --config-settings rapidsai.disable-cuda=false +python -m pip wheel \ + -v \ + -w dist \ + --no-deps \ + --disable-pip-version-check \ + --config-settings rapidsai.disable-cuda=false \ + . mkdir -p final_dist python -m auditwheel repair \ @@ -25,4 +27,4 @@ python -m auditwheel repair \ --exclude "libuct.so.0" \ dist/* -RAPIDS_PY_WHEEL_NAME="${underscore_package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 final_dist +RAPIDS_PY_WHEEL_NAME="ucx_py_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 python final_dist From 07db62707d0cedf9b17770b505930cbed3de07c1 Mon Sep 17 00:00:00 2001 From: GALI PREM SAGAR Date: Mon, 4 Nov 2024 08:04:06 -0600 Subject: [PATCH 3/3] Switch pytest traceback to `native` (#1075) In cudf & cuml we have observed a ~10% to ~20% respectively speed up of pytest suite execution by switching pytest traceback to `--native`: ``` currently: 102474 passed, 2117 skipped, 902 xfailed in 892.16s (0:14:52) --tb=short: 102474 passed, 2117 skipped, 902 xfailed in 898.99s (0:14:58) --tb=no: 102474 passed, 2117 skipped, 902 xfailed in 815.98s (0:13:35) --tb=native: 102474 passed, 2117 skipped, 902 xfailed in 820.92s (0:13:40) ``` This PR makes similar change to `ucx-py` repo. xref: https://github.com/rapidsai/cudf/pull/16851 Authors: - GALI PREM SAGAR (https://github.com/galipremsagar) - Peter Andreas Entschev (https://github.com/pentschev) Approvers: - Peter Andreas Entschev (https://github.com/pentschev) - Mike Sarahan (https://github.com/msarahan) URL: https://github.com/rapidsai/ucx-py/pull/1075 --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 654091b6..c616b71a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,6 +109,7 @@ skip = [ [tool.pytest.ini_options] xfail_strict = true +addopts = "--tb=native" [tool.rapids-build-backend] build-backend = "setuptools.build_meta"