Skip to content
Merged
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
23 changes: 16 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ def parse_library_names(libdir):
# add system netcdf library
library_names.extend(['netcdf'])

# move current library name to first
#current = [item for item in library_names if item.startswith('kintera')]
#other = [item for item in library_names if not item.startswith('kintera')]
# 1) non-cuda libs first (consumers)
kintera_non_cuda = [l for l in library_names if l.startswith("kintera") and "cuda" not in l]
# 2) cuda libs last (providers)
Expand Down Expand Up @@ -61,14 +58,26 @@ def parse_library_names(libdir):
"-Wl,-rpath,@loader_path/../pyharp/lib",
]
else:
# ubuntu system has an aggressive linker that removes unused shared libs
# add cuda library explicitly if built with cuda
cuda_linker = []
cuda_libraries = [lib for lib in libraries if "cuda" in lib]
if cuda_libraries:
for lib in cuda_libraries:
libraries.remove(lib)
cuda_linker = (
["-Wl,--no-as-needed"]
+ [f"-l{lib}" for lib in cuda_libraries]
+ ["-Wl,--as-needed"]
)

extra_link_args = [
"-Wl,--no-as-needed",
"-Wl,-rpath,$ORIGIN/lib",
"-Wl,-rpath,$ORIGIN/../torch/lib",
"-Wl,-rpath,$ORIGIN/../pydisort/lib",
"-Wl,-rpath,$ORIGIN/../pyharp/lib",
"-Wl,--as-needed",
]
"-Wl,-rpath,$ORIGIN/../pyharp/lib"
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

Missing comma at the end of line 74. This will cause a syntax error when the list is parsed. The last element in the list should have a trailing comma to match the style of other elements.

Suggested change
"-Wl,-rpath,$ORIGIN/../pyharp/lib"
"-Wl,-rpath,$ORIGIN/../pyharp/lib",

Copilot uses AI. Check for mistakes.
]
extra_link_args += cuda_linker

ext_module = cpp_extension.CppExtension(
name='kintera.kintera',
Expand Down
Loading