-
Notifications
You must be signed in to change notification settings - Fork 306
Build cuda.core RDC test fixtures without Bash #2335
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
Merged
+129
−43
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
447ab4b
Run nvcc fixture build without Bash
rwgk e449386
Document narrow nvcc skip detection
rwgk d7bdbd7
Merge branch 'main' into run_nvcc_without_bash
rwgk d15c8fc
Merge branch 'main' into run_nvcc_without_bash
rwgk aea8bb5
Document nvcc test environment requirements
rwgk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| """Build the relocatable-device-code fixtures used by cuda.core tests.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| import subprocess | ||
| import tempfile | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| def _run(command: list[str]) -> None: | ||
| print(f"+ {subprocess.list2cmdline(command)}") | ||
| result = subprocess.run(command) # noqa: S603 | ||
| if result.returncode != 0: | ||
| raise SystemExit(result.returncode) | ||
|
|
||
|
|
||
| def main() -> None: | ||
| script_dir = Path(__file__).resolve().parent | ||
| source_path = script_dir / "saxpy.cu" | ||
| final_object_path = script_dir / "saxpy.o" | ||
| final_library_path = script_dir / ("saxpy.lib" if os.name == "nt" else "saxpy.a") | ||
|
|
||
| nvcc_extra_flags = ["-std=c++17"] | ||
| if os.name == "nt": | ||
| nvcc_extra_flags.extend(["-Xcompiler", "/Zc:preprocessor"]) | ||
|
|
||
| with tempfile.TemporaryDirectory(prefix="build_test_binaries-", dir=script_dir) as temp_dir: | ||
| temp_dir_path = Path(temp_dir) | ||
| object_path = temp_dir_path / final_object_path.name | ||
| library_path = temp_dir_path / final_library_path.name | ||
|
|
||
| _run( | ||
| [ | ||
| "nvcc", | ||
| "-dc", | ||
| *nvcc_extra_flags, | ||
| "-arch=all-major", | ||
| "-o", | ||
| str(object_path), | ||
| str(source_path), | ||
| ] | ||
| ) | ||
| _run(["nvcc", "-lib", "-o", str(library_path), str(object_path)]) | ||
|
|
||
| object_path.replace(final_object_path) | ||
| library_path.replace(final_library_path) | ||
|
|
||
| for path in (final_object_path, final_library_path): | ||
| print(f"{path}: {path.stat().st_size} bytes") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.