Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cython deprecation warning: "The 'IF' statement is deprecated" #6231

Open
jameslamb opened this issue Jan 16, 2025 · 1 comment
Open

Cython deprecation warning: "The 'IF' statement is deprecated" #6231

jameslamb opened this issue Jan 16, 2025 · 1 comment
Labels
Build or Dep Issues related to building the code or dependencies Cython / Python Cython or Python issue

Comments

@jameslamb
Copy link
Member

Description

cuML distributes both GPU-accelerated and CPU-only packages.

At build time, it controls whether GPU-related bits of the Cython code are built by passing GPUBUILD through to Cython.

list(APPEND CYTHON_FLAGS
"--compile-time-env GPUBUILD=0")

That guards imports like this:

IF GPUBUILD == 1:
import pylibraft.common.handle
import cuml.common.cuda

That pattern is deprecated in the version of Cython used in builds for the 25.02 release, resulting in many of this type of warning in CI logs:

[347/584] Transpiling base.pyx to base.cxx
warning: /__w/cuml/cuml/python/cuml/cuml/internals/base.pyx:74:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See cython/cython#4310

cuML builds should be adapted to use a different pattern.

Benefits of this work

  • allows cuML to be built with newer versions of Cython (assuming Cython eventually removes support for IF)

Acceptance Criteria

  • cuML build do not use the deprecated Cython IF pattern for conditional compilation

Approach

See the discussion and links in cython/cython#4310 for ideas on how to approach this.

Notes

I'm opening this to track, but not planning to personally work on it.

@jameslamb jameslamb added Build or Dep Issues related to building the code or dependencies Cython / Python Cython or Python issue labels Jan 16, 2025
@dantegd
Copy link
Member

dantegd commented Jan 20, 2025

Refactoring our Python code to have the C++ calls separate from the Python layer, which will allow us to stop using the Cython IF has been on our backlog for quite some time now, and hopefully something we can do on of the upcoming versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build or Dep Issues related to building the code or dependencies Cython / Python Cython or Python issue
Projects
None yet
Development

No branches or pull requests

2 participants