Skip to content

CNPreferences

Function reference for CNPreferences. Preferences write LocalPreferences.toml and generally require a fresh Julia process.

Out of the box (no LocalPreferences.toml changes):

SettingDefault
Binary / build modeJLL prebuilt binaries
Broadcast fusionon
FUSE_BROADCAST_MIN_OPS2 (single-op broadcasts stay unfused)
Task scope namesoff

Build-mode setup (JLL / conda / developer) is documented under Build Modes. Fusion usage tips live under Kernel Fusion.

Build mode

CNPreferences.use_jll_binary Function
julia
LegatePreferences.use_jll_binary(; export_prefs = false, force = true)

Tells Legate.jl | cuNumeric.jl to use JLLs. This is the default option.

source
CNPreferences.use_conda Function
julia
LegatePreferences.use_conda(conda_env::String; export_prefs = false, force = true)

Tells Legate.jl | cuNumeric.jl to use existing conda install. We make no gurantees of compiler compatability at this time.

Expects conda_env to be the absolute path to the root of the environment. For example, /home/julialegate/.conda/envs/cunumeric-gpu

source
CNPreferences.use_developer_mode Function

LegatePreferences.use_developer_mode(; use_jll=true, path=nothing, export_prefs = false, force = true)

Tells Legate.jl | cuNumeric.jl to enable developer mode. Developer mode allows you to build from source.

To disable using legate_jll or cupynumeric_jll: use_jll=false If you disable legate_jll or cupynumeric_jll, then you need to set a path to Legate|cuPyNumeric with path="/path/to/Legate|cuPyNumeric"

source

Broadcast fusion

Defaults: fusion on, FUSE_BROADCAST_MIN_OPS == 2.

julia
using CNPreferences

CNPreferences.enable_broadcast_fusion!()           # default
CNPreferences.disable_broadcast_fusion!()
CNPreferences.set_broadcast_fusion_min_ops!(2)     # default
CNPreferences.set_broadcast_fusion_min_ops!(1)     # also fuse single-ops

set_broadcast_fusion_min_ops! counts Broadcasted nodes (ops) in the tree:

  • 2 (default): fuse multi-op trees such as y .= @. a * b + c. Single-ops like y .= cos.(x) stay on the unfused C-API path.

  • 1: fuse every eligible expression, including single-ops.

Set the preference in one Julia process, then start a fresh process to use it.

CNPreferences.set_broadcast_fusion! Function
julia
set_broadcast_fusion!(enabled::Bool; export_prefs=false, force=true)

Enable or disable broadcast fusion. When enabled (the default), eligible nested broadcast expressions compile to a single CUDA PTX kernel.

Restart Julia after changing this preference.

source
CNPreferences.enable_broadcast_fusion! Function
julia
enable_broadcast_fusion!(; export_prefs=false, force=true)

Enable broadcast fusion. This is the default.

source
CNPreferences.disable_broadcast_fusion! Function
julia
disable_broadcast_fusion!(; export_prefs=false, force=true)

Disable broadcast fusion so each broadcast node runs as a separate cuNumeric op.

source
CNPreferences.set_broadcast_fusion_min_ops! Function
julia
set_broadcast_fusion_min_ops!(n::Integer; export_prefs=false, force=true)

Fuse only when a broadcast tree has at least n ops. Default is 2, so single ops such as y .= cos.(x) stay on the unfused path. Set n = 1 to fuse those too. Values must be >= 1.

Restart Julia after changing this preference.

source

Task scope names

Default: off. Optional Legate task-scope naming for debugging. When on, cuNumeric wraps many ops in Legate.with_scope so provenance strings (for example matmul, zeros, or fused broadcast.<expr>) appear in Legate logs and profiles. Pair this with --logging legate=debug --log-to-file (or --profile) in LEGATE_CONFIG; see Debugging.

julia
using CNPreferences
CNPreferences.enable_task_scope_names!()
CNPreferences.disable_task_scope_names!()  # default

Restart Julia after changing this preference (it is compile-time in cuNumeric.jl).

CNPreferences.set_task_scope_names! Function
julia
set_task_scope_names!(enabled::Bool; export_prefs=false, force=true)

Enable or disable named Legate task scopes for debugging. Default is off.

When enabled, cuNumeric wraps ops in Legate.with_scope so provenance labels appear in Legate logs/profiles. Pair with LEGATE_CONFIG flags such as --logging legate=debug --log-to-file (set before Julia starts). Requires a fresh Julia process after changing the preference.

source
CNPreferences.enable_task_scope_names! Function
julia
enable_task_scope_names!(; export_prefs=false, force=true)

Enable named Legate task scopes for debugging. See set_task_scope_names!.

source
CNPreferences.disable_task_scope_names! Function
julia
disable_task_scope_names!(; export_prefs=false, force=true)

Disable named Legate task scopes. This is the default.

source