https://github.com/NVIDIA/MatX Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} NVIDIA / MatX Public * Notifications * Fork 55 * Star 805 An efficient C++17 GPU numerical computing library with Python-like syntax nvidia.github.io/matx License BSD-3-Clause license 805 stars 55 forks Activity Star Notifications * Code * Issues 25 * Pull requests 2 * Discussions * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Security * Insights NVIDIA/MatX This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 16 branches 14 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/N] Use Git or checkout with SVN using the web URL. [gh repo clone NVIDIA] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @tbensonatl @cliffburdick tbensonatl and cliffburdick Add FFT1D tensor size checks ... 3aea0e9 Oct 2, 2023 Add FFT1D tensor size checks Add explicit checking of the input/output tensor sizes for 1D FFTs. Throw an exception if the sizes are not as expected, even in Release builds. One consequence of the checks is that they enforce that zero padding applied within the fft() operator be explicit (via the fft_size) param rather than implicit. 3aea0e9 Git stats * 508 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github Update blossom-ci.yml September 7, 2023 08:11 bench Adding FFT convolution benchmarks September 1, 2023 10:16 cmake Updated cuTENSOR/cuTensorNet and added example for trace July 12, 2023 13:34 docs Updating docs and other files for release v0.6.0 October 2, 2023 09:47 docs_input Add window operator input to pwelch (#491) September 27, 2023 09:38 examples Add FFT1D tensor size checks October 2, 2023 16:01 include Add FFT1D tensor size checks October 2, 2023 16:01 public Updates for Offline Deployment and General Bug/QoL Fixes (#349) January 11, 2023 12:35 test Add FFT1D tensor size checks October 2, 2023 16:01 .gitignore Docs cleanup. Enforce warning-as-error for doxygen and sphinx. Fix ou... September 7, 2023 12:26 CITATION.cff Updating docs and other files for release v0.6.0 October 2, 2023 09:47 CMakeLists.txt Updating docs and other files for release v0.6.0 October 2, 2023 09:47 CODE_OF_CONDUCT.md adding code of conduct (#3) October 26, 2021 05:43 CONTRIBUTING.md Adding contributing guide (#7) October 26, 2021 06:48 LICENSE Added license file GitHub can recognize October 26, 2021 13:20 README.md Updating docs and other files for release v0.6.0 October 2, 2023 09:47 add_license.sh Initial commit from internal repo October 25, 2021 09:30 make_matx_release.sh Initial commit from internal repo October 25, 2021 09:30 View code [ ] MatX - GPU-Accelerated Numerical Computing in Modern C++ Table of Contents Requirements Installation Building MatX Integrating MatX With Your Own Projects MatX as a Subdirectory MatX Installed to the System MatX CMake Targets Documentation Supported Data Types Unit Tests Quick Start Guide Release Major Features Discussions Filing Issues Contributing Guide README.md MatX - GPU-Accelerated Numerical Computing in Modern C++ GitHub Releases GitHub License GitHub Documentation 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. FFT resampler The above image shows the Python (Numpy) version of an FFT resampler next to the MatX version. The total runtimes of the NumPy version, CuPy version, and MatX version are shown below: * Python/Numpy: 5360ms (Xeon(R) CPU E5-2698 v4 @ 2.20GHz) * CuPy: 10.6ms (A100) * MatX: 2.54ms (A100) While the code complexity and length are roughly the same, the MatX version shows a 2100x over the Numpy version, and over 4x faster than the CuPy version on the same GPU. Key features include: * [?] MatX is fast. By using existing, optimized libraries as a backend, and efficient kernel generation when needed, no hand-optimizations are necessary * MatX is easy to learn. Users familiar with high-level languages will pick up the syntax quickly * MatX easily integrates with existing libraries and code * Visualize data from the GPU right on a web browser * |[?] IO capabilities for reading/writing files Table of Contents * Requirements * Installation + Building MatX + Integrating MatX With Your Own Projects * Documentation + Supported Data Types * Unit Tests * Quick Start Guide * Release History * Filing Issues * Contributing Guide Requirements MatX support is currently limited to Linux only due to the time to test Windows. If you'd like to voice your support for native Windows support using Visual Studio, please comment on the issue here: #153. Note: CUDA 12.0.0 through 12.2.0 have an issue that causes building MatX unit tests to show a compiler error or cause a segfault in the compiler. Please use CUDA 11.4-11.8 or CUDA 12.2.1+ with MatX. MatX is using features in C++17 and the latest CUDA compilers and libraries. For this reason, when running with GPU support, CUDA 11.4 and g++9 or newer is required. You can download the CUDA Toolkit here . MatX has been tested on and supports Pascal, Turing, Volta, Ampere, and Hopper GPU architectures. Jetson products are supported with Jetpack 5.0 or above. Note for CPU/Host support: CPU/Host execution is considered beta. Only operator execution is supported right now, but no functions that require libraries (FFT/GEMM, etc). If you find a bug in an operator on CPU, please report it in the issues above. Installation MatX is a header-only library that does not require compiling for using in your applications. However, building unit tests, benchmarks, or examples must be compiled. CPM is used as a package manager for CMake to download and configure any dependencies. If MatX is to be used in an air-gapped environment, CPM can be configured to search locally for files. Depending on what options are enabled, compiling could take very long without parallelism enabled. Using the -j flag on make is suggested with the highest number your system will accommodate. Building MatX To build all components, issue the standard cmake build commands in a cloned repo: mkdir build && cd build cmake -DMATX_BUILD_TESTS=ON -DMATX_BUILD_BENCHMARKS=ON -DMATX_BUILD_EXAMPLES=ON -DMATX_BUILD_DOCS=OFF .. make -j By default CMake will target the GPU architecture(s) of the system you're compiling on. If you wish to target other architectures, pass the CMAKE_CUDA_ARCHITECTURES flag with a list of architectures to build for: cmake .. -DCMAKE_CUDA_ARCHITECTURES="80;90" By default nothing is compiled. If you wish to compile certain options, use the CMake flags below with ON or OFF values: MATX_BUILD_TESTS MATX_BUILD_BENCHMARKS MATX_BUILD_EXAMPLES MATX_BUILD_DOCS For example, to enable unit test building: mkdir build && cd build cmake -DMATX_BUILD_TESTS=ON .. make -j Note that if documentation is selected all other build options are off. This eases the dependencies needed to build documentation so large libraries such as CUDA don't need to be installed. Integrating MatX With Your Own Projects MatX uses CMake as a first-class build generator, and therefore provides the proper config files to include into your own project. There are typically two ways to do this: 1. Adding MatX as a subdirectory 2. Installing MatX to the system MatX as a Subdirectory Adding the subdirectory is useful if you include the MatX source into the directory structure of your project. Using this method, you can simply add the MatX directory: add_subdirectory(path/to/matx) MatX Installed to the System The other option is to install MatX and use the configuration file provided after building. This is typically done in a way similar to what is shown below: cd /path/to/matx mkdir build && cd build cmake .. make && make install If you have the correct permissions, the headers and cmake packages will be installed on your system in the expected paths for your operating system. With the package installed you can use find_package as follows: find_package(matx CONFIG REQUIRED) An example of using this method can be found in the examples/ cmake_sample_project directory MatX CMake Targets Once either of the two methods above are done, you can use the transitive target matx::matx in your library inside of target_link_libraries. MatX may add other optional targets in the future inside the matx:: namespace as well. Documentation Documentation for MatX can be built locally as shown above with the DBUILD_DOCS=ON cmake flag. Building documentation requires the following to be installed: doxygen, breathe, sphinx, sphinx-rtd-theme, libjs-mathjax, texlive-font-utils, flex, bison * Current documentation can be found here * A quick start guide can be found here * Current library limitations are listed here * A conversion from MATLAB and Python syntax is found here * A self-guided Jupyer notebook training can be found here MatX uses semantic versioning and reserve the right to introduce breaking API changes on major releases. Supported Data Types MatX supports all types that use standard C++ operators for math (+, -, etc). Unit tests are run against all common types shown below. * Integer: int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t * Floating Point: matxFp16 (fp16), matxBf16 (bfloat16), float, double * Complex: matxfp16Complex, matxBf16Complex, cuda::std::complex , cuda::std::complex Since CUDA half precision types (__half and __nv_bfloat16) do not support all C++ operators on the host side, MatX provides the matxFp16 and matxBf16 types for scalars, and matxFp16Complex and matxBf16Complex for complex types. These wrappers are needed so that tensor views can be evaluated on both the host and device, regardless of CUDA or hardware support. When possible, the half types will use hardware- accelerated intrinsics automatically. Existing code using __half and __nv_bfloat16 may be converted to the matx equivalent types directly and leverage all operators. Unit Tests MatX contains a suite of unit tests to test functionality of the primitive functions, plus end-to-end tests of example code. MatX uses pybind11 to generate some of the unit test inputs and outputs. This avoids the need to store large test vector files in git, and instead can be generated as-needed. To run the unit tests, from the cmake build directory run: test/matx_test This will execute all unit tests defined. If you wish to execute a subset of tests, or run with different options, you may run test/ matx_test directly with parameters defined by Google Test. To run matx_test directly, you must be inside the build/test directory for the correct paths to be set. For example, to run only tests with the name FFT: cd build/test ./matx_test --gtest_filter="*FFT*" Quick Start Guide We provide a variety of training materials and examples to quickly learn the MatX API. * A quick start guide can be found in the docs directory or from the main documentation site. The MatX quick start guide is modeled after NumPy's and demonstrates how to manipulate and create tensors. * A set of MatX notebooks can be found in the docs directory. These four notebooks walk through the major MatX features and allow the developer to practice writing MatX code with guided examples and questions. * Finally, for new MatX developers, browsing the example applications can provide familarity with the API and best practices. Release Major Features v0.6.0: * Breaking changes + This marks the first release of using "transforms as operators". This allows transforms to be used in any operator expression, whereas the previous release required them to be on separate lines. For an example, please see: https:// nvidia.github.io/MatX/basics/fusion.html. This also causes a breaking change with transform usage. Converting to the new format is as simple as moving the function parameters. For example: matmul(C, A, B, stream); becomes (C = matmul (A,B)).run(stream);. * Features + Polyphase channelizer + Many new operators, including upsample, downsample, pwelch, overlap, at, etc + Added more lvalue semantics for operators based on view manipulation * Bug fixes + Fixed cache issues + Fixed stride = 0 in matmul v0.5.0: * Polyphase resampler * Documentation overhaul with examples for each function v0.4.0: * SVD power iteration function * sign, and index operators * Batched QR for small matrices * dlpack export support * 16-bit float reductions * Output iterator support in CUB Discussions We have an open discussions board here. We encourage any questions about the library to be posted here for other users to learn from and read through. Filing Issues We welcome and encourage the creation of issues against MatX. When creating a new issue, please use the following syntax in the title of your submission to help us prioritize responses and planned work. * Bug Report: Append [BUG] to the beginning of the issue title, e.g. [BUG] MatX fails to build on P100 GPU * Documentation Request: Append [DOC] to the beginning of the issue title * Feature Request: Append [FEA] to the beginning of the issue title * Submit a Question: Append [QST] to the beginning of the issue title As with all issues, please be as verbose as possible and, if relevant, include a test script that demonstrates the bug or expected behavior. It's also helpful if you provide environment details about your system (bare-metal, cloud GPU, etc). Contributing Guide Please review the CONTRIBUTING.md file for information on how to contribute code and issues to MatX. We require all pull requests to have a linear history and rebase to main before merge. About An efficient C++17 GPU numerical computing library with Python-like syntax nvidia.github.io/MatX Topics hpc gpu cuda gpgpu gpu-computing Resources Readme License BSD-3-Clause license Code of conduct Code of conduct Activity Stars 805 stars Watchers 20 watching Forks 55 forks Report repository Releases 13 v0.6.0 Latest Oct 2, 2023 + 12 releases Packages 0 No packages published Contributors 20 * @cliffburdick * @luitjens * @tylera-nvidia * @tbensonatl * @awthomp * @kshitij12345 * @nvjonwong * @tmartin-gh * @ZJUGuoShuai * @pkestene * @eschmidt-nvidia + 9 contributors Languages * C++ 50.9% * Cuda 22.2% * CMake 21.6% * Jupyter Notebook 3.1% * Python 1.4% * C 0.4% * Other 0.4% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.