-
Notifications
You must be signed in to change notification settings - Fork 117
Add conan files #1184
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
Draft
codingwithmagga
wants to merge
7
commits into
NVIDIA:main
Choose a base branch
from
codingwithmagga:codingwithmagga/fix-359-package-manager-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add conan files #1184
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
63e18f1
Fix typo
codingwithmagga ed95173
Add conan files
codingwithmagga b7dda5e
Merge branch 'main' into codingwithmagga/fix-359-package-manager-support
codingwithmagga 5994b7e
Update documentation
codingwithmagga 07bbc83
Merge branch 'codingwithmagga/fix-359-package-manager-support' of htt…
codingwithmagga 5f306cc
Fix cr comments
codingwithmagga 8b803ce
Update documentation with generic matx version for conan
codingwithmagga 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| .cache | ||
| build*/ | ||
| *.pyc | ||
| CMakeUserPresets.json | ||
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,50 @@ | ||
| from conan import ConanFile | ||
| from conan.tools.cmake import CMake | ||
|
|
||
| class MatxConan(ConanFile): | ||
| """ | ||
| MatX Conan recipe for GPU-accelerated numerical computing. | ||
|
|
||
| NOTE: Network Dependency During Package Creation | ||
| ================================================== | ||
| During 'conan create .', the package() method runs CMake's configure phase, which | ||
| automatically fetches CCCL (CUDA C++ Core Libraries) from GitHub via CPM. This means | ||
| internet access is required for packaging, even in offline scenarios. | ||
|
|
||
| For offline/air-gapped deployments: | ||
| 1. On an internet-enabled system, export CPM_SOURCE_CACHE and run 'conan create .' | ||
| 2. Transfer the populated CPM cache to the offline system | ||
| 3. Set CPM_SOURCE_CACHE before using the offline package | ||
|
|
||
| See the build documentation for detailed offline deployment instructions. | ||
| """ | ||
| name = "matx" | ||
| version = "1.0.0" | ||
| license = "BSD 3-Clause License" | ||
| homepage = "https://github.com/NVIDIA/MatX/" | ||
| topics = ("hpc", "gpu", "cuda", "gpgpu", "gpu-computing") | ||
|
|
||
| package_type = "header-library" | ||
| no_copy_source = True | ||
| description = ( | ||
| "MatX is a modern C++ library for numerical computing on NVIDIA GPUs and CPUs. " | ||
| "Near-native performance can be achieved while using a simple syntax common in higher-level languages such as Python or MATLAB." | ||
| ) | ||
|
|
||
| settings = "os", "compiler", "build_type", "arch" | ||
| exports_sources = "CMakeLists.txt", "include/*", "cmake/*", "public/*", "LICENSE" | ||
|
|
||
| generators = "CMakeToolchain" | ||
|
|
||
| def package(self): | ||
| cmake = CMake(self) | ||
| cmake.configure() | ||
|
codingwithmagga marked this conversation as resolved.
|
||
| cmake.install() | ||
|
|
||
| def package_info(self): | ||
| self.cpp_info.set_property("cmake_target_name", "matx::matx") | ||
| self.cpp_info.set_property("cmake_find_mode", "none") | ||
| self.cpp_info.builddirs = ["lib/cmake/matx"] | ||
| self.cpp_info.includedirs = ["include"] | ||
| self.cpp_info.bindirs = [] | ||
| self.cpp_info.libdirs = [] | ||
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,14 @@ | ||
| cmake_minimum_required(VERSION 3.25.2) | ||
|
|
||
| if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) | ||
| set(CMAKE_CUDA_ARCHITECTURES "native") | ||
| message(STATUS "Using native GPU architecture since CMAKE_CUDA_ARCHITECTURES not defined") | ||
| endif() | ||
|
|
||
| project(test_package LANGUAGES CXX CUDA) | ||
|
|
||
| find_package(matx CONFIG REQUIRED) | ||
|
|
||
| add_executable(${PROJECT_NAME} test_package.cu) | ||
|
|
||
| target_link_libraries(${PROJECT_NAME} PRIVATE matx::matx) |
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,30 @@ | ||
| import os | ||
|
|
||
| from conan import ConanFile | ||
| from conan.tools.build import can_run | ||
| from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout | ||
|
|
||
| class TestPackageConan(ConanFile): | ||
| settings = "os", "compiler", "build_type", "arch" | ||
| generators = "CMakeDeps", "VirtualRunEnv" | ||
| test_type = "explicit" | ||
|
|
||
| def requirements(self): | ||
| self.requires(self.tested_reference_str) | ||
|
|
||
| def layout(self): | ||
| cmake_layout(self) | ||
|
|
||
| def generate(self): | ||
| tc = CMakeToolchain(self) | ||
| tc.generate() | ||
|
|
||
| def build(self): | ||
| cmake = CMake(self) | ||
| cmake.configure() | ||
| cmake.build() | ||
|
|
||
| def test(self): | ||
| if can_run(self): | ||
| bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
| self.run(bin_path, env="conanrun") |
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,15 @@ | ||
| #include "matx.h" | ||
|
|
||
| #include <cassert> | ||
| #include <cstdio> | ||
| #include <math.h> | ||
|
|
||
| int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) | ||
| { | ||
| auto a = matx::make_tensor<float>({10}); | ||
| a.SetVals({1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); | ||
|
|
||
| matx::print(a); | ||
|
|
||
| return 0; | ||
| } |
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.