cuda.core.ProgramOptions#
- class cuda.core.ProgramOptions(
- name: str | None = 'default_program',
- arch: str | None = None,
- relocatable_device_code: bool | None = None,
- extensible_whole_program: bool | None = None,
- debug: bool | None = None,
- lineinfo: bool | None = None,
- device_code_optimize: bool | None = None,
- ptxas_options: str | list[str] | tuple[str] | None = None,
- max_register_count: int | None = None,
- ftz: bool | None = None,
- prec_sqrt: bool | None = None,
- prec_div: bool | None = None,
- fma: bool | None = None,
- use_fast_math: bool | None = None,
- extra_device_vectorization: bool | None = None,
- link_time_optimization: bool | None = None,
- gen_opt_lto: bool | None = None,
- define_macro: str | tuple[str, str] | list[str | tuple[str, str]] | tuple[str | tuple[str, str], ...] | None = None,
- undefine_macro: str | list[str] | tuple[str] | None = None,
- include_path: str | list[str] | tuple[str] | None = None,
- use_bundled_headers: bool | None = None,
- pre_include: str | list[str] | tuple[str] | None = None,
- no_source_include: bool | None = None,
- std: str | None = None,
- builtin_move_forward: bool | None = None,
- builtin_initializer_list: bool | None = None,
- disable_warnings: bool | None = None,
- restrict: bool | None = None,
- device_as_default_execution_space: bool | None = None,
- device_int128: bool | None = None,
- optimization_info: str | None = None,
- no_display_error_number: bool | None = None,
- diag_error: int | list[int] | tuple[int] | None = None,
- diag_suppress: int | list[int] | tuple[int] | None = None,
- diag_warn: int | list[int] | tuple[int] | None = None,
- brief_diagnostics: bool | None = None,
- time: str | None = None,
- split_compile: int | None = None,
- fdevice_syntax_only: bool | None = None,
- minimal: bool | None = None,
- no_cache: bool | None = None,
- fdevice_time_trace: str | None = None,
- device_float128: bool | None = None,
- frandom_seed: str | None = None,
- ofast_compile: str | None = None,
- pch: bool | None = None,
- create_pch: str | None = None,
- use_pch: str | None = None,
- pch_dir: str | None = None,
- pch_verbose: bool | None = None,
- pch_messages: bool | None = None,
- instantiate_templates_in_pch: bool | None = None,
- extra_sources: list[tuple[str, str | bytes | bytearray]] | tuple[tuple[str, str | bytes | bytearray], ...] | None = None,
- use_libdevice: bool | None = None,
- numba_debug: bool | None = None,
Customizable options for configuring
Program.- name#
Name of the program. If the compilation succeeds, the name is passed down to the generated
ObjectCode. When set to None,"default_program"is used.- Type:
str, optional
- arch#
Pass the SM architecture value, such as
sm_<CC>(for generating CUBIN) orcompute_<CC>(for generating PTX). If not provided, the current device’s architecture will be used.- Type:
str, optional
- relocatable_device_code#
Enable (disable) the generation of relocatable device code. Default: False
- Type:
bool, optional
- extensible_whole_program#
Do extensible whole program compilation of device code. Default: False
- Type:
bool, optional
- debug#
Generate debug information. If –dopt is not specified, then turns off all optimizations. Default: False
- Type:
bool, optional
- device_code_optimize#
Enable device code optimization. When specified along with ‘-G’, enables limited debug information generation for optimized device code. Default: None
- Type:
bool, optional
- ptxas_options#
Specify one or more options directly to ptxas, the PTX optimizing assembler. Options should be strings. For example [“-v”, “-O2”]. Default: None
- max_register_count#
Specify the maximum amount of registers that GPU functions can use. Default: None
- Type:
int, optional
- ftz#
When performing single-precision floating-point operations, flush denormal values to zero or preserve denormal values. Default: False
- Type:
bool, optional
- prec_sqrt#
For single-precision floating-point square root, use IEEE round-to-nearest mode or use a faster approximation. Default: True
- Type:
bool, optional
- prec_div#
For single-precision floating-point division and reciprocals, use IEEE round-to-nearest mode or use a faster approximation. Default: True
- Type:
bool, optional
- fma#
Enables (disables) the contraction of floating-point multiplies and adds/subtracts into floating-point multiply-add operations. Default: True
- Type:
bool, optional
- extra_device_vectorization#
Enables more aggressive device code vectorization in the NVVM optimizer. Default: False
- Type:
bool, optional
- link_time_optimization#
Generate intermediate code for later link-time optimization. Default: False
- Type:
bool, optional
- gen_opt_lto#
Run the optimizer passes before generating the LTO IR. Default: False
- Type:
bool, optional
- define_macro#
Predefine a macro. Can be either a string, in which case that macro will be set to 1, a 2 element tuple of strings, in which case the first element is defined as the second, or a list of strings or tuples. Default: None
- undefine_macro#
Cancel any previous definition of a macro, or list of macros. Default: None
- include_path#
Add the directory or directories to the list of directories to be searched for headers. Default: None
- use_bundled_headers#
Use the CUDA and CCCL headers bundled with NVRTC, installed into a per-user cache directory, instead of requiring a full CUDA Toolkit installation. Implemented via NVRTC’s
--use-bundled-headers=<dir>compiler option, which installs the headers into the cache directory (skipping installation if already present and up to date) and adds that directory to the include search path. NVRTC only. Default: False- Type:
bool, optional
- pre_include#
Preinclude one or more headers during preprocessing. Can be either a string or a list of strings. Default: None
- no_source_include#
Disable the default behavior of adding the directory of each input source to the include path. Default: False
- Type:
bool, optional
- std#
Set language dialect to C++03, C++11, C++14, C++17 or C++20. Default: c++17
- Type:
str, optional
- builtin_move_forward#
Provide builtin definitions of std::move and std::forward. Default: True
- Type:
bool, optional
- builtin_initializer_list#
Provide builtin definitions of std::initializer_list class and member functions. Default: True
- Type:
bool, optional
- restrict#
Programmer assertion that all kernel pointer parameters are restrict pointers. Default: False
- Type:
bool, optional
- device_as_default_execution_space#
Treat entities with no execution space annotation as __device__ entities. Default: False
- Type:
bool, optional
- optimization_info#
Provide optimization reports for the specified kind of optimization. Default: None
- Type:
str, optional
- no_display_error_number#
Disable the display of a diagnostic number for warning messages. Default: False
- Type:
bool, optional
- diag_error#
Emit error for a specified diagnostic message number or comma-separated list of numbers. Default: None
- diag_suppress#
Suppress a specified diagnostic message number or comma-separated list of numbers. Default: None
- diag_warn#
Emit warning for a specified diagnostic message number or comma-separated list of numbers. Default: None
- brief_diagnostics#
Disable or enable showing source line and column info in a diagnostic. Default: False
- Type:
bool, optional
- time#
Generate a CSV table with the time taken by each compilation phase. Default: None
- Type:
str, optional
- fdevice_syntax_only#
Ends device compilation after front-end syntax checking. Default: False
- Type:
bool, optional
- minimal#
Omit certain language features to reduce compile time for small programs. Default: False
- Type:
bool, optional
- fdevice_time_trace#
Generate time trace JSON for profiling compilation (NVRTC only). Default: None
- Type:
str, optional
- device_float128#
Allow __float128 type in device code (NVRTC only). Default: False
- Type:
bool, optional
- frandom_seed#
Set random seed for randomized optimizations (NVRTC only). Default: None
- Type:
str, optional
- ofast_compile#
Fast compilation mode: “0”, “min”, “mid”, or “max” (NVRTC only). Default: None
- Type:
str, optional
- create_pch#
Create precompiled header file (NVRTC only, CUDA 12.8+). Default: None
- Type:
str, optional
- use_pch#
Use specific precompiled header file (NVRTC only, CUDA 12.8+). Default: None
- Type:
str, optional
- pch_messages#
Control PCH diagnostic messages (NVRTC only, CUDA 12.8+). Default: False
- Type:
bool, optional
- instantiate_templates_in_pch#
Control template instantiation in PCH (NVRTC only, CUDA 12.8+). Default: False
- Type:
bool, optional
- extra_sources#
Additional NVVM IR modules to compile together with the main program, specified as
((name1, source1), (name2, source2), ...). Each name is a string identifier used in diagnostic messages. Each source can be a string (textual LLVM IR) or bytes/bytearray (LLVM bitcode). Only supported for the NVVM backend. Default: None
- use_libdevice#
Load NVIDIA’s libdevice math builtins library. Only supported for the NVVM backend. Default: False
- Type:
bool, optional
- numba_debug#
Emit the debug information layout expected by Numba. Recognized only by newer toolkits; compilers that do not support it reject the option with an error. Applies only to the NVVM and NVRTC compilation backends –
code_type="ptx"is processed by the linker, which cannot honor it, so enabling this option there emits aUserWarningand the option is ignored. Default: None- Type:
bool, optional