Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cuda_core/build_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _determine_cuda_major_version() -> str:
_extensions = None


def _build_cuda_core():
def _build_cuda_core(strip=False):
# Customizing the build hooks is needed because we must defer cythonization until cuda-bindings,
# now a required build-time dependency that's dynamically installed via the other hook below,
# is installed. Otherwise, cimport any cuda.bindings modules would fail!
Expand Down Expand Up @@ -136,6 +136,9 @@ def get_sources(mod_name):

all_include_dirs = [os.path.join(_get_cuda_path(), "include")]
extra_compile_args = []
extra_link_args = []
if strip and sys.platform == "linux":
extra_link_args += ["-Wl,--strip-all"]
if COMPILE_FOR_COVERAGE:
# CYTHON_TRACE_NOGIL indicates to trace nogil functions. It is not
# related to free-threading builds.
Expand All @@ -152,6 +155,7 @@ def get_sources(mod_name):
+ all_include_dirs,
language="c++",
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
)
for mod in module_names()
)
Expand Down Expand Up @@ -254,7 +258,7 @@ def _add_cython_include_paths_to_pth(wheel_path: str) -> None:


def build_editable(wheel_directory, config_settings=None, metadata_directory=None):
_build_cuda_core()
_build_cuda_core(strip=False)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be passing strip=True?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad -- this is the editable one.

I find it usual that editable installs are implicitly different. Other build systems I've seen would just have a --debug flag to indicate building an unstripped, debuggable binary. I don't think we should piggyback on editable for debuggable (though I realize cuda_bindings already does that).

wheel_name = _build_meta.build_editable(wheel_directory, config_settings, metadata_directory)

# Patch the .pth file to add Cython include paths
Expand All @@ -265,7 +269,7 @@ def build_editable(wheel_directory, config_settings=None, metadata_directory=Non


def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
_build_cuda_core()
_build_cuda_core(strip=True)
return _build_meta.build_wheel(wheel_directory, config_settings, metadata_directory)


Expand Down
Loading