Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ksimpson-work committed Nov 27, 2024
1 parent a23d815 commit 03128c8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
10 changes: 4 additions & 6 deletions cuda_core/cuda/core/experimental/_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class ProgramOptions:
Default: None
Maps to: --dopt on (-dopt)
ptxas_options : Union[str, List[str]], optional
Specify one or more options directly to ptxas, the PTX optimizing assembler. Options should be strings without
hyphens. For example ["v", "O2"].
Specify one or more options directly to ptxas, the PTX optimizing assembler. Options should be strings.
For example ["-v", "-O2"].
Default: None
Maps to: --ptxas-options <options> (-Xptxas)
maxrregcount : int, optional
Expand Down Expand Up @@ -239,8 +239,8 @@ def __post_init__(self):
self._formatted_options.append("--device-debug")
if self.generate_line_info is not None and self.generate_line_info:
self._formatted_options.append("--generate-line-info")
if self.dopt is not None:
self._formatted_options.append(f"--dopt={'on' if self.dopt else 'off'}")
if self.device_optimize is not None:
self._formatted_options.append(f"--dopt={'on' if self.device_optimize else 'off'}")
if self.ptxas_options is not None:
self._formatted_options.append("--ptxas-options")
if isinstance(self.ptxas_options, list):
Expand Down Expand Up @@ -320,8 +320,6 @@ def __post_init__(self):
self._formatted_options.append("--device-int128")
if self.optimization_info is not None:
self._formatted_options.append(f"--optimization-info={self.optimization_info}")
if self.display_error_number is not None and self.display_error_number:
self._formatted_options.append("--display-error-number")
if self.no_display_error_number is not None and self.no_display_error_number:
self._formatted_options.append("--no-display-error-number")
if self.diag_error is not None:
Expand Down
4 changes: 0 additions & 4 deletions cuda_core/examples/saxpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
prog = Program(code, code_type="c++", options=program_options)
mod = prog.compile(
"cubin",
options=(
"-std=c++11",
"-arch=sm_" + "".join(f"{i}" for i in dev.compute_capability),
),
logs=sys.stdout,
name_expressions=("saxpy<float>", "saxpy<double>"),
)
Expand Down
1 change: 0 additions & 1 deletion cuda_core/examples/vector_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# prepare program
program_options = ProgramOptions(std="c++17", gpu_architecture="sm_" + "".join(f"{i}" for i in dev.compute_capability))
prog = Program(code, code_type="c++", options=program_options)

mod = prog.compile("cubin", name_expressions=("vector_add<float>",))

# run in single precision
Expand Down
15 changes: 10 additions & 5 deletions cuda_core/tests/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ def test_program_with_various_options(init_cuda):
code = 'extern "C" __global__ void my_kernel() {}'

options_list = [
ProgramOptions(device_w=True, dopt=True, ptxas_options="-v"),
ProgramOptions(ptxas_options="-v"),
ProgramOptions(ptxas_options=["-v", "-O3"]),
ProgramOptions(device_optimize=True, device_debug=True),
ProgramOptions(relocatable_device_code=True, maxrregcount=32),
ProgramOptions(ftz=True, prec_sqrt=False, prec_div=False),
ProgramOptions(fmad=False, use_fast_math=True),
ProgramOptions(extra_device_vectorization=True, modify_stack_limit=False),
ProgramOptions(extra_device_vectorization=True),
ProgramOptions(dlink_time_opt=True, gen_opt_lto=True),
ProgramOptions(optix_ir=True, jump_table_density=50),
ProgramOptions(device_stack_protector=True, define_macro="MY_MACRO"),
ProgramOptions(define_macro="MY_MACRO"),
ProgramOptions(define_macro=("MY_MACRO", "99")),
ProgramOptions(define_macro=[("MY_MACRO", "99")]),
ProgramOptions(define_macro=[("MY_MACRO", "99"), ("MY_OTHER_MACRO", "100")]),
ProgramOptions(undefine_macro=["MY_MACRO", "MY_OTHER_MACRO"]),
ProgramOptions(undefine_macro="MY_MACRO", include_path="/usr/local/include"),
ProgramOptions(pre_include="my_header.h", no_source_include=True),
ProgramOptions(builtin_initializer_list=False, disable_warnings=True),
ProgramOptions(restrict=True, device_as_default_execution_space=True),
ProgramOptions(device_int128=True, optimization_info="inline"),
ProgramOptions(display_error_number=False, no_display_error_number=True),
ProgramOptions(no_display_error_number=True),
ProgramOptions(diag_error="1234", diag_suppress="5678"),
ProgramOptions(diag_warn="91011", brief_diagnostics=True),
ProgramOptions(time="compile_time.csv", split_compile=4),
Expand Down

0 comments on commit 03128c8

Please sign in to comment.