Skip to content

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

@jameslamb

Description

@jameslamb

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.

Metadata

Metadata

Assignees

Labels

Build or DepIssues related to building the code or dependenciesCython / PythonCython or Python issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions