-
Notifications
You must be signed in to change notification settings - Fork 23
Add CUTLASS v4.3.5 C++ headers to Modal runner image #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,24 @@ | |
| operating_sys = "ubuntu24.04" | ||
| tag = f"{cuda_version}-{flavor}-{operating_sys}" | ||
|
|
||
| # Move this to another file later: | ||
| # === Image Definition === | ||
| # | ||
| # Adding new C++ library dependencies: | ||
| # 1. Add a .run_commands() step that installs headers to /opt/<library_name> | ||
| # Use `git clone --depth 1 --branch <tag>` for header-only libs to keep the image small. | ||
| # 2. Add the include paths to CPLUS_INCLUDE_PATH in the .env() block at the bottom | ||
| # so that nvcc finds them automatically without -I flags. | ||
| # 3. Test changes with test_cutlass_image.py (or a similar script) before deploying: | ||
| # cd src/runners && modal run test_cutlass_image.py | ||
| # | ||
| # For users writing submissions with torch.utils.cpp_extension.load_inline: | ||
| # C++ headers installed on the image (like CUTLASS) require explicit include paths: | ||
| # load_inline( | ||
| # ... | ||
| # extra_include_paths=["/opt/cutlass/include", "/opt/cutlass/tools/util/include"], | ||
| # ) | ||
| # For raw nvcc compilation, CPLUS_INCLUDE_PATH is set so includes work automatically. | ||
| # | ||
| cuda_image = ( | ||
| Image.from_registry(f"nvidia/cuda:{tag}", add_python="3.13") | ||
| .run_commands("ln -sf $(which python) /usr/local/bin/python3") | ||
|
|
@@ -52,6 +69,14 @@ | |
| # "nvmath-python[cu13]~=0.4", | ||
| # "numba-cuda[cu13]~=0.15", | ||
| ) | ||
| # CUTLASS C++ headers for #include <cutlass/...> | ||
| .run_commands( | ||
| "git clone --depth 1 --branch v4.3.5 https://github.com/NVIDIA/cutlass.git /opt/cutlass", | ||
| ) | ||
| .env({ | ||
| "CUTLASS_PATH": "/opt/cutlass", | ||
| "CPLUS_INCLUDE_PATH": "/opt/cutlass/include:/opt/cutlass/tools/util/include", | ||
| }) | ||
|
Comment on lines
+76
to
+79
|
||
| ) | ||
|
|
||
| cuda_image = cuda_image.add_local_python_source( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cloning CUTLASS by tag at build time is a supply-chain risk because tags can be moved/retagged upstream. Consider pinning to an exact commit SHA (and ideally verifying it), e.g., by fetching the repo and checking out a known commit, to make the image build reproducible and tamper-resistant.